Completed
Push — master ( 72a024...b38d7e )
by cam
01:50
created
ecrire/inc/utils.php 1 patch
Spacing   +123 added lines, -124 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	if (strlen($dossier) and substr($dossier, -1) != '/') {
54 54
 		$dossier .= '/';
55 55
 	}
56
-	$f = str_replace('/', '_', $dossier) . $nom;
56
+	$f = str_replace('/', '_', $dossier).$nom;
57 57
 
58 58
 	if (function_exists($f)) {
59 59
 		return $f;
60 60
 	}
61
-	if (function_exists($g = $f . '_dist')) {
61
+	if (function_exists($g = $f.'_dist')) {
62 62
 		return $g;
63 63
 	}
64 64
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	// passer en minuscules (cf les balises de formulaires)
80 80
 	// et inclure le fichier
81 81
 	if (
82
-		!$inc = include_spip($dossier . ($d = strtolower($nom)))
82
+		!$inc = include_spip($dossier.($d = strtolower($nom)))
83 83
 		// si le fichier truc/machin/nom.php n'existe pas,
84 84
 		// la fonction peut etre definie dans truc/machin.php qui regroupe plusieurs petites fonctions
85 85
 		and strlen(dirname($dossier)) and dirname($dossier) != '.'
@@ -98,19 +98,19 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	// Echec : message d'erreur
101
-	spip_log("fonction $nom ($f ou $g) indisponible" .
101
+	spip_log("fonction $nom ($f ou $g) indisponible".
102 102
 		($inc ? '' : " (fichier $d absent de $dossier)"));
103 103
 
104 104
 	include_spip('inc/minipres');
105 105
 	echo minipres(
106 106
 		_T('forum_titre_erreur'),
107 107
 		$inc ?
108
-			_T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($f) . '</code>'])
108
+			_T('fonction_introuvable', ['fonction' => '<code>'.spip_htmlentities($f).'</code>'])
109 109
 			. '<br />'
110
-			. _T('fonction_introuvable', ['fonction' => '<code>' . spip_htmlentities($g) . '</code>'])
110
+			. _T('fonction_introuvable', ['fonction' => '<code>'.spip_htmlentities($g).'</code>'])
111 111
 			:
112
-			_T('fichier_introuvable', ['fichier' => '<code>' . spip_htmlentities($d) . '</code>']),
113
-		['all_inline' => true,'status' => 404]
112
+			_T('fichier_introuvable', ['fichier' => '<code>'.spip_htmlentities($d).'</code>']),
113
+		['all_inline' => true, 'status' => 404]
114 114
 	);
115 115
 	exit;
116 116
 }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  *     - string : chemin du fichier trouvé
157 157
  **/
158 158
 function include_spip($f, $include = true) {
159
-	return find_in_path($f . '.php', '', $include);
159
+	return find_in_path($f.'.php', '', $include);
160 160
 }
161 161
 
162 162
 /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  *     - string : chemin du fichier trouvé
177 177
  **/
178 178
 function require_spip($f) {
179
-	return find_in_path($f . '.php', '', 'required');
179
+	return find_in_path($f.'.php', '', 'required');
180 180
 }
181 181
 
182 182
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		// donc il faut l'inclure "en globals"
194 194
 		if ($f = find_in_path('mes_fonctions.php')) {
195 195
 			global $dossier_squelettes;
196
-			include_once(_ROOT_CWD . $f);
196
+			include_once(_ROOT_CWD.$f);
197 197
 		}
198 198
 
199 199
 		if (@is_readable(_CACHE_PLUGINS_FCT)) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	}
299 299
 
300 300
 	// appliquer notre fonction si elle existe
301
-	$fonc = 'execute_pipeline_' . strtolower($action);
301
+	$fonc = 'execute_pipeline_'.strtolower($action);
302 302
 	if (function_exists($fonc)) {
303 303
 		$val = $fonc($val);
304 304
 	} // plantage ?
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 function spip_log($message = null, $name = null) {
364 364
 	static $pre = [];
365 365
 	static $log;
366
-	preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string)$name, $regs);
366
+	preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string) $name, $regs);
367 367
 	if (!isset($regs[1]) or !$logname = $regs[1]) {
368 368
 		$logname = null;
369 369
 	}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 		if (!is_string($message)) {
392 392
 			$message = print_r($message, true);
393 393
 		}
394
-		$log($pre[$niveau] . ' ' . $message, $logname);
394
+		$log($pre[$niveau].' '.$message, $logname);
395 395
 	}
396 396
 }
397 397
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		$a = './';
593 593
 	}
594 594
 
595
-	$regexp = ',^(' . str_replace('[]', '\[\]', $c) . '[[]?[]]?)(=.*)?$,';
595
+	$regexp = ',^('.str_replace('[]', '\[\]', $c).'[[]?[]]?)(=.*)?$,';
596 596
 	$ajouts = array_flip(explode('|', $c));
597 597
 	$u = is_array($v) ? $v : rawurlencode((string) $v);
598 598
 	$testv = (is_array($v) ? count($v) : strlen((string) $v));
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 			// Ajout. Pour une variable, remplacer au meme endroit,
620 620
 			// pour un tableau ce sera fait dans la prochaine boucle
