52 public $charset_output =
'UTF-8';
58 public $tab_translate = array();
63 private $_tab_loaded = array();
68 public $cache_labels = array();
73 public $cache_currencies = array();
79 private $cache_currencies_all_loaded =
false;
95 public $errors = array();
106 if (!empty(
$conf->file->character_set_client)) {
107 $this->charset_output =
$conf->file->character_set_client;
110 $this->dir = array($dir);
112 $this->dir =
$conf->file->dol_document_root;
133 foreach (
$conf->file->dol_document_root as $dir) {
135 if (!in_array($newdir, $this->dir)) {
136 $more[
'module_' . $i] = $newdir;
140 $this->dir = array_merge($more, $this->dir);
143 $this->origlang = $srclang;
145 if (empty($srclang) || $srclang ==
'auto') {
147 $langpref = empty($_SERVER[
'HTTP_ACCEPT_LANGUAGE']) ?
'' : $_SERVER[
'HTTP_ACCEPT_LANGUAGE'];
148 $langpref = preg_replace(
"/;([^,]*)/i",
"", $langpref);
149 $langpref = str_replace(
"-",
"_", $langpref);
150 $langlist = preg_split(
"/[;,]/", $langpref);
151 $codetouse = preg_replace(
'/[^_a-zA-Z]/',
'', $langlist[0]);
153 $codetouse = $srclang;
157 $langpart = explode(
"_", $codetouse);
159 if (!empty($langpart[1])) {
161 $longforshort = array(
'ar' =>
'ar_SA');
162 $longforshortexcep = array(
'ar_EG');
163 if (isset($longforshort[strtolower($langpart[0])]) && !in_array($codetouse, $longforshortexcep)) {
164 $srclang = $longforshort[strtolower($langpart[0])];
165 } elseif (!is_numeric($langpart[1])) {
166 $srclang = strtolower($langpart[0]) .
"_" . strtoupper($langpart[1]);
167 $longforlong = array(
'no_nb' =>
'nb_NO');
168 if (isset($longforlong[strtolower($srclang)])) {
169 $srclang = $longforlong[strtolower($srclang)];
172 $srclang = strtolower($langpart[0]) .
"_" . strtoupper($langpart[0]);
176 $longforshort = array(
177 'am' =>
'am_ET',
'ar' =>
'ar_SA',
'bn' =>
'bn_DB',
'el' =>
'el_GR',
'ca' =>
'ca_ES',
'cs' =>
'cs_CZ',
'en' =>
'en_US',
'fa' =>
'fa_IR',
178 'gl' =>
'gl_ES',
'he' =>
'he_IL',
'hi' =>
'hi_IN',
'ja' =>
'ja_JP',
179 'ka' =>
'ka_GE',
'km' =>
'km_KH',
'kn' =>
'kn_IN',
'ko' =>
'ko_KR',
'lo' =>
'lo_LA',
'nb' =>
'nb_NO',
'no' =>
'nb_NO',
'ne' =>
'ne_NP',
180 'sl' =>
'sl_SI',
'sq' =>
'sq_AL',
'sr' =>
'sr_RS',
'sv' =>
'sv_SE',
'uk' =>
'uk_UA',
'vi' =>
'vi_VN',
'zh' =>
'zh_CN'
182 if (isset($longforshort[strtolower($langpart[0])])) {
183 $srclang = $longforshort[strtolower($langpart[0])];
184 } elseif (!empty($langpart[0])) {
185 $srclang = strtolower($langpart[0]) .
"_" . strtoupper($langpart[0]);
191 $this->defaultlang = $srclang;
192 $this->shortlang = substr($srclang, 0, 2);
207 return $this->defaultlang;
209 return substr($this->defaultlang, 0, 2);
223 foreach ($domains as $domain) {
224 $result = $this->
load($domain);
227 } elseif ($result < 0) {
257 public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir =
'', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0, &$tabtranslatedomain = [], $langkey =
'')
264 if (empty($domain)) {
265 dol_print_error(
null, get_class($this) .
"::Load ErrorWrongParameters");
268 if ($this->defaultlang ===
'none_NONE') {
274 if (empty($loadfromfileonly) && count($this->tab_translate) == 0) {
279 $newdomain = $domain;
284 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $domain, $regs)) {
285 $newdomain = (string) $regs[1];
286 $modulename = (string) $regs[2];
291 !empty($this->_tab_loaded[$newdomain])
292 && ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound))
299 $langofdir = (empty($forcelangdir) ? $this->defaultlang : $forcelangdir);
300 $langkey = (empty($langkey) ? $langofdir : $langkey);
303 $langarray = explode(
'_', $langofdir);
304 if ($alt < 1 && isset($langarray[1]) && (strtolower($langarray[0]) == strtolower($langarray[1]) || in_array(strtolower($langofdir), array(
'el_gr')))) {
307 if ($alt < 2 && strtolower($langofdir) ==
'en_us') {
311 if (empty($langofdir)) {
312 dol_syslog(
"Error: " . get_class($this) .
"::load was called for domain=" . $domain .
" but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
317 foreach ($this->dir as $searchdir) {
319 $file_lang = $searchdir . ($modulename ?
'/' . $modulename :
'') .
"/langs/" . $langofdir .
"/" . $newdomain .
".lang";
323 $filelangexists = @is_file($file_lang_osencoded);
328 if ($filelangexists) {
336 $usecachekey = $newdomain .
'_' . $langkey .
'_' . md5($file_lang);
339 $usecachekey = $newdomain;
344 require_once DOL_DOCUMENT_ROOT .
'/core/lib/memory.lib.php';
346 if (is_array($tmparray) && count($tmparray)) {
347 $this->tab_translate += $tmparray;
356 if ($fp = @fopen($file_lang,
"rt")) {
364 while ($line = fscanf($fp,
"%[^= ]%*[ =]%[^\n\r]")) {
365 if (isset($line[1])) {
366 list($key, $value) = $line;
369 if (empty($this->tab_translate[$key])) {
370 if ($key ==
'DIRECTION') {
371 if ($alt < 2 || empty($this->tab_translate[$key])) {
372 $this->tab_translate[$key] = $value;
373 if ($stopafterdirection) {
375 } elseif ($usecachekey) {
376 $tabtranslatedomain[$key] = $value;
379 } elseif ($key[0] ==
'#') {
383 $this->tab_translate[$key] = str_replace(array(
'\\n',
'\\\\s'), array(
"\n",
'\s'), $value);
385 $tabtranslatedomain[$key] = $value;
406 $langofdir = strtolower($langarray[0]) .
'_' . strtoupper($langarray[0]);
407 if ($langofdir ==
'el_EL') {
408 $langofdir =
'el_GR';
410 if ($langofdir ==
'ar_AR') {
411 $langofdir =
'ar_SA';
413 $this->
load($domain, $alt + 1, $stopafterdirection, $langofdir, 0, 0, $tabtranslatedomain, $langkey);
420 $langofdir =
'en_US';
421 $this->
load($domain, $alt + 1, $stopafterdirection, $langofdir, 0, 0, $tabtranslatedomain, $langkey);
427 $this->_tab_loaded[$newdomain] = 1;
430 if (empty($this->_tab_loaded[$newdomain])) {
431 $this->_tab_loaded[$newdomain] = 2;
437 if (empty($loadfromfileonly)) {
438 $overwritekey =
'MAIN_OVERWRITE_TRANS_' . $this->defaultlang;
442 foreach ($tmparray as $tmp) {
443 $tmparray2 = explode(
':', $tmp);
444 if (!empty($tmparray2[1])) {
445 $this->tab_translate[$tmparray2[0]] = $tmparray2[1];
452 if ($usecachekey && count($tabtranslatedomain)) {
453 $ressetcache =
dol_setcache($usecachekey, $tabtranslatedomain);
454 if ($ressetcache < 0) {
455 $error =
'Failed to set cache for usecachekey=' . $usecachekey .
' result=' . $ressetcache;
462 !empty($this->tab_translate[
"SeparatorDecimal"]) && !empty($this->tab_translate[
"SeparatorThousand"])
463 && $this->tab_translate[
"SeparatorDecimal"] == $this->tab_translate[
"SeparatorThousand"]
465 $this->tab_translate[
"SeparatorThousand"] =
'';
487 $domain =
'database';
496 $newdomain = $domain;
499 if (!empty($this->_tab_loaded[$newdomain])) {
504 $this->_tab_loaded[$newdomain] = 2;
507 $langofdir = $this->defaultlang;
509 if (empty($langofdir)) {
510 dol_syslog(
"Error: " . get_class($this) .
"::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
521 $usecachekey = $newdomain .
'_' . $langofdir;
524 $usecachekey = $newdomain;
531 require_once DOL_DOCUMENT_ROOT .
'/core/lib/memory.lib.php';
533 if (is_array($tmparray) && count($tmparray)) {
534 $this->tab_translate += $tmparray;
544 $sql =
"SELECT transkey, transvalue FROM ".$db->prefix().
"overwrite_trans where (lang='".$db->escape($this->defaultlang).
"' OR lang IS NULL)";
545 $sql .=
" AND entity IN (0, ".getEntity(
'overwrite_trans').
")";
546 $sql .= $db->order(
"lang",
"DESC");
548 $resql = $db->query($sql);
551 $num = $db->num_rows($resql);
553 $tabtranslatedomain = array();
557 $obj = $db->fetch_object($resql);
559 $key = $obj->transkey;
560 $value = $obj->transvalue;
563 if (empty($this->tab_translate[$key])) {
565 $this->tab_translate[$key] = str_replace(array(
'\\n',
'\\\\s'), array(
"\n",
'\s'), $value);
568 $tabtranslatedomain[$key] = $value;
579 if ($usecachekey && count($tabtranslatedomain)) {
580 $ressetcache =
dol_setcache($usecachekey, $tabtranslatedomain);
581 if ($ressetcache < 0) {
582 $error =
'Failed to set cache for usecachekey=' . $usecachekey .
' result=' . $ressetcache;
593 $this->_tab_loaded[$newdomain] = 1;
607 return $this->_tab_loaded[$domain];
625 if (!is_string($key)) {
627 return 'ErrorBadValueForParamNotAString';
632 if (preg_match(
'/^Civility([0-9A-Z_]+)$/i', $key, $reg)) {
633 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_civility',
'code',
'label');
634 } elseif (preg_match(
'/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg)) {
635 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_currencies',
'code_iso',
'label');
636 } elseif (preg_match(
'/^SendingMethod([0-9A-Z_]+)$/i', $key, $reg)) {
637 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_shipment_mode',
'code',
'libelle');
638 } elseif (preg_match(
'/^PaymentType(?:Short)?([0-9A-Z_]+)$/i', $key, $reg)) {
639 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_paiement',
'code',
'libelle',
'', 1);
640 } elseif (preg_match(
'/^OppStatus([0-9A-Z_]+)$/i', $key, $reg)) {
641 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_lead_status',
'code',
'label');
642 } elseif (preg_match(
'/^OrderSource([0-9A-Z_]+)$/i', $key, $reg)) {
670 public function trans($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $maxsize = 0)
672 if (!empty($this->tab_translate[$key])) {
673 $str = $this->tab_translate[$key];
676 $replacekey =
'MAIN_REPLACE_TRANS_' . $this->defaultlang;
679 foreach ($tmparray as $tmp) {
680 $tmparray2 = explode(
':', $tmp);
681 $str = preg_replace(
'/' . preg_quote($tmparray2[0]) .
'/', $tmparray2[1], $str);
686 $str = preg_replace(
'/([^%])%([^%0sdmYIMpHSBb])/',
'\1__percent_with_bad_specifier__\2', $str);
688 if (strpos($key,
'Format') !== 0) {
691 $str = sprintf($str, $param1, $param2, $param3, $param4);
698 $str = str_replace(
'__percent_with_bad_specifier__',
'%', $str);
704 array(
'"',
'<b>',
'</b>',
'<u>',
'</u>',
'<i>',
'</i>',
'<center>',
'</center>',
'<strong>',
'</strong>',
'<a ',
'</a>',
'<br>',
'<span',
'</span>',
'< ',
'>'),
705 array(
'__quot__',
'__tagb__',
'__tagbend__',
'__tagu__',
'__taguend__',
'__tagi__',
'__tagiend__',
'__tagcenter__',
'__tagcenterend__',
'__tagb__',
'__tagbend__',
'__taga__',
'__tagaend__',
'__tagbr__',
'__tagspan__',
'__tagspanend__',
'__ltspace__',
'__gt__'),
710 $str = htmlentities($str, ENT_COMPAT, $this->charset_output);
714 array(
'__quot__',
'__tagb__',
'__tagbend__',
'__tagu__',
'__taguend__',
'__tagi__',
'__tagiend__',
'__tagcenter__',
'__tagcenterend__',
'__taga__',
'__tagaend__',
'__tagbr__',
'__tagspan__',
'__tagspanend__',
'__ltspace__',
'__gt__'),
715 array(
'"',
'<b>',
'</b>',
'<u>',
'</u>',
'<i>',
'</i>',
'<center>',
'</center>',
'<a ',
'</a>',
'<br>',
'<span',
'</span>',
'< ',
'>'),
721 $str = str_replace(array(
'%27',
'''),
'', $str);
748 public function transnoentities($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $param5 =
'')
769 public function tr($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $param5 =
'')
791 if (!empty($this->tab_translate[$key])) {
792 $str = $this->tab_translate[$key];
795 $replacekey =
'MAIN_REPLACE_TRANS_' . $this->defaultlang;
798 foreach ($tmparray as $tmp) {
799 $tmparray2 = explode(
':', $tmp);
800 $str = preg_replace(
'/' . preg_quote($tmparray2[0]) .
'/', $tmparray2[1], $str);
804 $str = preg_replace(
'/([^%])%([^%0sdmYIMpHSBb])/',
'\1__percent_with_bad_specifier__\2', $str);
806 if (!preg_match(
'/^Format/', $key)) {
809 $str = sprintf($str, $param1, $param2, $param3, $param4, $param5);
816 $str = str_replace(
'__percent_with_bad_specifier__',
'%', $str);
820 $str = str_replace(array(
'%27',
'''),
'', $str);
839 $strLocaleKey = $str.$countrycode;
840 if (!empty($this->tab_translate[$strLocaleKey])) {
841 return $this->
trans($strLocaleKey);
843 return $this->
trans($str);
858 $strLocaleKey = $str.$countrycode;
859 if (!empty($this->tab_translate[$strLocaleKey])) {
877 if (empty($pagecodeto)) {
878 $pagecodeto = $this->charset_output;
881 if ($pagecodefrom ==
'ISO-8859-1' && $pagecodeto ==
'UTF-8') {
882 $str = mb_convert_encoding($str,
'UTF-8',
'ISO-8859-1');
884 if ($pagecodefrom ==
'UTF-8' && $pagecodeto ==
'ISO-8859-1') {
885 $str = mb_convert_encoding(str_replace(
'€', chr(128), $str),
'ISO-8859-1');
905 $this->
load(
"languages");
908 $handle = opendir($langdir .
"/langs");
909 $langs_available = array();
910 while ($dir = trim(readdir($handle))) {
912 if (preg_match(
'/^([a-z]+)_([A-Z]+)/i', $dir, $regs)) {
915 $arrayofspecialmainlanguages = array(
944 if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages)) {
954 $langs_available[$dir] = $dir;
958 $langs_available[$dir] = $dir .
': ' .
dol_trunc($this->
trans(
'Language_' . $dir), $maxlength);
960 $langs_available[$dir] = $this->
trans(
'Language_' . $dir);
963 $langs_available[$dir] = str_replace(
' (United States)',
'', $langs_available[$dir]);
967 return $langs_available;
983 foreach ($this->dir as $searchdir) {
984 if (is_readable(
dol_osencode($searchdir .
"/langs/" . $this->defaultlang .
"/" . $filename))) {
991 if ($this->defaultlang !=
"en_US") {
992 $filenamealt = $searchdir .
"/langs/en_US/" . $filename;
995 if ($filenamealt !==
null && is_readable(
dol_osencode($filenamealt))) {
1020 $newnumber = $number;
1022 $dirsubstitutions = array_merge(array(),
$conf->modules_parts[
'substitutions']);
1023 foreach ($dirsubstitutions as $reldir) {
1028 if (!is_dir($newdir)) {
1032 $fonc =
'numberwords';
1033 if (
file_exists($newdir .
'/functions_' . $fonc .
'.lib.php')) {
1034 include_once $newdir .
'/functions_' . $fonc .
'.lib.php';
1035 if (function_exists(
'numberwords_getLabelFromNumber')) {
1036 $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
1061 public function getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect =
'', $filteronentity = 0)
1068 if (preg_match(
'/[^0-9A-Z_]/i', $tablename) || preg_match(
'/[^0-9A-Z_]/i', $fieldkey) || preg_match(
'/[^0-9A-Z_]/i', $fieldlabel)) {
1069 $this->error =
'Bad value for parameter tablename, fieldkey or fieldlabel';
1077 if ($tmp != $key && $tmp !=
'ErrorBadValueForParamNotAString') {
1082 if (isset($this->cache_labels[$tablename][$key])) {
1083 return $this->cache_labels[$tablename][$key];
1087 $sql =
"SELECT " . $fieldlabel .
" as label";
1088 $sql .=
" FROM " . $db->prefix() . $tablename;
1089 $sql .=
" WHERE " . $fieldkey .
" = '" . $db->escape($keyforselect ? $keyforselect : $key) .
"'";
1090 if ($filteronentity) {
1091 $sql .=
" AND entity IN (" .
getEntity($tablename) .
')';
1093 dol_syslog(get_class($this) .
'::getLabelFromKey', LOG_DEBUG);
1094 $resql = $db->query($sql);
1096 $obj = $db->fetch_object($resql);
1098 $this->cache_labels[$tablename][$key] = (string) $obj->label;
1100 $this->cache_labels[$tablename][$key] = $key;
1104 return $this->cache_labels[$tablename][$key];
1106 $this->error = $db->lasterror();
1125 if (in_array($currency_code, array(
'USD'))) {
1126 return $symbol . $amount;
1128 return $amount . $symbol;
1142 $currency_sign =
'';
1144 if (function_exists(
"mb_convert_encoding")) {
1147 if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code][
'unicode']) && is_array($this->cache_currencies[$currency_code][
'unicode'])) {
1148 foreach ($this->cache_currencies[$currency_code][
'unicode'] as $unicode) {
1149 $currency_sign .= mb_convert_encoding(
"&#" . $unicode .
";",
"UTF-8",
'HTML-ENTITIES');
1154 return ($currency_sign ? $currency_sign : $currency_code);
1167 if ($this->cache_currencies_all_loaded) {
1170 if (!empty($currency_code) && isset($this->cache_currencies[$currency_code])) {
1174 $sql =
"SELECT code_iso, label, unicode";
1175 $sql .=
" FROM " . $db->prefix() .
"c_currencies";
1176 $sql .=
" WHERE active = 1";
1177 if (!empty($currency_code)) {
1178 $sql .=
" AND code_iso = '" . $db->escape($currency_code) .
"'";
1182 dol_syslog(get_class($this) .
'::loadCacheCurrencies', LOG_DEBUG);
1183 $resql = $db->query($sql);
1185 $this->
load(
"dict");
1187 if (!empty($currency_code)) {
1188 foreach ($this->cache_currencies as $key => $val) {
1189 $label[$key] = $val[
'label'];
1193 $num = $db->num_rows($resql);
1196 $obj = $db->fetch_object($resql);
1199 $this->cache_currencies[$obj->code_iso][
'label'] = ($obj->code_iso && $this->
trans(
"Currency" . $obj->code_iso) !=
"Currency" . $obj->code_iso ? $this->
trans(
"Currency" . $obj->code_iso) : ($obj->label !=
'-' ? $obj->label :
''));
1200 $this->cache_currencies[$obj->code_iso][
'unicode'] = (array) json_decode((empty($obj->unicode) ?
'' : $obj->unicode),
true);
1201 $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso][
'label'];
1205 if (empty($currency_code)) {
1206 $this->cache_currencies_all_loaded =
true;
1211 array_multisort($label, SORT_ASC, $this->cache_currencies);
1230 $substitutionarray = array();
1232 foreach ($this->tab_translate as $code => $label) {
1233 $substitutionarray[
'lang_' . $code] = $label;
1234 $substitutionarray[
'__(' . $code .
')__'] = $label;
1237 return $substitutionarray;
Class to manage translations.
transnoentities($key, $param1='', $param2='', $param3='', $param4='', $param5='')
Return translated value of a text string If there is no match for this text, we look in alternative f...
transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='', $param5='')
Return translated value of a text string.
getTradFromKey($key)
Return translated value of key for special keys ("Currency...", "Civility...", ......
getLabelFromNumber($number, $isamount='')
Return full text translated to language label for a key.
getCurrencyAmount($currency_code, $amount)
Return a currency code into its symbol.
get_translations_for_substitutions()
Return an array with content of all loaded translation keys (found into this->tab_translate) so we ge...
getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect='', $filteronentity=0)
Return a label for a key.
load($domain, $alt=0, $stopafterdirection=0, $forcelangdir='', $loadfromfileonly=0, $forceloadifalreadynotfound=0, &$tabtranslatedomain=[], $langkey='')
Load translation key-value for a particular file, into a memory array.
get_available_languages($langdir=DOL_DOCUMENT_ROOT, $maxlength=0, $usecode=0, $mainlangonly=0)
Return list of all available languages.
loadCacheCurrencies($currency_code)
Load into the cache this->cache_currencies, all currencies.
convToOutputCharset($str, $pagecodefrom='UTF-8', $pagecodeto='')
Convert a string into output charset (this->charset_output that should be defined to conf->file->char...
setDefaultLang($srclang='en_US')
Set accessor for this->defaultlang.
tr($key, $param1='', $param2='', $param3='', $param4='', $param5='')
Return translated value of a text string If there is no match for this text, we look in alternative f...
file_exists($filename, $searchalt=0)
Return if a filename $filename exists for current language (or alternate language)
transcountry($str, $countrycode)
Return translation of a key depending on country.
isLoaded($domain)
Get information with result of loading data for domain.
trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
Return text translated of text received as parameter (and encode it into HTML) If there is no match f...
transcountrynoentities($str, $countrycode)
Retourne la version traduite du texte passe en parameter complete du code pays.
getCurrencySymbol($currency_code, $forceloadall=0)
Return a currency code into its symbol.
loadLangs($domains)
Load translation files.
loadFromDatabase($db)
Load translation key-value from database into a memory array.
getDefaultLang($mode=0)
Return active language code for current user It's an accessor for this->defaultlang.
__construct($dir, $conf)
Constructor.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
dol_setcache($memoryid, $data, $expire=0, $filecache=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.