@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page |
55 | 55 | $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
56 | 56 | $mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...) |
57 | -$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut' |
|
57 | +$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut' |
|
58 | 58 | if (empty($mode)) { |
59 | 59 | $mode = 'hierarchy'; |
60 | 60 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $object = new Categorie($db); |
85 | 85 | $extrafields = new ExtraFields($db); |
86 | 86 | $diroutputmassaction = $conf->category->dir_output.'/temp/massgeneration/'.$user->id; |
87 | -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
87 | +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
88 | 88 | |
89 | 89 | // Fetch optionals attributes and labels |
90 | 90 | $extrafields->fetch_name_optionals_label($object->table_element); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | // Default sort order (if not yet defined by previous GETPOST) |
96 | 96 | if (!$sortfield) { |
97 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
97 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
98 | 98 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
99 | 99 | } |
100 | 100 | if (!$sortorder) { |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | $entry .= '<span class="noborderoncategories" '.$color.'>'.$li.'</span>'; |
433 | 433 | if (!empty($conf->main_checkbox_left_column)) { |
434 | 434 | if ($user->hasRight('categorie', 'creer')) { |
435 | - $entry .= ' <a class="editfielda" href="' . DOL_URL_ROOT . '/categories/edit.php?id=' . $val['id'] . $param . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . urlencode($type)) . '">' . img_edit() . '</a>'; |
|
435 | + $entry .= ' <a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].$param.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.urlencode($type)).'">'.img_edit().'</a>'; |
|
436 | 436 | } |
437 | 437 | if ($user->hasRight('categorie', 'supprimer')) { |
438 | - $entry .= ' <a class="deletefilelink" href="' . DOL_URL_ROOT . '/categories/viewcat.php?action=delete&token=' . newToken() . '&id=' . $val['id'] . $param . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?' . $param) . '&backtolist=' . urlencode($_SERVER["PHP_SELF"] . '?' . $param) . '">' . img_delete() . '</a>'; |
|
438 | + $entry .= ' <a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].$param.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">'.img_delete().'</a>'; |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | $entry .= '</td>'; |
@@ -446,13 +446,13 @@ discard block |
||
446 | 446 | if (empty($conf->main_checkbox_left_column)) { |
447 | 447 | $entry .= '<td class="right" width="30px;">'; |
448 | 448 | if ($user->hasRight('categorie', 'creer')) { |
449 | - $entry .= '<a class="editfielda" href="' . DOL_URL_ROOT . '/categories/edit.php?id=' . $val['id'] . $param . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . urlencode($type)) . '">' . img_edit() . '</a>'; |
|
449 | + $entry .= '<a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].$param.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.urlencode($type)).'">'.img_edit().'</a>'; |
|
450 | 450 | } |
451 | 451 | $entry .= '</td>'; |
452 | 452 | |
453 | 453 | $entry .= '<td class="center" width="30px;">'; |
454 | 454 | if ($user->hasRight('categorie', 'supprimer')) { |
455 | - $entry .= '<a class="deletefilelink" href="' . DOL_URL_ROOT . '/categories/viewcat.php?action=delete&token=' . newToken() . '&id=' . $val['id'] . $param . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?' . $param) . '&backtolist=' . urlencode($_SERVER["PHP_SELF"] . '?' . $param) . '">' . img_delete() . '</a>'; |
|
455 | + $entry .= '<a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].$param.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">'.img_delete().'</a>'; |
|
456 | 456 | } |
457 | 457 | $entry .= '</td>'; |
458 | 458 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } else { |
526 | 526 | // Mode list |
527 | 527 | |
528 | - llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-acategory page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page |
|
528 | + llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-acategory page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page |
|
529 | 529 | |
530 | 530 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
531 | 531 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | } |
656 | 656 | |
657 | 657 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
658 | - $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup |
|
658 | + $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup |
|
659 | 659 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
660 | 660 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
661 | 661 | |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
753 | 753 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
754 | 754 | } |
755 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
755 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
756 | 756 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
757 | 757 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
758 | 758 | $totalarray['nbfield']++; |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | $more = array(); |
132 | 132 | $i = 0; |
133 | 133 | foreach ($conf->file->dol_document_root as $dir) { |
134 | - $newdir = $dir . getDolGlobalString('MAIN_FORCELANGDIR'); // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX' |
|
134 | + $newdir = $dir.getDolGlobalString('MAIN_FORCELANGDIR'); // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX' |
|
135 | 135 | if (!in_array($newdir, $this->dir)) { |
136 | - $more['module_' . $i] = $newdir; |
|
136 | + $more['module_'.$i] = $newdir; |
|
137 | 137 | $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir. |
138 | 138 | } |
139 | 139 | } |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | if (isset($longforshort[strtolower($langpart[0])]) && !in_array($codetouse, $longforshortexcep)) { |
164 | 164 | $srclang = $longforshort[strtolower($langpart[0])]; |
165 | 165 | } elseif (!is_numeric($langpart[1])) { // Second part YY may be a numeric with some Chrome browser |
166 | - $srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[1]); |
|
167 | - $longforlong = array('no_nb' => 'nb_NO'); // When lang and code are inverted by browser |
|
166 | + $srclang = strtolower($langpart[0])."_".strtoupper($langpart[1]); |
|
167 | + $longforlong = array('no_nb' => 'nb_NO'); // When lang and code are inverted by browser |
|
168 | 168 | if (isset($longforlong[strtolower($srclang)])) { |
169 | 169 | $srclang = $longforlong[strtolower($srclang)]; |
170 | 170 | } |
171 | 171 | } else { |
172 | - $srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[0]); |
|
172 | + $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); |
|
173 | 173 | } |
174 | 174 | } else { // If it's for a codetouse that is a short code xx |
175 | 175 | // Array to convert short lang code into long code. |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if (isset($longforshort[strtolower($langpart[0])])) { |
183 | 183 | $srclang = $longforshort[strtolower($langpart[0])]; |
184 | 184 | } elseif (!empty($langpart[0])) { |
185 | - $srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[0]); |
|
185 | + $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); |
|
186 | 186 | } else { |
187 | 187 | $srclang = 'en_US'; |
188 | 188 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | // Check parameters |
264 | 264 | if (empty($domain)) { |
265 | - dol_print_error(null, get_class($this) . "::Load ErrorWrongParameters"); |
|
265 | + dol_print_error(null, get_class($this)."::Load ErrorWrongParameters"); |
|
266 | 266 | return -1; |
267 | 267 | } |
268 | 268 | if ($this->defaultlang === 'none_NONE') { |
@@ -309,18 +309,18 @@ discard block |
||
309 | 309 | } |
310 | 310 | |
311 | 311 | if (empty($langofdir)) { // This may occurs when load is called without setting the language and without providing a value for forcelangdir |
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); |
|
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); |
|
313 | 313 | return -1; |
314 | 314 | } |
315 | 315 | |
316 | 316 | $usecachekey = ''; |
317 | 317 | foreach ($this->dir as $searchdir) { |
318 | 318 | // Directory of translation files |
319 | - $file_lang = $searchdir . ($modulename ? '/' . $modulename : '') . "/langs/" . $langofdir . "/" . $newdomain . ".lang"; |
|
319 | + $file_lang = $searchdir.($modulename ? '/'.$modulename : '')."/langs/".$langofdir."/".$newdomain.".lang"; |
|
320 | 320 | $file_lang_osencoded = dol_osencode($file_lang); |
321 | 321 | |
322 | 322 | //$filelangexists = is_file($file_lang_osencoded); |
323 | - $filelangexists = @is_file($file_lang_osencoded); // avoid [php:warn] |
|
323 | + $filelangexists = @is_file($file_lang_osencoded); // avoid [php:warn] |
|
324 | 324 | |
325 | 325 | //dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists); |
326 | 326 | //print 'Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' this->_tab_loaded[newdomain]='.$this->_tab_loaded[$newdomain].' file_lang='.$file_lang." => filelangexists=".$filelangexists."\n"; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $usecachekey = ''; |
334 | 334 | // Using a memcached server |
335 | 335 | if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) { |
336 | - $usecachekey = $newdomain . '_' . $langkey . '_' . md5($file_lang); // Should not contains special chars |
|
336 | + $usecachekey = $newdomain.'_'.$langkey.'_'.md5($file_lang); // Should not contains special chars |
|
337 | 337 | } elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { |
338 | 338 | // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) |
339 | 339 | $usecachekey = $newdomain; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | if ($usecachekey) { |
343 | 343 | //dol_syslog('Translate::Load we will cache result into usecachekey '.$usecachekey); |
344 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; |
|
344 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; |
|
345 | 345 | $tmparray = dol_getcache($usecachekey); |
346 | 346 | if (is_array($tmparray) && count($tmparray)) { |
347 | 347 | $this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added. |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($alt == 0) { |
404 | 404 | // This function MUST NOT contains call to syslog |
405 | 405 | //dol_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$newdomain.".lang file)", LOG_DEBUG); |
406 | - $langofdir = strtolower($langarray[0]) . '_' . strtoupper($langarray[0]); |
|
406 | + $langofdir = strtolower($langarray[0]).'_'.strtoupper($langarray[0]); |
|
407 | 407 | if ($langofdir == 'el_EL') { |
408 | 408 | $langofdir = 'el_GR'; // main parent for el_CY is not 'el_EL' but 'el_GR' |
409 | 409 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | // This part is deprecated and replaced with table llx_overwrite_trans |
436 | 436 | // Kept for backward compatibility. |
437 | 437 | if (empty($loadfromfileonly)) { |
438 | - $overwritekey = 'MAIN_OVERWRITE_TRANS_' . $this->defaultlang; |
|
438 | + $overwritekey = 'MAIN_OVERWRITE_TRANS_'.$this->defaultlang; |
|
439 | 439 | if (getDolGlobalString($overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2 |
440 | 440 | // Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX |
441 | 441 | $tmparray = explode(',', getDolGlobalString($overwritekey)); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | if ($usecachekey && count($tabtranslatedomain)) { |
453 | 453 | $ressetcache = dol_setcache($usecachekey, $tabtranslatedomain); |
454 | 454 | if ($ressetcache < 0) { |
455 | - $error = 'Failed to set cache for usecachekey=' . $usecachekey . ' result=' . $ressetcache; |
|
455 | + $error = 'Failed to set cache for usecachekey='.$usecachekey.' result='.$ressetcache; |
|
456 | 456 | dol_syslog($error, LOG_ERR); |
457 | 457 | } |
458 | 458 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $langofdir = $this->defaultlang; |
506 | 506 | |
507 | 507 | if (empty($langofdir)) { // This may occurs when load is called without setting the language and without providing a value for forcelangdir |
508 | - dol_syslog("Error: " . get_class($this) . "::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); |
|
508 | + dol_syslog("Error: ".get_class($this)."::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); |
|
509 | 509 | return -1; |
510 | 510 | } |
511 | 511 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $usecachekey = ''; |
517 | 517 | // Using a memcached server |
518 | 518 | if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) { |
519 | - $usecachekey = $newdomain . '_' . $langofdir; // Should not contains special chars |
|
519 | + $usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars |
|
520 | 520 | } elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { |
521 | 521 | // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) |
522 | 522 | $usecachekey = $newdomain; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | if ($usecachekey) { |
526 | 526 | //dol_syslog('Translate::Load we will cache result into usecachekey '.$usecachekey); |
527 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; |
|
527 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; |
|
528 | 528 | $tmparray = dol_getcache($usecachekey); |
529 | 529 | if (is_array($tmparray) && count($tmparray)) { |
530 | 530 | $this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added. |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | if ($usecachekey && count($tabtranslatedomain)) { |
575 | 575 | $ressetcache = dol_setcache($usecachekey, $tabtranslatedomain); |
576 | 576 | if ($ressetcache < 0) { |
577 | - $error = 'Failed to set cache for usecachekey=' . $usecachekey . ' result=' . $ressetcache; |
|
577 | + $error = 'Failed to set cache for usecachekey='.$usecachekey.' result='.$ressetcache; |
|
578 | 578 | dol_syslog($error, LOG_ERR); |
579 | 579 | } |
580 | 580 | } |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | $str = $this->tab_translate[$key]; |
669 | 669 | |
670 | 670 | // Make some string replacement after translation |
671 | - $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; |
|
671 | + $replacekey = 'MAIN_REPLACE_TRANS_'.$this->defaultlang; |
|
672 | 672 | if (getDolGlobalString($replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 |
673 | 673 | $tmparray = explode(';', getDolGlobalString($replacekey)); |
674 | 674 | foreach ($tmparray as $tmp) { |
675 | 675 | $tmparray2 = explode(':', $tmp); |
676 | - $str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str); |
|
676 | + $str = preg_replace('/'.preg_quote($tmparray2[0]).'/', $tmparray2[1], $str); |
|
677 | 677 | } |
678 | 678 | } |
679 | 679 | |
@@ -787,12 +787,12 @@ discard block |
||
787 | 787 | $str = $this->tab_translate[$key]; |
788 | 788 | |
789 | 789 | // Make some string replacement after translation |
790 | - $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; |
|
790 | + $replacekey = 'MAIN_REPLACE_TRANS_'.$this->defaultlang; |
|
791 | 791 | if (getDolGlobalString($replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 |
792 | 792 | $tmparray = explode(';', getDolGlobalString($replacekey)); |
793 | 793 | foreach ($tmparray as $tmp) { |
794 | 794 | $tmparray2 = explode(':', $tmp); |
795 | - $str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str); |
|
795 | + $str = preg_replace('/'.preg_quote($tmparray2[0]).'/', $tmparray2[1], $str); |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | $this->load("languages"); |
901 | 901 | |
902 | 902 | // We scan directory langs to detect available languages |
903 | - $handle = opendir($langdir . "/langs"); |
|
903 | + $handle = opendir($langdir."/langs"); |
|
904 | 904 | $langs_available = array(); |
905 | 905 | while ($dir = trim(readdir($handle))) { |
906 | 906 | $regs = array(); |
@@ -950,9 +950,9 @@ discard block |
||
950 | 950 | } |
951 | 951 | |
952 | 952 | if ($usecode == 1 || getDolGlobalString('MAIN_SHOW_LANGUAGE_CODE')) { |
953 | - $langs_available[$dir] = $dir . ': ' . dol_trunc($this->trans('Language_' . $dir), $maxlength); |
|
953 | + $langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir), $maxlength); |
|
954 | 954 | } else { |
955 | - $langs_available[$dir] = $this->trans('Language_' . $dir); |
|
955 | + $langs_available[$dir] = $this->trans('Language_'.$dir); |
|
956 | 956 | } |
957 | 957 | if ($mainlangonly) { |
958 | 958 | $langs_available[$dir] = str_replace(' (United States)', '', $langs_available[$dir]); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | // phpcs:enable |
977 | 977 | // Test si fichier dans repertoire de la langue |
978 | 978 | foreach ($this->dir as $searchdir) { |
979 | - if (is_readable(dol_osencode($searchdir . "/langs/" . $this->defaultlang . "/" . $filename))) { |
|
979 | + if (is_readable(dol_osencode($searchdir."/langs/".$this->defaultlang."/".$filename))) { |
|
980 | 980 | return true; |
981 | 981 | } |
982 | 982 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $filenamealt = null; |
985 | 985 | // Test si fichier dans repertoire de la langue alternative |
986 | 986 | if ($this->defaultlang != "en_US") { |
987 | - $filenamealt = $searchdir . "/langs/en_US/" . $filename; |
|
987 | + $filenamealt = $searchdir."/langs/en_US/".$filename; |
|
988 | 988 | } |
989 | 989 | //else $filenamealt = $searchdir."/langs/fr_FR/".$filename; |
990 | 990 | if ($filenamealt !== null && is_readable(dol_osencode($filenamealt))) { |
@@ -1025,8 +1025,8 @@ discard block |
||
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | $fonc = 'numberwords'; |
1028 | - if (file_exists($newdir . '/functions_' . $fonc . '.lib.php')) { |
|
1029 | - include_once $newdir . '/functions_' . $fonc . '.lib.php'; |
|
1028 | + if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) { |
|
1029 | + include_once $newdir.'/functions_'.$fonc.'.lib.php'; |
|
1030 | 1030 | if (function_exists('numberwords_getLabelFromNumber')) { |
1031 | 1031 | $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount); |
1032 | 1032 | break; |
@@ -1079,13 +1079,13 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | // Not found in loaded language file nor in cache. So we will take the label into database. |
1082 | - $sql = "SELECT " . $fieldlabel . " as label"; |
|
1083 | - $sql .= " FROM " . $db->prefix() . $tablename; |
|
1084 | - $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($keyforselect ? $keyforselect : $key) . "'"; |
|
1082 | + $sql = "SELECT ".$fieldlabel." as label"; |
|
1083 | + $sql .= " FROM ".$db->prefix().$tablename; |
|
1084 | + $sql .= " WHERE ".$fieldkey." = '".$db->escape($keyforselect ? $keyforselect : $key)."'"; |
|
1085 | 1085 | if ($filteronentity) { |
1086 | - $sql .= " AND entity IN (" . getEntity($tablename) . ')'; |
|
1086 | + $sql .= " AND entity IN (".getEntity($tablename).')'; |
|
1087 | 1087 | } |
1088 | - dol_syslog(get_class($this) . '::getLabelFromKey', LOG_DEBUG); |
|
1088 | + dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG); |
|
1089 | 1089 | $resql = $db->query($sql); |
1090 | 1090 | if ($resql) { |
1091 | 1091 | $obj = $db->fetch_object($resql); |
@@ -1118,9 +1118,9 @@ discard block |
||
1118 | 1118 | $symbol = $this->getCurrencySymbol($currency_code); |
1119 | 1119 | |
1120 | 1120 | if (in_array($currency_code, array('USD'))) { |
1121 | - return $symbol . $amount; |
|
1121 | + return $symbol.$amount; |
|
1122 | 1122 | } else { |
1123 | - return $amount . $symbol; |
|
1123 | + return $amount.$symbol; |
|
1124 | 1124 | } |
1125 | 1125 | } |
1126 | 1126 | |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | |
1142 | 1142 | if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code]['unicode']) && is_array($this->cache_currencies[$currency_code]['unicode'])) { // @phan-suppress-current-line PhanTypeMismatchProperty |
1143 | 1143 | foreach ($this->cache_currencies[$currency_code]['unicode'] as $unicode) { |
1144 | - $currency_sign .= mb_convert_encoding("&#" . $unicode . ";", "UTF-8", 'HTML-ENTITIES'); |
|
1144 | + $currency_sign .= mb_convert_encoding("&#".$unicode.";", "UTF-8", 'HTML-ENTITIES'); |
|
1145 | 1145 | } |
1146 | 1146 | } |
1147 | 1147 | } |
@@ -1167,14 +1167,14 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | $sql = "SELECT code_iso, label, unicode"; |
1170 | - $sql .= " FROM " . $db->prefix() . "c_currencies"; |
|
1170 | + $sql .= " FROM ".$db->prefix()."c_currencies"; |
|
1171 | 1171 | $sql .= " WHERE active = 1"; |
1172 | 1172 | if (!empty($currency_code)) { |
1173 | - $sql .= " AND code_iso = '" . $db->escape($currency_code) . "'"; |
|
1173 | + $sql .= " AND code_iso = '".$db->escape($currency_code)."'"; |
|
1174 | 1174 | } |
1175 | 1175 | //$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later |
1176 | 1176 | |
1177 | - dol_syslog(get_class($this) . '::loadCacheCurrencies', LOG_DEBUG); |
|
1177 | + dol_syslog(get_class($this).'::loadCacheCurrencies', LOG_DEBUG); |
|
1178 | 1178 | $resql = $db->query($sql); |
1179 | 1179 | if ($resql) { |
1180 | 1180 | $this->load("dict"); |
@@ -1191,8 +1191,8 @@ discard block |
||
1191 | 1191 | $obj = $db->fetch_object($resql); |
1192 | 1192 | if ($obj) { |
1193 | 1193 | // If a translation exists, we use it lese we use the default label |
1194 | - $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 : '')); |
|
1195 | - $this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode((empty($obj->unicode) ? '' : $obj->unicode), true); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1194 | + $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 : '')); |
|
1195 | + $this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode((empty($obj->unicode) ? '' : $obj->unicode), true); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1196 | 1196 | $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label']; |
1197 | 1197 | } |
1198 | 1198 | $i++; |
@@ -1225,8 +1225,8 @@ discard block |
||
1225 | 1225 | $substitutionarray = array(); |
1226 | 1226 | |
1227 | 1227 | foreach ($this->tab_translate as $code => $label) { |
1228 | - $substitutionarray['lang_' . $code] = $label; |
|
1229 | - $substitutionarray['__(' . $code . ')__'] = $label; |
|
1228 | + $substitutionarray['lang_'.$code] = $label; |
|
1229 | + $substitutionarray['__('.$code.')__'] = $label; |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | return $substitutionarray; |