621 621
 			elseif (substr($r[1], -2) != '[]') {
622
-				$url[$n] = $r[1] . '=' . $u;
622
+				$url[$n] = $r[1].'='.$u;
623 623
 				unset($ajouts[$r[1]]);
624 624
 			}
625 625
 			// Pour les tableaux on laisse tomber les valeurs de
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
 	} elseif ($testv) {
641 641
 		foreach ($ajouts as $k => $n) {
642 642
 			if (!is_array($v)) {
643
-				$url[] = $k . '=' . $u;
643
+				$url[] = $k.'='.$u;
644 644
 			} else {
645
-				$id = (substr($k, -2) == '[]') ? $k : ($k . '[]');
645
+				$id = (substr($k, -2) == '[]') ? $k : ($k.'[]');
646 646
 				foreach ($v as $w) {
647
-					$url[] = $id . '=' . (is_array($w) ? 'Array' : rawurlencode($w));
647
+					$url[] = $id.'='.(is_array($w) ? 'Array' : rawurlencode($w));
648 648
 				}
649 649
 			}
650 650
 		}
@@ -655,10 +655,10 @@  discard block
 block discarded – undo
655 655
 
656 656
 	// recomposer l'adresse
657 657
 	if ($url) {
658
-		$a .= '?' . join($sep, $url);
658
+		$a .= '?'.join($sep, $url);
659 659
 	}
660 660
 
661
-	return $a . $ancre;
661
+	return $a.$ancre;
662 662
 }
663 663
 
664 664
 /**
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 			translitteration($ancre)
691 691
 		);
692 692
 	}
693
-	return $url . (strlen($ancre) ? '#' . $ancre : '');
693
+	return $url.(strlen($ancre) ? '#'.$ancre : '');
694 694
 }
695 695
 
696 696
 /**
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
  * @return bool
807 807
  */
808 808
 function test_plugin_actif($plugin) {
809
-	return ($plugin and defined('_DIR_PLUGIN_' . strtoupper($plugin))) ? true : false;
809
+	return ($plugin and defined('_DIR_PLUGIN_'.strtoupper($plugin))) ? true : false;
810 810
 }
811 811
 
812 812
 /**
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 					$value = interdire_scripts($value, -1);
939 939
 				}
940 940
 				if (!empty($options['class'])) {
941
-					$value = "<span class='" . $options['class'] . "'>$value</span>";
941
+					$value = "<span class='".$options['class']."'>$value</span>";
942 942
 				}
943 943
 				$text = str_replace("@$name@", $value, $text);
944 944
 				unset($args[$name]);
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 		// Si des variables n'ont pas ete inserees, le signaler
948 948
 		// (chaines de langues pas a jour)
949 949
 		if ($args) {
950
-			spip_log("$f:  variables inutilisees " . join(', ', array_keys($args)), _LOG_DEBUG);
950
+			spip_log("$f:  variables inutilisees ".join(', ', array_keys($args)), _LOG_DEBUG);
951 951
 		}
952 952
 	}
953 953
 
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 function joli_repertoire($rep) {
972 972
 	$a = substr($rep, 0, 1);
973 973
 	if ($a <> '.' and $a <> '/') {
974
-		$rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS) . $rep;
974
+		$rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS).$rep;
975 975
 	}
976 976
 	$rep = preg_replace(',(^\.\.\/),', '', $rep);
977 977
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 			$p -= ($x * 1000);
1026 1026
 		}
1027 1027
 
1028
-		return $s . sprintf($s ? '%07.3f ms' : '%.3f ms', $p);
1028
+		return $s.sprintf($s ? '%07.3f ms' : '%.3f ms', $p);
1029 1029
 	}
1030 1030
 }
1031 1031
 
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 	if ($taches and count($taches) and !spip_connect()) {
1093 1093
 		return false;
1094 1094
 	}
1095
-	spip_log('cron !', 'jq' . _LOG_DEBUG);
1095
+	spip_log('cron !', 'jq'._LOG_DEBUG);
1096 1096
 	if ($genie = charger_fonction('genie', 'inc', true)) {
1097 1097
 		return $genie($taches);
1098 1098
 	}
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 	if ($queue_next_job_time == -1) {
1198 1198
 		if (!defined('_JQ_NEXT_JOB_TIME_FILENAME')) {
1199
-			define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP . 'job_queue_next.txt');
1199
+			define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP.'job_queue_next.txt');
1200 1200
 		}
1201 1201
 		// utiliser un cache memoire si dispo
1202 1202
 		if (function_exists('cache_get') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) {
@@ -1265,8 +1265,8 @@  discard block
 block discarded – undo
1265 1265
 		$src = '';
1266 1266
 	}
1267 1267
 	if ($script) {
1268
-		$script = ("/*<![CDATA[*/\n" .
1269
-			preg_replace(',</([^>]*)>,', '<\/\1>', $script) .
1268
+		$script = ("/*<![CDATA[*/\n".
1269
+			preg_replace(',</([^>]*)>,', '<\/\1>', $script).
1270 1270
 			'/*]]>*/');
1271 1271
 	}
