Completed
Push — master ( bdbd8d...676d51 )
by cam
01:31
created
ecrire/inc/traduire.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	static $dirs = [];
42 42
 	$liste = [];
43 43
 	foreach (creer_chemin() as $dir) {
44
-		if (!isset($dirs[$a = $dir . $dirname])) {
44
+		if (!isset($dirs[$a = $dir.$dirname])) {
45 45
 			$dirs[$a] = (is_dir($a) || !$a);
46 46
 		}
47 47
 		if ($dirs[$a]) {
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
  **/
68 68
 function chercher_module_lang($module, $lang = '') {
69 69
 	if ($lang) {
70
-		$lang = '_' . $lang;
70
+		$lang = '_'.$lang;
71 71
 	}
72 72
 
73 73
 	// 1) dans un repertoire nomme lang/ se trouvant sur le chemin
74 74
 	if (
75 75
 		$f = ($module == 'local'
76
-		? find_in_path($module . $lang . '.php', 'lang/')
77
-		: find_langs_in_path($module . $lang . '.php', 'lang/'))
76
+		? find_in_path($module.$lang.'.php', 'lang/')
77
+		: find_langs_in_path($module.$lang.'.php', 'lang/'))
78 78
 	) {
79 79
 		return is_array($f) ? $f : [$f];
80 80
 	}
81 81
 
82 82
 	// 2) directement dans le chemin (old style, uniquement pour local)
83 83
 	return (($module == 'local') or strpos($module, '/'))
84
-		? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false)
84
+		? (($f = find_in_path($module.$lang.'.php')) ? [$f] : false)
85 85
 		: false;
86 86
 }
87 87
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  **/
106 106
 function charger_langue($lang, $module = 'spip') {
107 107
 	static $langs = [];
108
-	$var = 'i18n_' . $module . '_' . $lang;
108
+	$var = 'i18n_'.$module.'_'.$lang;
109 109
 	if (!isset($langs[$lang])) {
110 110
 		$langs[$lang] = [];
111 111
 		if ($lang) {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 	foreach ($langs[$lang] as $l) {
122 122
 		if ($fichiers_lang = chercher_module_lang($module, $l)) {
123
-			$GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l;
123
+			$GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l;
124 124
 			$GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang));
125 125
 			surcharger_langue($fichiers_lang);
126 126
 			if ($l !== $lang) {
127
-				$GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l];
127
+				$GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l];
128 128
 			}
129
-			$GLOBALS['lang_' . $var] = $l;
129
+			$GLOBALS['lang_'.$var] = $l;
130 130
 			#spip_log("module de langue : ${module}_$l.php", 'traduire');
131 131
 			break;
132 132
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function lire_fichier_langue(string $fichier): array {
146 146
 	$idx_lang_before = $GLOBALS['idx_lang'] ?? null;
147
-	$idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire';
147
+	$idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang').'@temporaire';
148 148
 	$GLOBALS['idx_lang'] = $idx_lang_tmp;
149 149
 	$idx_lang = include $fichier;
150 150
 	$GLOBALS['idx_lang'] = $idx_lang_before;
@@ -273,27 +273,27 @@  discard block
 block discarded – undo
273 273
 	} else {
274 274
 		$modules = ['spip', 'ecrire'];
275 275
 		$code = $ori;
276
-		$ori_complet = implode('|', $modules) . ':' . $ori;
276
+		$ori_complet = implode('|', $modules).':'.$ori;
277 277
 	}
278 278
 
279 279
 	$desc = new SPIP_Traductions_Description();
280 280
 
281 281
 	// parcourir tous les modules jusqu'a ce qu'on trouve
282 282
 	foreach ($modules as $module) {
283
-		$var = 'i18n_' . $module . '_' . $lang;
283
+		$var = 'i18n_'.$module.'_'.$lang;
284 284
 
285 285
 		if (empty($GLOBALS[$var])) {
286 286
 			charger_langue($lang, $module);
287 287
 			// surcharges persos -- on cherche
288 288
 			// (lang/)local_xx.php et/ou (lang/)local.php ...
289
-			if (!isset($local['local_' . $lang])) {
289
+			if (!isset($local['local_'.$lang])) {
290 290
 				// redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer)
291 291
 				$GLOBALS['idx_lang'] = $var;
292 292
 				// ... (lang/)local_xx.php
293
-				$local['local_' . $lang] = chercher_module_lang('local', $lang);
293
+				$local['local_'.$lang] = chercher_module_lang('local', $lang);
294 294
 			}
295
-			if ($local['local_' . $lang]) {
296
-				surcharger_langue($local['local_' . $lang]);
295
+			if ($local['local_'.$lang]) {
296
+				surcharger_langue($local['local_'.$lang]);
297 297
 			}
298 298
 			// ... puis (lang/)local.php
299 299
 			if (!isset($local['local'])) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		if (isset($GLOBALS[$var][$code])) {
308 308
 			$desc->code = $code;
309 309
 			$desc->module = $module;
310
-			$desc->langue = $GLOBALS['lang_' . $var];
310
+			$desc->langue = $GLOBALS['lang_'.$var];
311 311
 			$desc->texte = $GLOBALS[$var][$code];
312 312
 			break;
313 313
 		}
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 	if (!$desc->mode and $desc->texte) {
366 366
 		// ne pas modifier 2 fois l'affichage
367 367
 		$desc->mode = 'traduction';
368
-		$classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : '');
368
+		$classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : '');
369 369
 		$desc->texte = '<span '
370
-			. 'lang=' . $desc->langue
371
-			. ' class=' . $classe
372
-			. ' data-module=' . $desc->module
373
-			. ' data-code=' . $desc->code
374
-			. ' title=' . $modules . '(' . $desc->langue . ')>'
370
+			. 'lang='.$desc->langue
371
+			. ' class='.$classe
372
+			. ' data-module='.$desc->module
373
+			. ' data-code='.$desc->code
374
+			. ' title='.$modules.'('.$desc->langue.')>'
375 375
 			. $desc->texte
376 376
 			. '</span>';
377 377
 		$desc->texte = str_replace(
Please login to merge, or discard this patch.