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_DZ',
'ar_EG',
'ar_IQ',
'ar_JO',
'ar_SY');
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")) {
365 while ($line = fscanf($fp,
"%[^= ]%*[ =]%[^\n\r]")) {
366 if (isset($line[1])) {
367 list($key, $value) = $line;
370 if (empty($this->tab_translate[$key])) {
371 if ($key ==
'DIRECTION') {
372 if ($alt < 2 || empty($this->tab_translate[$key])) {
373 $this->tab_translate[$key] = $value;
374 if ($stopafterdirection) {
376 } elseif ($usecachekey) {
377 $tabtranslatedomain[$key] = $value;
380 } elseif ($key[0] ==
'#') {
384 $this->tab_translate[$key] = str_replace(array(
'\\n',
'\\\\s'), array(
"\n",
'\s'), $value);
386 $tabtranslatedomain[$key] = $value;
407 $langofdir = strtolower($langarray[0]) .
'_' . strtoupper($langarray[0]);
408 if ($langofdir ==
'el_EL') {
409 $langofdir =
'el_GR';
411 if ($langofdir ==
'ar_AR') {
412 $langofdir =
'ar_SA';
414 $this->
load($domain, $alt + 1, $stopafterdirection, $langofdir, 0, 0, $tabtranslatedomain, $langkey);
421 $langofdir =
'en_US';
422 $this->
load($domain, $alt + 1, $stopafterdirection, $langofdir, 0, 0, $tabtranslatedomain, $langkey);
428 $this->_tab_loaded[$newdomain] = 1;
431 if (empty($this->_tab_loaded[$newdomain])) {
432 $this->_tab_loaded[$newdomain] = 2;
438 if (empty($loadfromfileonly)) {
439 $overwritekey =
'MAIN_OVERWRITE_TRANS_' . $this->defaultlang;
443 foreach ($tmparray as $tmp) {
444 $tmparray2 = explode(
':', $tmp);
445 if (!empty($tmparray2[1])) {
446 $this->tab_translate[$tmparray2[0]] = $tmparray2[1];
453 if ($usecachekey && count($tabtranslatedomain)) {
454 $ressetcache =
dol_setcache($usecachekey, $tabtranslatedomain);
455 if ($ressetcache < 0) {
456 $error =
'Failed to set cache for usecachekey=' . $usecachekey .
' result=' . $ressetcache;
463 !empty($this->tab_translate[
"SeparatorDecimal"]) && !empty($this->tab_translate[
"SeparatorThousand"])
464 && $this->tab_translate[
"SeparatorDecimal"] == $this->tab_translate[
"SeparatorThousand"]
466 $this->tab_translate[
"SeparatorThousand"] =
'';
486 $domain =
'database';
495 $newdomain = $domain;
498 if (!empty($this->_tab_loaded[$newdomain])) {
503 $this->_tab_loaded[$newdomain] = 2;
506 $langofdir = $this->defaultlang;
508 if (empty($langofdir)) {
509 dol_syslog(
"Error: " . get_class($this) .
"::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
520 $usecachekey = $newdomain .
'_' . $langofdir;
523 $usecachekey = $newdomain;
528 require_once DOL_DOCUMENT_ROOT .
'/core/lib/memory.lib.php';
530 if (is_array($tmparray) && count($tmparray)) {
531 $this->tab_translate += $tmparray;
540 $sql =
"SELECT transkey, transvalue FROM ".$db->prefix().
"overwrite_trans where (lang='".
$db->escape($this->defaultlang).
"' OR lang IS NULL)";
541 $sql .=
" AND entity IN (0, ".getEntity(
'overwrite_trans').
")";
542 $sql .=
$db->order(
"lang",
"DESC");
544 $resql =
$db->query($sql);
547 $num =
$db->num_rows($resql);
549 $tabtranslatedomain = array();
553 $obj =
$db->fetch_object($resql);
555 $key = $obj->transkey;
556 $value = $obj->transvalue;
559 if (empty($this->tab_translate[$key])) {
561 $this->tab_translate[$key] = (
string) str_replace(array(
'\\n',
'\\\\s'), array(
"\n",
'\s'), $value);
564 $tabtranslatedomain[$key] = $value;
575 if ($usecachekey && count($tabtranslatedomain)) {
576 $ressetcache =
dol_setcache($usecachekey, $tabtranslatedomain);
577 if ($ressetcache < 0) {
578 $error =
'Failed to set cache for usecachekey=' . $usecachekey .
' result=' . $ressetcache;
589 $this->_tab_loaded[$newdomain] = 1;
603 return $this->_tab_loaded[$domain];
621 if (!is_string($key)) {
623 return 'ErrorBadValueForParamNotAString';
628 if (preg_match(
'/^Civility([0-9A-Z_]+)$/i', $key, $reg)) {
629 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_civility',
'code',
'label');
630 } elseif (preg_match(
'/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg)) {
631 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_currencies',
'code_iso',
'label');
632 } elseif (preg_match(
'/^SendingMethod([0-9A-Z_]+)$/i', $key, $reg)) {
633 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_shipment_mode',
'code',
'libelle');
634 } elseif (preg_match(
'/^PaymentType(?:Short)?([0-9A-Z_]+)$/i', $key, $reg)) {
635 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_paiement',
'code',
'libelle',
'', 1);
636 } elseif (preg_match(
'/^OppStatus([0-9A-Z_]+)$/i', $key, $reg)) {
637 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_lead_status',
'code',
'label');
638 } elseif (preg_match(
'/^OrderSource([0-9A-Z_]+)$/i', $key, $reg)) {
666 public function trans($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $maxsize = 0)
668 if (!empty($this->tab_translate[$key])) {
669 $str = $this->tab_translate[$key];
672 $replacekey =
'MAIN_REPLACE_TRANS_' . $this->defaultlang;
675 foreach ($tmparray as $tmp) {
676 $tmparray2 = explode(
':', $tmp);
677 $str = preg_replace(
'/' . preg_quote($tmparray2[0],
'/') .
'/', $tmparray2[1], $str);
682 $str = preg_replace(
'/([^%])%([^%0sdmYIMpHSBb])/',
'\1__percent_with_bad_specifier__\2', $str);
684 if (strpos($key,
'Format') !== 0) {
687 $str = sprintf($str, $param1, $param2, $param3, $param4);
694 $str = str_replace(
'__percent_with_bad_specifier__',
'%', $str);
699 array(
'"',
'<b>',
'</b>',
'<u>',
'</u>',
'<i>',
'</i>',
'<center>',
'</center>',
'<strong>',
'</strong>',
'<a ',
'</a>',
'<br>',
'<span',
'</span>',
'< ',
'>'),
700 array(
'__quot__',
'__tagb__',
'__tagbend__',
'__tagu__',
'__taguend__',
'__tagi__',
'__tagiend__',
'__tagcenter__',
'__tagcenterend__',
'__tagb__',
'__tagbend__',
'__taga__',
'__tagaend__',
'__tagbr__',
'__tagspan__',
'__tagspanend__',
'__ltspace__',
'__gt__'),
705 $str = htmlentities($str, ENT_COMPAT, $this->charset_output);
709 array(
'__quot__',
'__tagb__',
'__tagbend__',
'__tagu__',
'__taguend__',
'__tagi__',
'__tagiend__',
'__tagcenter__',
'__tagcenterend__',
'__taga__',
'__tagaend__',
'__tagbr__',
'__tagspan__',
'__tagspanend__',
'__ltspace__',
'__gt__'),
710 array(
'"',
'<b>',
'</b>',
'<u>',
'</u>',
'<i>',
'</i>',
'<center>',
'</center>',
'<a ',
'</a>',
'<br>',
'<span',
'</span>',
'< ',
'>'),
716 $str = str_replace(array(
'%27',
'''),
'', $str);
743 public function transnoentities($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $param5 =
'')
764 public function tr($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $param5 =
'')
786 if (!empty($this->tab_translate[$key])) {
787 $str = $this->tab_translate[$key];
790 $replacekey =
'MAIN_REPLACE_TRANS_' . $this->defaultlang;
793 foreach ($tmparray as $tmp) {
794 $tmparray2 = explode(
':', $tmp);
795 $str = preg_replace(
'/' . preg_quote($tmparray2[0],
'/') .
'/', $tmparray2[1], $str);
799 $str = preg_replace(
'/([^%])%([^%0sdmYIMpHSBb])/',
'\1__percent_with_bad_specifier__\2', $str);
801 if (strpos($key,
'Format') !== 0) {
804 $str = sprintf($str, $param1, $param2, $param3, $param4, $param5);
811 $str = str_replace(
'__percent_with_bad_specifier__',
'%', $str);
815 $str = str_replace(array(
'%27',
'''),
'', $str);
834 $strLocaleKey = $str.$countrycode;
835 if (!empty($this->tab_translate[$strLocaleKey])) {
836 return $this->
trans($strLocaleKey);
838 return $this->
trans($str);
853 $strLocaleKey = $str.$countrycode;
854 if (!empty($this->tab_translate[$strLocaleKey])) {
874 if (empty($pagecodeto)) {
875 $pagecodeto = $this->charset_output;
878 if ($pagecodefrom ==
'ISO-8859-1' && $pagecodeto ==
'UTF-8') {
879 $str = mb_convert_encoding($str,
'UTF-8',
'ISO-8859-1');
881 if ($pagecodefrom ==
'UTF-8' && $pagecodeto ==
'ISO-8859-1') {
882 $str = mb_convert_encoding(str_replace(
'€', chr(128), $str),
'ISO-8859-1');
902 $this->
load(
"languages");
905 $handle = opendir($langdir .
"/langs");
906 $langs_available = array();
907 while ($dir = trim(readdir($handle))) {
909 if (preg_match(
'/^([a-z]+)_([A-Z]+)/i', $dir, $regs)) {
912 $arrayofspecialmainlanguages = array(
941 if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages)) {
951 $langs_available[$dir] = $dir;
955 $langs_available[$dir] = $dir .
': ' .
dol_trunc($this->
trans(
'Language_' . $dir), $maxlength);
957 $langs_available[$dir] = $this->
trans(
'Language_' . $dir);
960 $langs_available[$dir] = str_replace(
' (United States)',
'', $langs_available[$dir]);
964 return $langs_available;
980 foreach ($this->dir as $searchdir) {
981 if (is_readable(
dol_osencode($searchdir .
"/langs/" . $this->defaultlang .
"/" . $filename))) {
988 if ($this->defaultlang !=
"en_US") {
989 $filenamealt = $searchdir .
"/langs/en_US/" . $filename;
992 if ($filenamealt !==
null && is_readable(
dol_osencode($filenamealt))) {
1017 $newnumber = $number;
1019 $dirsubstitutions = array_merge(array(),
$conf->modules_parts[
'substitutions']);
1020 foreach ($dirsubstitutions as $reldir) {
1025 if (!is_dir($newdir)) {
1029 $fonc =
'numberwords';
1030 if (
file_exists($newdir .
'/functions_' . $fonc .
'.lib.php')) {
1031 include_once $newdir .
'/functions_' . $fonc .
'.lib.php';
1032 if (function_exists(
'numberwords_getLabelFromNumber')) {
1033 $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
1058 public function getLabelFromKey(
$db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect =
'', $filteronentity = 0)
1065 if (preg_match(
'/[^0-9A-Z_]/i', $tablename) || preg_match(
'/[^0-9A-Z_]/i', $fieldkey) || preg_match(
'/[^0-9A-Z_]/i', $fieldlabel)) {
1066 $this->error =
'Bad value for parameter tablename, fieldkey or fieldlabel';
1074 if ($tmp != $key && $tmp !=
'ErrorBadValueForParamNotAString') {
1079 if (isset($this->cache_labels[$tablename][$key])) {
1080 return $this->cache_labels[$tablename][$key];
1084 $sql =
"SELECT " .
$db->sanitize($fieldlabel) .
" as label";
1085 $sql .=
" FROM " .
$db->prefix() . $tablename;
1086 $sql .=
" WHERE " .
$db->sanitize($fieldkey) .
" = '" .
$db->escape($keyforselect ? $keyforselect : $key) .
"'";
1087 if ($filteronentity) {
1088 $sql .=
" AND entity IN (" .
getEntity($tablename) .
')';
1090 dol_syslog(get_class($this) .
'::getLabelFromKey', LOG_DEBUG);
1091 $resql =
$db->query($sql);
1093 $obj =
$db->fetch_object($resql);
1095 $this->cache_labels[$tablename][$key] = (
string) $obj->label;
1097 $this->cache_labels[$tablename][$key] = $key;
1101 return $this->cache_labels[$tablename][$key];
1103 $this->error =
$db->lasterror();
1122 if (in_array($currency_code, array(
'USD'))) {
1123 return $symbol . $amount;
1125 return $amount . $symbol;
1139 $currency_sign =
'';
1141 if (empty($currency_code)) {
1145 if (function_exists(
"mb_convert_encoding")) {
1148 if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code][
'unicode']) && is_array($this->cache_currencies[$currency_code][
'unicode'])) {
1149 foreach ($this->cache_currencies[$currency_code][
'unicode'] as $unicode) {
1150 $currency_sign .= mb_convert_encoding(
"&#" . $unicode .
";",
"UTF-8",
'HTML-ENTITIES');
1155 return ($currency_sign ? $currency_sign : $currency_code);
1168 if ($this->cache_currencies_all_loaded) {
1171 if (!empty($currency_code) && isset($this->cache_currencies[$currency_code])) {
1175 dol_syslog(get_class($this) .
'::loadCacheCurrencies', LOG_DEBUG);
1177 $sql =
"SELECT code_iso, label, unicode";
1178 $sql .=
" FROM " .
$db->prefix() .
"c_currencies";
1179 $sql .=
" WHERE active = 1";
1180 if (!empty($currency_code)) {
1181 $sql .=
" AND code_iso = '" .
$db->escape($currency_code) .
"'";
1185 $resql =
$db->query($sql);
1187 $this->
load(
"dict");
1189 if (!empty($currency_code)) {
1190 foreach ($this->cache_currencies as $key => $val) {
1191 $label[$key] = $val[
'label'];
1195 $num =
$db->num_rows($resql);
1198 $obj =
$db->fetch_object($resql);
1201 if ($obj->code_iso && !empty($this->tab_translate[
"Currency" . $obj->code_iso])) {
1202 $tmplabel = $this->
trans(
"Currency" . $obj->code_iso);
1204 $tmplabel = ($obj->label !=
'-' ? $obj->label :
'');
1207 $this->cache_currencies[$obj->code_iso][
'label'] = $tmplabel;
1208 $this->cache_currencies[$obj->code_iso][
'unicode'] = (array) json_decode((empty($obj->unicode) ?
'' : $obj->unicode),
true);
1209 $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso][
'label'];
1213 if (empty($currency_code)) {
1214 $this->cache_currencies_all_loaded =
true;
1219 array_multisort($label, SORT_ASC, $this->cache_currencies);
1239 $substitutionarray = array();
1241 foreach ($this->tab_translate as $code => $label) {
1242 $substitutionarray[
'lang_' . $code] = $label;
1243 $substitutionarray[
'__(' . $code .
')__'] = $label;
1246 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...
getCurrencySymbol($currency_code='', $forceloadall=0)
Return a currency code into its symbol.
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.
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.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
dol_setcache($memoryid, $data, $expire=0, $filecache=0, $replace=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.