1272 1272
 	if ($noscript) {
@@ -1352,13 +1352,13 @@  discard block
 block discarded – undo
1352 1352
 	if ($path_base == null) {
1353 1353
 		// Chemin standard depuis l'espace public
1354 1354
 		$path = defined('_SPIP_PATH') ? _SPIP_PATH :
1355
-			_DIR_RACINE . ':' .
1356
-			_DIR_RACINE . 'squelettes-dist/:' .
1357
-			_DIR_RACINE . 'prive/:' .
1355
+			_DIR_RACINE.':'.
1356
+			_DIR_RACINE.'squelettes-dist/:'.
1357
+			_DIR_RACINE.'prive/:'.
1358 1358
 			_DIR_RESTREINT;
1359 1359
 		// Ajouter squelettes/
1360
-		if (@is_dir(_DIR_RACINE . 'squelettes')) {
1361
-			$path = _DIR_RACINE . 'squelettes/:' . $path;
1360
+		if (@is_dir(_DIR_RACINE.'squelettes')) {
1361
+			$path = _DIR_RACINE.'squelettes/:'.$path;
1362 1362
 		}
1363 1363
 		foreach (explode(':', $path) as $dir) {
1364 1364
 			if (strlen($dir) and substr($dir, -1) != '/') {
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 		// Et le(s) dossier(s) des squelettes nommes
1371 1371
 		if (strlen($GLOBALS['dossier_squelettes'])) {
1372 1372
 			foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) {
1373
-				array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/');
1373
+				array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE).$d.'/');
1374 1374
 			}
1375 1375
 		}
1376 1376
 		$GLOBALS['path_sig'] = md5(serialize($path_full));
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 
1382 1382
 	if (is_array($dir_path) or strlen($dir_path)) {
1383 1383
 		$tete = '';
1384
-		if (reset($path_base) == _DIR_RACINE . 'squelettes/') {
1384
+		if (reset($path_base) == _DIR_RACINE.'squelettes/') {
1385 1385
 			$tete = array_shift($path_base);
1386 1386
 		}
1387 1387
 		$dirs = (is_array($dir_path) ? $dir_path : explode(':', $dir_path));
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 	// Et le(s) dossier(s) des squelettes nommes
1403 1403
 	if (strlen($GLOBALS['dossier_squelettes'])) {
1404 1404
 		foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) {
1405
-			array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE) . $d . '/');
1405
+			array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE).$d.'/');
1406 1406
 		}
1407 1407
 	}
1408 1408
 
@@ -1473,14 +1473,14 @@  discard block
 block discarded – undo
1473 1473
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
1474 1474
 	if (
1475 1475
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m)
1476
-		and $file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg'
1476
+		and $file_svg_generique = substr($file, 0, -strlen($m[0])).'-xx.svg'
1477 1477
 		and $f = find_in_theme("$file_svg_generique")
1478 1478
 	) {
1479
-		if ($fsize = substr($f, 0, -6) . $m[1] . '.svg' and file_exists($fsize)) {
1479
+		if ($fsize = substr($f, 0, -6).$m[1].'.svg' and file_exists($fsize)) {
1480 1480
 			return $themefiles["$subdir$file"] = $fsize;
1481 1481
 		}
1482 1482
 		else {
1483
-			return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px';
1483
+			return $themefiles["$subdir$file"] = "$f?".$m[1].'px';
1484 1484
 		}
1485 1485
 	}
1486 1486
 
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 			return $themefiles["$subdir$file"] = $f;
1491 1491
 		}
1492 1492
 	}
1493
-	spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme');
1493
+	spip_log("$file introuvable dans le theme prive ".reset($themes), 'theme');
1494 1494
 
1495 1495
 	return $themefiles["$subdir$file"] = '';
1496 1496
 }
@@ -1598,8 +1598,8 @@  discard block
 block discarded – undo
1598 1598
 			return false;
1599 1599
 		}
1600 1600
 		if ($include and !isset($inc[$dirname][$file])) {
1601
-			include_once _ROOT_CWD . $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
1602
-			$inc[$dirname][$file] = $inc[''][$dirname . $file] = true;
1601
+			include_once _ROOT_CWD.$GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
1602
+			$inc[$dirname][$file] = $inc[''][$dirname.$file] = true;
1603 1603
 		}
1604 1604
 
1605 1605
 		return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
@@ -1612,14 +1612,14 @@  discard block
 block discarded – undo
1612 1612
 	}
1613 1613
 
1614 1614
 	foreach (creer_chemin() as $dir) {
1615
-		if (!isset($dirs[$a = $dir . $dirname])) {
1616
-			$dirs[$a] = (is_dir(_ROOT_CWD . $a) || !$a);
1615
+		if (!isset($dirs[$a = $dir.$dirname])) {
1616
+			$dirs[$a] = (is_dir(_ROOT_CWD.$a) || !$a);
1617 1617
 		}
1618 1618
 		if ($dirs[$a]) {
1619
-			if (file_exists(_ROOT_CWD . ($a .= $file))) {
1619
+			if (file_exists(_ROOT_CWD.($a .= $file))) {
1620 1620
 				if ($include and !isset($inc[$dirname][$file])) {
1621
-					include_once _ROOT_CWD . $a;
1622
-					$inc[$dirname][$file] = $inc[''][$dirname . $file] = true;
1621
+					include_once _ROOT_CWD.$a;
1622
+					$inc[$dirname][$file] = $inc[''][$dirname.$file] = true;
1623 1623
 				}
1624 1624
 				if (!defined('_SAUVER_CHEMIN')) {
1625 1625
 					// si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 					define('_SAUVER_CHEMIN', true);
1630 1630
 				}
1631 1631
 
1632
-				return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = $a;
1632
+				return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname.$file] = $a;
1633 1633
 			}
1634 1634
 		}
1635 1635
 	}
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 		define('_SAUVER_CHEMIN', true);
1656 1656
 	}
