Completed
Push — master ( 9be7c4...c05aff )
by cam
01:18
created
ecrire/bootstrap/inc/path.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @param null|array $add List of «plugins» directories to add
14 14
  */
15 15
 function spip_paths(
16
-	null|array $add = null,
16
+	null | array $add = null,
17 17
 ): AggregatorInterface {
18 18
 	static $paths = null;
19 19
 	static $last_dossier_squelettes = null;
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 		$paths = new GroupAggregator(Group::cases(), _ROOT_CWD);
25 25
 		$paths = $paths->with(Group::App, [
26 26
 			_DIR_RACINE,
27
-			_DIR_RACINE . 'squelettes-dist/',
28
-			_DIR_RACINE . 'prive/',
27
+			_DIR_RACINE.'squelettes-dist/',
28
+			_DIR_RACINE.'prive/',
29 29
 			_DIR_RESTREINT,
30 30
 		]);
31 31
 
32
-		if (@is_dir(_DIR_RACINE . 'squelettes')) {
33
-			$paths = $paths->with(Group::Templates, [_DIR_RACINE . 'squelettes']);
32
+		if (@is_dir(_DIR_RACINE.'squelettes')) {
33
+			$paths = $paths->with(Group::Templates, [_DIR_RACINE.'squelettes']);
34 34
 		}
35 35
 	}
36 36
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$ds = explode(':', $dossier_squelettes);
45 45
 			foreach ($ds as $key => $directory) {
46 46
 				if (!str_starts_with($directory, '/')) {
47
-					$ds[$key] = _DIR_RACINE . $directory;
47
+					$ds[$key] = _DIR_RACINE.$directory;
48 48
 				}
49 49
 			}
50 50
 			$paths = $paths->with(Group::ExtraTemplates, $ds);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return array
102 102
  *     Liste des chemins, par ordre de priorité.
103 103
  **/
104
-function _chemin(string|array|null $dir_path = null): array {
104
+function _chemin(string | array | null $dir_path = null): array {
105 105
 	if (is_array($dir_path) || (is_string($dir_path) && strlen($dir_path))) {
106 106
 		spip_paths(add: is_array($dir_path) ? $dir_path : explode(':', $dir_path));
107 107
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 function creer_chemin(): array {
118 118
 	$dirs = spip_paths()->getDirectories();
119 119
 	// canal historique: avec / sauf si ''
120
-	return array_map(fn ($dir) => $dir === '' ? $dir : $dir . DIRECTORY_SEPARATOR, $dirs);
120
+	return array_map(fn ($dir) => $dir === '' ? $dir : $dir.DIRECTORY_SEPARATOR, $dirs);
121 121
 }
122 122
 
123 123
 /**
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
164 164
 	if (
165 165
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m)
166
-		&& ($file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg')
166
+		&& ($file_svg_generique = substr($file, 0, -strlen($m[0])).'-xx.svg')
167 167
 		&& ($f = find_in_theme("$file_svg_generique"))
168 168
 	) {
169
-		if (($fsize = substr($f, 0, -6) . $m[1] . '.svg') && file_exists($fsize)) {
169
+		if (($fsize = substr($f, 0, -6).$m[1].'.svg') && file_exists($fsize)) {
170 170
 			return $themefiles["$subdir$file"] = $fsize;
171 171
 		}
172 172
 		else {
173
-			return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px';
173
+			return $themefiles["$subdir$file"] = "$f?".$m[1].'px';
174 174
 		}
175 175
 	}
176 176
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			return $themefiles["$subdir$file"] = $f;
181 181
 		}
182 182
 	}
183
-	spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme');
183
+	spip_log("$file introuvable dans le theme prive ".reset($themes), 'theme');
184 184
 
185 185
 	return $themefiles["$subdir$file"] = '';
186 186
 }
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
  *     - string : chemin du fichier trouvé
261 261
  *     - false : fichier introuvable
262 262
  **/
263
-function find_in_path(string $file, string $dirname = '', bool|string $include = false): ?string {
263
+function find_in_path(string $file, string $dirname = '', bool | string $include = false): ?string {
264 264
 
265 265
 	$loader = spip_paths_loader();
266 266
 
267 267
 	if ($dirname) {
268
-		$file = rtrim($dirname, '/') . '/' . $file;
268
+		$file = rtrim($dirname, '/').'/'.$file;
269 269
 	}
270 270
 
271 271
 	$path = $loader->get($file);
272 272
 	// find in path retourne des chemins relatif, si possible
273 273
 	if ($path !== null && str_starts_with($path, _ROOT_RACINE)) {
274
-		$path = _DIR_RACINE . substr($path, strlen(_ROOT_RACINE));
274
+		$path = _DIR_RACINE.substr($path, strlen(_ROOT_RACINE));
275 275
 	}
276 276
 
277 277
 	if ($include === false) {
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	// cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue
327 327
 	// on a pas encore inclus flock.php
328 328
 	if (!function_exists('preg_files')) {
329
-		include_once _ROOT_RESTREINT . 'inc/flock.php';
329
+		include_once _ROOT_RESTREINT.'inc/flock.php';
330 330
 	}
331 331
 
332 332
 	// Parcourir le chemin
333 333
 	foreach (creer_chemin() as $d) {
334
-		$f = $d . $dir;
334
+		$f = $d.$dir;
335 335
 		if (@is_dir($f)) {
336 336
 			$liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs);
337 337
 			foreach ($liste as $chemin) {
Please login to merge, or discard this patch.