1657 1657
 
1658
-	return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = false;
1658
+	return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname.$file] = false;
1659 1659
 }
1660 1660
 
1661 1661
 function clear_path_cache() {
@@ -1725,12 +1725,12 @@  discard block
 block discarded – undo
1725 1725
 	// cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue
1726 1726
 	// on a pas encore inclus flock.php
1727 1727
 	if (!function_exists('preg_files')) {
1728
-		include_once _ROOT_RESTREINT . 'inc/flock.php';
1728
+		include_once _ROOT_RESTREINT.'inc/flock.php';
1729 1729
 	}
1730 1730
 
1731 1731
 	// Parcourir le chemin
1732 1732
 	foreach (creer_chemin() as $d) {
1733
-		$f = $d . $dir;
1733
+		$f = $d.$dir;
1734 1734
 		if (@is_dir($f)) {
1735 1735
 			$liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs);
1736 1736
 			foreach ($liste as $chemin) {
@@ -1780,9 +1780,9 @@  discard block
 block discarded – undo
1780 1780
 	if ($type === 'defaut') {
1781 1781
 		$objet = objet_type($quoi);
1782 1782
 		if (
1783
-			$f = charger_fonction('generer_' . $objet . '_url', 'urls', true)
1783
+			$f = charger_fonction('generer_'.$objet.'_url', 'urls', true)
1784 1784
 			// deprecated
1785
-			or $f = charger_fonction('generer_url_' . $objet, 'urls', true)
1785
+			or $f = charger_fonction('generer_url_'.$objet, 'urls', true)
1786 1786
 		) {
1787 1787
 			return $f;
1788 1788
 		}
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
 	}
1796 1796
 
1797 1797
 	// inclure le module d'url
1798
-	include_spip('urls/' . $url_type);
1798
+	include_spip('urls/'.$url_type);
1799 1799
 
1800 1800
 	switch ($quoi) {
1801 1801
 		case 'page':
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 				return $f;
1827 1827
 			}
1828 1828
 			// sinon on se rabat sur les urls page si ce n'est pas un type demande explicitement
1829
-			if (!$type and $url_type !== 'page'){
1829
+			if (!$type and $url_type !== 'page') {
1830 1830
 				return charger_fonction_url($quoi, 'page');
1831 1831
 			}
1832 1832
 			return '';
@@ -1951,8 +1951,8 @@  discard block
 block discarded – undo
1951 1951
 	include_spip('base/connect_sql');
1952 1952
 	$id_type = id_table_objet($entite, $public);
1953 1953
 
1954
-	return _DIR_RACINE . get_spip_script('./')
1955
-	. '?' . _SPIP_PAGE . "=$entite&$id_type=$i&connect=$public"
1954
+	return _DIR_RACINE.get_spip_script('./')
1955
+	. '?'._SPIP_PAGE."=$entite&$id_type=$i&connect=$public"
1956 1956
 	. (!$args ? '' : "&$args")
1957 1957
 	. (!$ancre ? '' : "#$ancre");
1958 1958
 }
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
 				!empty($_SERVER['QUERY_STRING'])
2124 2124
 				and !strpos($_SERVER['REQUEST_URI'], '?')
2125 2125
 			) {
2126
-				$GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
2126
+				$GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
2127 2127
 			}
2128 2128
 		}
2129 2129
 	}
@@ -2158,9 +2158,9 @@  discard block
 block discarded – undo
2158 2158
 		array_shift($myself);
2159 2159
 		$myself = implode('/', $myself);
2160 2160
 	}
2161
-	$url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)) . '/';
2161
+	$url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)).'/';
2162 2162
 
2163
-	$url = $http . '://' . rtrim($host, '/') . '/' . ltrim($url, '/');
2163
+	$url = $http.'://'.rtrim($host, '/').'/'.ltrim($url, '/');
2164 2164
 
2165 2165
 	return $url;
2166 2166
 }
@@ -2198,16 +2198,16 @@  discard block
 block discarded – undo
2198 2198
  **/
2199 2199
 function generer_url_ecrire($script = '', $args = '', $no_entities = false, $rel = false) {
2200 2200
 	if (!$rel) {
2201
-		$rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT;
2201
+		$rel = url_de_base()._DIR_RESTREINT_ABS._SPIP_ECRIRE_SCRIPT;
2202 2202
 	} else {
2203 2203
 		if (!is_string($rel)) {
2204
-			$rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT;
2204
+			$rel = _DIR_RESTREINT ?: './'._SPIP_ECRIRE_SCRIPT;
2205 2205
 		}
2206 2206
 	}
2207 2207
 
2208 2208
 	[$script, $ancre] = array_pad(explode('#', $script), 2, null);
2209 2209
 	if ($script and ($script <> 'accueil' or $rel)) {
2210
-		$args = "?exec=$script" . (!$args ? '' : "&$args");
2210
+		$args = "?exec=$script".(!$args ? '' : "&$args");
2211 2211
 	} elseif ($args) {
2212 2212
 		$args = "?$args";
2213 2213
 	}
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
 		$args .= "#$ancre";
2216 2216
 	}
2217 2217
 
2218
-	return $rel . ($no_entities ? $args : str_replace('&', '&amp;', $args));
2218
+	return $rel.($no_entities ? $args : str_replace('&', '&amp;', $args));
2219 2219
 }
2220 2220
 
2221 2221
 //
@@ -2297,10 +2297,10 @@  discard block
 block discarded – undo
2297 2297
 			$action = parametre_url($action, _SPIP_PAGE, $script, '&');
2298 2298
 		}
2299 2299
 		if ($args) {
2300
-			$action .= (strpos($action, '?') !== false ? '&' : '?') . $args;
2300
+			$action .= (strpos($action, '?') !== false ? '&' : '?').$args;
2301 2301
 		}
2302 2302
 		// ne pas generer une url avec /./?page= en cas d'url absolue et de _SPIP_SCRIPT vide
2303
-		$url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/') . preg_replace(',^/[.]/,', '/', "/$action"));
2303
+		$url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/').preg_replace(',^/[.]/,', '/', "/$action"));
2304 2304
 	}
2305 2305
 
2306 2306
 	if (!$no_entities) {
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 
2313 2313
 function generer_url_prive($script, $args = '', $no_entities = false) {
2314 2314
 
2315
-	return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS . 'prive.php');
2315
+	return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS.'prive.php');
2316 2316
 }
2317 2317
 
2318 2318
 // Pour les formulaires en methode POST,
@@ -2347,8 +2347,7 @@  discard block
 block discarded – undo
2347 2347
 	. "><div>\n"
2348 2348
 	. "<input type='hidden' name='exec' value='$script1' />"
2349 2349
 	. $corps
2350
-	. (!$submit ? '' :
2351
-		("<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><input class='fondo submit btn' type='submit' value=\"" . entites_html($submit) . '" /></div>'))
2350
+	. (!$submit ? '' : ("<div style='text-align: ".$GLOBALS['spip_lang_right']."'><input class='fondo submit btn' type='submit' value=\"".entites_html($submit).'" /></div>'))
2352 2351
 	. "</div></form>\n";
2353 2352
 }
2354 2353
 
@@ -2373,14 +2372,14 @@  discard block
 block discarded – undo
2373 2372
 		? generer_url_ecrire(_request('exec'))
2374 2373
 		: generer_url_public();
2375 2374
 
2376
-	return "\n<form action='" .
2377
-	$h .
2378
-	"'" .
2379
-	$atts .
2380
-	">\n" .
2381
-	'<div>' .
2382
-	"\n<input type='hidden' name='action' value='$script' />" .
2383
-	$corps .
2375
+	return "\n<form action='".
2376
+	$h.
2377
+	"'".
2378
+	$atts.
2379
+	">\n".
2380
+	'<div>'.
2381
+	"\n<input type='hidden' name='action' value='$script' />".
2382
+	$corps.
2384 2383
 	'</div></form>';
2385 2384
 }
2386 2385
 
@@ -2408,7 +2407,7 @@  discard block
 block discarded – undo
2408 2407
 		: generer_url_public('', '', false, false);
2409 2408
 	$url = parametre_url($url, 'action', $script);
2410 2409
 	if ($args) {
2411
-		$url .= quote_amp('&' . $args);
2410
+		$url .= quote_amp('&'.$args);
2412 2411
 	}
2413 2412
 
2414 2413
 	if ($no_entities) {
@@ -2442,9 +2441,9 @@  discard block
 block discarded – undo
2442 2441
 	}
2443 2442
 	$url =
2444 2443
 		(($public ? _DIR_RACINE : _DIR_RESTREINT) ?: './')
2445
-	. $script . '/'
2444
+	. $script.'/'
2446 2445
 	. ($path ? trim($path, '/') : '')
2447
-	. ($args ? '?' . quote_amp($args) : '');
2446
+	. ($args ? '?'.quote_amp($args) : '');
2448 2447
 
2449 2448
 	if ($no_entities) {
2450 2449
 		$url = str_replace('&amp;', '&', $url);
@@ -2493,17 +2492,17 @@  discard block
 block discarded – undo
2493 2492
 
2494 2493
 	// le nom du repertoire plugins/ activables/desactivables
2495 2494
 	if (!defined('_DIR_PLUGINS')) {
2496
-		define('_DIR_PLUGINS', _DIR_RACINE . 'plugins/');
2495
+		define('_DIR_PLUGINS', _DIR_RACINE.'plugins/');
2497 2496
 	}
2498 2497
 
2499 2498
 	// le nom du repertoire des extensions/ permanentes du core, toujours actives
2500 2499
 	if (!defined('_DIR_PLUGINS_DIST')) {
2501
-		define('_DIR_PLUGINS_DIST', _DIR_RACINE . 'plugins-dist/');
2500
+		define('_DIR_PLUGINS_DIST', _DIR_RACINE.'plugins-dist/');
2502 2501
 	}
2503 2502
 
2504 2503
 	// le nom du repertoire des librairies
2505 2504
 	if (!defined('_DIR_LIB')) {
2506
-		define('_DIR_LIB', _DIR_RACINE . 'lib/');
2505
+		define('_DIR_LIB', _DIR_RACINE.'lib/');
2507 2506
 	}
2508 2507
 
2509 2508
 	if (!defined('_DIR_IMG')) {
@@ -2513,29 +2512,29 @@  discard block
 block discarded – undo
2513 2512
 		define('_DIR_LOGOS', $pa);
2514 2513
 	}
2515 2514
 	if (!defined('_DIR_IMG_ICONES')) {
2516
-		define('_DIR_IMG_ICONES', _DIR_LOGOS . 'icones/');
2515
+		define('_DIR_IMG_ICONES', _DIR_LOGOS.'icones/');
2517 2516
 	}
2518 2517
 
2519 2518
 	if (!defined('_DIR_DUMP')) {
2520
-		define('_DIR_DUMP', $ti . 'dump/');
2519
+		define('_DIR_DUMP', $ti.'dump/');
2521 2520
 	}
2522 2521
 	if (!defined('_DIR_SESSIONS')) {
2523
-		define('_DIR_SESSIONS', $ti . 'sessions/');
2522
+		define('_DIR_SESSIONS', $ti.'sessions/');
2524 2523
 	}
2525 2524
 	if (!defined('_DIR_TRANSFERT')) {
2526
-		define('_DIR_TRANSFERT', $ti . 'upload/');
2525
+		define('_DIR_TRANSFERT', $ti.'upload/');
2527 2526
 	}
2528 2527
 	if (!defined('_DIR_CACHE')) {
2529
-		define('_DIR_CACHE', $ti . 'cache/');
2528
+		define('_DIR_CACHE', $ti.'cache/');
2530 2529
 	}
2531 2530
 	if (!defined('_DIR_CACHE_XML')) {
2532
-		define('_DIR_CACHE_XML', _DIR_CACHE . 'xml/');
2531
+		define('_DIR_CACHE_XML', _DIR_CACHE.'xml/');
2533 2532
 	}
2534 2533
 	if (!defined('_DIR_SKELS')) {
2535
-		define('_DIR_SKELS', _DIR_CACHE . 'skel/');
2534
+		define('_DIR_SKELS', _DIR_CACHE.'skel/');
2536 2535
 	}
2537 2536
 	if (!defined('_DIR_AIDE')) {
2538
-		define('_DIR_AIDE', _DIR_CACHE . 'aide/');
2537
+		define('_DIR_AIDE', _DIR_CACHE.'aide/');
2539 2538
 	}
2540 2539
 	if (!defined('_DIR_TMP')) {
2541 2540
 		define('_DIR_TMP', $ti);
@@ -2564,27 +2563,27 @@  discard block
 block discarded – undo
2564 2563
 	// Declaration des fichiers
2565 2564
 
2566 2565
 	if (!defined('_CACHE_PLUGINS_PATH')) {
2567
-		define('_CACHE_PLUGINS_PATH', _DIR_CACHE . 'charger_plugins_chemins.php');
2566
+		define('_CACHE_PLUGINS_PATH', _DIR_CACHE.'charger_plugins_chemins.php');
2568 2567
 	}
2569 2568
 	if (!defined('_CACHE_PLUGINS_OPT')) {
2570
-		define('_CACHE_PLUGINS_OPT', _DIR_CACHE . 'charger_plugins_options.php');
2569
+		define('_CACHE_PLUGINS_OPT', _DIR_CACHE.'charger_plugins_options.php');
2571 2570
 	}
2572 2571
 	if (!defined('_CACHE_PLUGINS_FCT')) {
2573
-		define('_CACHE_PLUGINS_FCT', _DIR_CACHE . 'charger_plugins_fonctions.php');
2572
+		define('_CACHE_PLUGINS_FCT', _DIR_CACHE.'charger_plugins_fonctions.php');
2574 2573
 	}
2575 2574
 	if (!defined('_CACHE_PIPELINES')) {
2576
-		define('_CACHE_PIPELINES', _DIR_CACHE . 'charger_pipelines.php');
2575
+		define('_CACHE_PIPELINES', _DIR_CACHE.'charger_pipelines.php');
2577 2576
 	}
2578 2577
 	if (!defined('_CACHE_CHEMIN')) {
2579
-		define('_CACHE_CHEMIN', _DIR_CACHE . 'chemin.txt');
2578
+		define('_CACHE_CHEMIN', _DIR_CACHE.'chemin.txt');
2580 2579
 	}
2581 2580
 
2582 2581
 	# attention .php obligatoire pour ecrire_fichier_securise
2583 2582
 	if (!defined('_FILE_META')) {
2584
-		define('_FILE_META', $ti . 'meta_cache.php');
2583
+		define('_FILE_META', $ti.'meta_cache.php');
2585 2584
 	}
2586 2585
 	if (!defined('_DIR_LOG')) {
2587
-		define('_DIR_LOG', _DIR_TMP . 'log/');
2586
+		define('_DIR_LOG', _DIR_TMP.'log/');
2588 2587
 	}
2589 2588
 	if (!defined('_FILE_LOG')) {
2590 2589
 		define('_FILE_LOG', 'spip');
@@ -2601,8 +2600,8 @@  discard block
 block discarded – undo
2601 2600
 	if (!defined('_FILE_CONNECT')) {
2602 2601
 		define(
2603 2602
 			'_FILE_CONNECT',
2604
-			(@is_readable($f = _DIR_CONNECT . _FILE_CONNECT_INS . '.php') ? $f
2605
-			: (@is_readable($f = _DIR_RESTREINT . 'inc_connect.php') ? $f
2603
+			(@is_readable($f = _DIR_CONNECT._FILE_CONNECT_INS.'.php') ? $f
2604
+			: (@is_readable($f = _DIR_RESTREINT.'inc_connect.php') ? $f
2606 2605
 			: false))
2607 2606
 		);
2608 2607
 	}
@@ -2614,7 +2613,7 @@  discard block
 block discarded – undo
2614 2613
 	if (!defined('_FILE_CHMOD')) {
2615 2614
 		define(
2616 2615
 			'_FILE_CHMOD',
2617
-			(@is_readable($f = _DIR_CHMOD . _FILE_CHMOD_INS . '.php') ? $f
2616
+			(@is_readable($f = _DIR_CHMOD._FILE_CHMOD_INS.'.php') ? $f
2618 2617
 			: false)
2619 2618
 		);
2620 2619
 	}
@@ -2627,10 +2626,10 @@  discard block
 block discarded – undo
2627 2626
 		define('_FILE_TMP_SUFFIX', '.tmp.php');
2628 2627
 	}
2629 2628
 	if (!defined('_FILE_CONNECT_TMP')) {
2630
-		define('_FILE_CONNECT_TMP', _DIR_CONNECT . _FILE_CONNECT_INS . _FILE_TMP_SUFFIX);
2629
+		define('_FILE_CONNECT_TMP', _DIR_CONNECT._FILE_CONNECT_INS._FILE_TMP_SUFFIX);
2631 2630
 	}
2632 2631
 	if (!defined('_FILE_CHMOD_TMP')) {
2633
-		define('_FILE_CHMOD_TMP', _DIR_CHMOD . _FILE_CHMOD_INS . _FILE_TMP_SUFFIX);
2632
+		define('_FILE_CHMOD_TMP', _DIR_CHMOD._FILE_CHMOD_INS._FILE_TMP_SUFFIX);
2634 2633
 	}
2635 2634
 
2636 2635
 	// Definition des droits d'acces en ecriture
@@ -2648,13 +2647,13 @@  discard block
 block discarded – undo
2648 2647
 		define('_DEFAULT_CHARSET', 'utf-8');
2649 2648
 	}
2650 2649
 	if (!defined('_ROOT_PLUGINS')) {
2651
-		define('_ROOT_PLUGINS', _ROOT_RACINE . 'plugins/');
2650
+		define('_ROOT_PLUGINS', _ROOT_RACINE.'plugins/');
2652 2651
 	}
2653 2652
 	if (!defined('_ROOT_PLUGINS_DIST')) {
2654
-		define('_ROOT_PLUGINS_DIST', _ROOT_RACINE . 'plugins-dist/');
2653
+		define('_ROOT_PLUGINS_DIST', _ROOT_RACINE.'plugins-dist/');
2655 2654
 	}
2656 2655
 	if (!defined('_ROOT_PLUGINS_SUPPL') && defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) {
2657
-		define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE . str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL));
2656
+		define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE.str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL));
2658 2657
 	}
2659 2658
 
2660 2659
 	// La taille des Log
@@ -2691,7 +2690,7 @@  discard block
 block discarded – undo
2691 2690
 	// (non surchargeable en l'etat ; attention si on utilise include_spip()
2692 2691
 	// pour le rendre surchargeable, on va provoquer un reecriture
2693 2692
 	// systematique du noyau ou une baisse de perfs => a etudier)
2694
-	include_once _ROOT_RESTREINT . 'inc/flock.php';
2693
+	include_once _ROOT_RESTREINT.'inc/flock.php';
2695 2694
 
2696 2695
 	// charger tout de suite le path et son cache
2697 2696
 	load_path_cache();
@@ -2739,7 +2738,7 @@  discard block
 block discarded – undo
2739 2738
 			!empty($_SERVER['QUERY_STRING'])
2740 2739
 			and !strpos($_SERVER['REQUEST_URI'], '?')
2741 2740
 		) {
2742
-			$GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
2741
+			$GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
2743 2742
 		}
2744 2743
 	}
2745 2744
 
@@ -2775,7 +2774,7 @@  discard block
 block discarded – undo
2775 2774
 		) {
2776 2775
 			if (isset($GLOBALS['meta']['adresse_site'])) {
2777 2776
 				$uri_ref = parse_url($GLOBALS['meta']['adresse_site']);
2778
-				$uri_ref = ($uri_ref['path'] ?? '') . '/';
2777
+				$uri_ref = ($uri_ref['path'] ?? '').'/';
2779 2778
 			} else {
2780 2779
 				$uri_ref = '';
2781 2780
 			}
@@ -2869,7 +2868,7 @@  discard block
 block discarded – undo
2869 2868
 	}
2870 2869
 	if (!defined('_CACHE_RUBRIQUES')) {
2871 2870
 		/** Fichier cache pour le navigateur de rubrique du bandeau */
2872
-		define('_CACHE_RUBRIQUES', _DIR_TMP . 'menu-rubriques-cache.txt');
2871
+		define('_CACHE_RUBRIQUES', _DIR_TMP.'menu-rubriques-cache.txt');
2873 2872
 	}
2874 2873
 	if (!defined('_CACHE_RUBRIQUES_MAX')) {
2875 2874
 		/** Nombre maxi de rubriques enfants affichées pour chaque rubrique du navigateur de rubrique du bandeau */
@@ -3091,7 +3090,7 @@  discard block
 block discarded – undo
3091 3090
 					}
3092 3091
 					if (isset($GLOBALS['visiteur_session']['nom'])) {
3093 3092
 						spip_log($GLOBALS['visiteur_session']['nom']
3094
-							. ' ' . _VAR_MODE);
3093
+							. ' '._VAR_MODE);
3095 3094
 					}
3096 3095
 				} // pas autorise ?
3097 3096
 				else {
@@ -3106,7 +3105,7 @@  discard block
 block discarded – undo
3106 3105
 						if (strpos($self, 'page=login') === false) {
3107 3106
 							include_spip('inc/headers');
3108 3107
 							$redirect = parametre_url(self('&', true), 'var_mode', $_GET['var_mode'], '&');
3109
-							redirige_par_entete(generer_url_public('login', 'url=' . rawurlencode($redirect), true));
3108
+							redirige_par_entete(generer_url_public('login', 'url='.rawurlencode($redirect), true));
3110 3109
 						}
3111 3110
 					}
3112 3111
 					// sinon tant pis
@@ -3148,10 +3147,10 @@  discard block
 block discarded – undo
3148 3147
 	// mais on risque de perturber des plugins en initialisant trop tot
3149 3148
 	// certaines constantes
3150 3149
 	@spip_initialisation_core(
3151
-		(_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES),
3152
-		(_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES),
3153
-		(_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES),
3154
-		(_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES)
3150
+		(_DIR_RACINE._NOM_PERMANENTS_INACCESSIBLES),
3151
+		(_DIR_RACINE._NOM_PERMANENTS_ACCESSIBLES),
3152
+		(_DIR_RACINE._NOM_TEMPORAIRES_INACCESSIBLES),
3153
+		(_DIR_RACINE._NOM_TEMPORAIRES_ACCESSIBLES)
3155 3154
 	);
3156 3155
 
3157 3156
 	// Demarrer une session NON AUTHENTIFIEE si on donne son nom
@@ -3184,7 +3183,7 @@  discard block
 block discarded – undo
3184 3183
 	}
3185 3184
 
3186 3185
 	$h = (isset($_SERVER['PHP_AUTH_USER']) and !$GLOBALS['ignore_auth_http']);
3187
-	if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'] . '_session'])) {
3186
+	if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'].'_session'])) {
3188 3187
 		$session = charger_fonction('session', 'inc');
3189 3188
 		if ($session()) {
3190 3189
 			return $GLOBALS['visiteur_session']['statut'];
@@ -3264,7 +3263,7 @@  discard block
 block discarded – undo
3264 3263
 			'definir_session',
3265 3264
 			$GLOBALS['visiteur_session']
3266 3265
 				? serialize($GLOBALS['visiteur_session'])
3267
-				. '_' . @$_COOKIE['spip_session']
3266
+				. '_'.@$_COOKIE['spip_session']
3268 3267
 				: ''
3269 3268
 		);
3270 3269
 		$session = $s ? substr(md5($s), 0, 8) : '';
@@ -3420,11 +3419,11 @@  discard block
 block discarded – undo
3420 3419
 	$GLOBALS['_INC_PUBLIC']++;
3421 3420
 
3422 3421
 	// fix #4235
3423
-	$cache_utilise_session_appelant	= ($GLOBALS['cache_utilise_session'] ?? null);
3422
+	$cache_utilise_session_appelant = ($GLOBALS['cache_utilise_session'] ?? null);
3424 3423
 
3425 3424
 
3426 3425
 	foreach (is_array($fond) ? $fond : [$fond] as $f) {
3427
-		unset($GLOBALS['cache_utilise_session']);	// fix #4235
3426
+		unset($GLOBALS['cache_utilise_session']); // fix #4235
3428 3427
 
3429 3428
 		$page = evaluer_fond($f, $contexte, $connect);
3430 3429
 		if ($page === '') {
@@ -3509,7 +3508,7 @@  discard block
 block discarded – undo
3509 3508
  * @return array|string
3510 3509
  */
3511 3510
 function trouver_fond($nom, $dir = '', $pathinfo = false) {
3512
-	$f = find_in_path($nom . '.' . _EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/') . '/' : '');
3511
+	$f = find_in_path($nom.'.'._EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/').'/' : '');
3513 3512
 	if (!$pathinfo) {
3514 3513
 		return $f;
3515 3514
 	}
Please login to merge, or discard this patch.