Completed
Push — master ( 05618b...519300 )
by cam
01:10
created
ecrire/inc/queue.php 1 patch
Spacing   +38 added lines, -40 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	$md5args = md5($arguments);
71 71
 
72 72
 	// si pas de date programee, des que possible
73
-	$duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND ';
73
+	$duplicate_where = 'status='.intval(_JQ_SCHEDULED).' AND ';
74 74
 	if (!$time) {
75 75
 		$time = time();
76 76
 		$duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution
@@ -96,9 +96,8 @@  discard block
 block discarded – undo
96 96
 			'id_job',
97 97
 			'spip_jobs',
98 98
 			$duplicate_where =
99
-				$duplicate_where . 'fonction=' . sql_quote($function)
100
-				. (($no_duplicate === 'function_only') ? '' :
101
-			' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file))
99
+				$duplicate_where.'fonction='.sql_quote($function)
100
+				. (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file))
102 101
 		)
103 102
 	) {
104 103
 		return $id_job;
@@ -111,9 +110,9 @@  discard block
 block discarded – undo
111 110
 	if (
112 111
 		$no_duplicate
113 112
 		and
114
-		$id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where")
113
+		$id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<'.intval($id_job)." AND $duplicate_where")
115 114
 	) {
116
-		sql_delete('spip_jobs', 'id_job=' . intval($id_job));
115
+		sql_delete('spip_jobs', 'id_job='.intval($id_job));
117 116
 
118 117
 		return $id_prev;
119 118
 	}
@@ -125,9 +124,9 @@  discard block
 block discarded – undo
125 124
 	// ie cas d'un char non acceptables sur certains type de champs
126 125
 	// qui coupe la valeur
127 126
 	if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) {
128
-		$args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job));
127
+		$args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job));
129 128
 		if ($args !== $arguments) {
130
-			spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export(
129
+			spip_log('arguments job errones / longueur '.strlen($args).' vs '.strlen($arguments).' / valeur : '.var_export(
131 130
 				$arguments,
132 131
 				true
133 132
 			), 'queue');
@@ -157,7 +156,7 @@  discard block
 block discarded – undo
157 156
 function queue_purger() {
158 157
 	include_spip('base/abstract_sql');
159 158
 	sql_delete('spip_jobs');
160
-	sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')');
159
+	sql_delete('spip_jobs_liens', 'id_job NOT IN ('.sql_get_select('id_job', 'spip_jobs').')');
161 160
 	include_spip('inc/genie');
162 161
 	genie_queue_watch_dist();
163 162
 }
@@ -173,8 +172,8 @@  discard block
 block discarded – undo
173 172
 	include_spip('base/abstract_sql');
174 173
 
175 174
 	if (
176
-		$row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job))
177
-		and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job))
175
+		$row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job))
176
+		and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job))
178 177
 	) {
179 178
 		queue_unlink_job($id_job);
180 179
 		// est-ce une tache cron qu'il faut relancer ?
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
  *  resultat du sql_delete
225 224
  */
226 225
 function queue_unlink_job($id_job) {
227
-	return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job));
226
+	return sql_delete('spip_jobs_liens', 'id_job='.intval($id_job));
228 227
 }
229 228
 
230 229
 /**
@@ -240,7 +239,7 @@  discard block
 block discarded – undo
240 239
 	// deserialiser les arguments
241 240
 	$args = unserialize($row['args']);
242 241
 	if ($args === false) {
243
-		spip_log('arguments job errones ' . var_export($row, true), 'queue');
242
+		spip_log('arguments job errones '.var_export($row, true), 'queue');
244 243
 		$args = [];
245 244
 	}
246 245
 
@@ -257,15 +256,14 @@  discard block
 block discarded – undo
257 256
 	}
258 257
 
259 258
 	if (!function_exists($fonction)) {
260
-		spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue');
259
+		spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue');
261 260
 
262 261
 		return false;
263 262
 	}
264 263
 
265
-	spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue');
264
+	spip_log('queue ['.$row['id_job']."]: $fonction() start", 'queue');
266 265
 	switch (is_countable($args) ? count($args) : 0) {
267
-		case 0:
268
-			$res = $fonction();
266
+		case 0 : $res = $fonction();
269 267
 			break;
270 268
 		case 1:
271 269
 			$res = $fonction($args[0]);
@@ -312,7 +310,7 @@  discard block
 block discarded – undo
312 310
 			# plus lent mais completement generique
313 311
 			$res = $fonction(...$args);
314 312
 	}
315
-	spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue');
313
+	spip_log('queue ['.$row['id_job']."]: $fonction() end", 'queue');
316 314
 
317 315
 	return $res;
318 316
 }
@@ -343,14 +341,14 @@  discard block
 block discarded – undo
343 341
 function queue_schedule($force_jobs = null) {
344 342
 	$time = time();
345 343
 	if (defined('_DEBUG_BLOCK_QUEUE')) {
346
-		spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG);
344
+		spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq'._LOG_DEBUG);
347 345
 
348 346
 		return;
349 347
 	}
350 348
 
351 349
 	// rien a faire si le prochain job est encore dans le futur
352 350
 	if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) {
353
-		spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG);
351
+		spip_log('queue_sleep_time_to_next_job', 'jq'._LOG_DEBUG);
354 352
 
355 353
 		return;
356 354
 	}
@@ -371,7 +369,7 @@  discard block
 block discarded – undo
371 369
 	}
372 370
 	$end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE;
373 371
 
374
-	spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG);
372
+	spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG);
375 373
 
376 374
 	if (!defined('_JQ_MAX_JOBS_EXECUTE')) {
377 375
 		define('_JQ_MAX_JOBS_EXECUTE', 200);
@@ -385,19 +383,19 @@  discard block
 block discarded – undo
385 383
 	// lorsqu'un job cron n'a pas fini, sa priorite est descendue
386 384
 	// pour qu'il ne bloque pas les autres jobs en attente
387 385
 	if (is_array($force_jobs) and count($force_jobs)) {
388
-		$cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs);
386
+		$cond = 'status='.intval(_JQ_SCHEDULED).' AND '.sql_in('id_job', $force_jobs);
389 387
 	} else {
390 388
 		$now = date('Y-m-d H:i:s', $time);
391
-		$cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now);
389
+		$cond = 'status='.intval(_JQ_SCHEDULED).' AND date<='.sql_quote($now);
392 390
 	}
393 391
 
394 392
 	register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible
395
-	$res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1));
393
+	$res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1));
396 394
 	do {
397 395
 		if ($row = array_shift($res)) {
398 396
 			$nbj++;
399 397
 			// il faut un verrou, a base de sql_delete
400
-			if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) {
398
+			if (sql_delete('spip_jobs', 'id_job='.intval($row['id_job']).' AND status='.intval(_JQ_SCHEDULED))) {
401 399
 				#spip_log("JQ schedule job ".$nbj." OK",'jq');
402 400
 				// on reinsert dans la base aussitot avec un status=_JQ_PENDING
403 401
 				$row['status'] = _JQ_PENDING;
@@ -412,13 +410,13 @@  discard block
 block discarded – undo
412 410
 				queue_close_job($row, $time, $result);
413 411
 			}
414 412
 		}
415
-		spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG);
413
+		spip_log('JQ schedule job end time '.$time, 'jq'._LOG_DEBUG);
416 414
 	} while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time);
417
-	spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG);
415
+	spip_log('JQ schedule end time '.time(), 'jq'._LOG_DEBUG);
418 416
 
419 417
 	if ($row = array_shift($res)) {
420 418
 		queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP
421
-		spip_log('JQ encore !', 'jq' . _LOG_DEBUG);
419
+		spip_log('JQ encore !', 'jq'._LOG_DEBUG);
422 420
 	} else {
423 421
 		queue_update_next_job_time();
424 422
 	}
@@ -453,9 +451,9 @@  discard block
 block discarded – undo
453 451
 		}
454 452
 	}
455 453
 	// purger ses liens eventuels avec des objets
456
-	sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job']));
454
+	sql_delete('spip_jobs_liens', 'id_job='.intval($row['id_job']));
457 455
 	// supprimer le job fini
458
-	sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']));
456
+	sql_delete('spip_jobs', 'id_job='.intval($row['id_job']));
459 457
 }
460 458
 
461 459
 /**
@@ -528,18 +526,18 @@  discard block
 block discarded – undo
528 526
 	$res = sql_allfetsel(
529 527
 		'*',
530 528
 		'spip_jobs',
531
-		'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180))
529
+		'status='.intval(_JQ_PENDING).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time - 180))
532 530
 	);
533 531
 	if (is_array($res)) {
534 532
 		foreach ($res as $row) {
535 533
 			queue_close_job($row, $time);
536
-			spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR);
534
+			spip_log('queue_close_job car _JQ_PENDING depuis +180s : '.print_r($row, 1), 'job_mort'._LOG_ERREUR);
537 535
 		}
538 536
 	}
539 537
 
540 538
 	// chercher la date du prochain job si pas connu
541 539
 	if (is_null($next) or is_null(queue_sleep_time_to_next_job())) {
542
-		$date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1');
540
+		$date = sql_getfetsel('date', 'spip_jobs', 'status='.intval(_JQ_SCHEDULED), '', 'date', '0,1');
543 541
 		$next = strtotime($date);
544 542
 	}
545 543
 	if (!is_null($next_time)) {
@@ -552,7 +550,7 @@  discard block
 block discarded – undo
552 550
 		if (is_null($nb_jobs_scheduled)) {
553 551
 			$nb_jobs_scheduled = sql_countsel(
554 552
 				'spip_jobs',
555
-				'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time))
553
+				'status='.intval(_JQ_SCHEDULED).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time))
556 554
 			);
557 555
 		} elseif ($next <= $time) {
558 556
 			$nb_jobs_scheduled++;
@@ -621,7 +619,7 @@  discard block
 block discarded – undo
621 619
 	}
622 620
 
623 621
 	// ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent
624
-	if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) {
622
+	if (file_exists($lock = _DIR_TMP.'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) {
625 623
 		return $texte;
626 624
 	}
627 625
 
@@ -693,7 +691,7 @@  discard block
 block discarded – undo
693 691
 				$port = 80;
694 692
 		}
695 693
 		$fp = @fsockopen(
696
-			$scheme . $parts['host'],
694
+			$scheme.$parts['host'],
697 695
 			$parts['port'] ?? $port,
698 696
 			$errno,
699 697
 			$errstr,
@@ -703,13 +701,13 @@  discard block
 block discarded – undo
703 701
 		if ($fp) {
704 702
 			$host_sent = $parts['host'];
705 703
 			if (isset($parts['port']) and $parts['port'] !== $port) {
706
-				$host_sent .= ':' . $parts['port'];
704
+				$host_sent .= ':'.$parts['port'];
707 705
 			}
708 706
 			$timeout = 200; // ms
709 707
 			stream_set_timeout($fp, 0, $timeout * 1000);
710
-			$query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : '');
711
-			$out = 'GET ' . $query . " HTTP/1.1\r\n";
712
-			$out .= 'Host: ' . $host_sent . "\r\n";
708
+			$query = $parts['path'].($parts['query'] ? '?'.$parts['query'] : '');
709
+			$out = 'GET '.$query." HTTP/1.1\r\n";
710
+			$out .= 'Host: '.$host_sent."\r\n";
713 711
 			$out .= "Connection: Close\r\n\r\n";
714 712
 			fwrite($fp, $out);
715 713
 			spip_timer('read');
Please login to merge, or discard this patch.
ecrire/inc/exporter_csv.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	$champ = preg_replace(',[\s]+,ms', ' ', $champ);
39 39
 	$champ = str_replace('"', '""', $champ);
40 40
 
41
-	return '"' . $champ . '"';
41
+	return '"'.$champ.'"';
42 42
 }
43 43
 
44 44
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	if ($callback) {
59 59
 		$ligne = $callback($nb, $ligne, $delim, $importer_charset);
60 60
 	}
61
-	$output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n";
61
+	$output = join($delim, array_map('exporter_csv_champ', $ligne))."\r\n";
62 62
 	if ($importer_charset) {
63 63
 		$output = str_replace('’', '\'', $output);
64 64
 		$output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$fichier = 'php://output';
176 176
 	}
177 177
 	else {
178
-	$fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename;
178
+	$fichier = sous_repertoire(_DIR_CACHE, 'export').$filename;
179 179
 	}
180 180
 
181 181
 	$fp = fopen($fichier, 'w');
Please login to merge, or discard this patch.
ecrire/inc/filtres.php 1 patch
Spacing   +134 added lines, -135 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	include_fichiers_fonctions();
99
-	foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) {
99
+	foreach (['filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc] as $f) {
100 100
 		trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels
101 101
 		// fonction ou name\space\fonction
102 102
 		if (is_callable($f)) {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	// affichage "GIT [master: abcdef]"
240 240
 	$commit = $desc['commit_short'] ?? $desc['commit'];
241 241
 	if ($desc['branch']) {
242
-		$commit = $desc['branch'] . ': ' . $commit;
242
+		$commit = $desc['branch'].': '.$commit;
243 243
 	}
244 244
 	return "{$desc['vcs']} [$commit]";
245 245
 }
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	// version installee par GIT
261
-	if (lire_fichier($dir . '/.git/HEAD', $c)) {
261
+	if (lire_fichier($dir.'/.git/HEAD', $c)) {
262 262
 		$currentHead = trim(substr($c, 4));
263
-		if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) {
263
+		if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) {
264 264
 			return [
265 265
 				'vcs' => 'GIT',
266 266
 				'branch' => basename($currentHead),
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 		$dir = '.';
288 288
 	}
289 289
 	// version installee par SVN
290
-	if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) {
291
-		$db = new SQLite3($dir . '/.svn/wc.db');
290
+	if (file_exists($dir.'/.svn/wc.db') && class_exists(\SQLite3::class)) {
291
+		$db = new SQLite3($dir.'/.svn/wc.db');
292 292
 		$result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1');
293 293
 		if ($result) {
294 294
 			$row = $result->fetchArray();
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 
307 307
 // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images
308 308
 // et laisser passer les fonctions personnelles baptisees image_...
309
-$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php';
310
-$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php';
311
-$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php';
312
-$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php';
313
-$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php';
314
-$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php';
309
+$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php';
310
+$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php';
311
+$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php';
312
+$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php';
313
+$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php';
314
+$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php';
315 315
 
316 316
 $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php';
317 317
 $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php';
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
  */
471 471
 function filtre_debug($val, $key = null) {
472 472
 	$debug = (
473
-		is_null($key) ? '' : (var_export($key, true) . ' = ')
474
-		) . var_export($val, true);
473
+		is_null($key) ? '' : (var_export($key, true).' = ')
474
+		).var_export($val, true);
475 475
 
476 476
 	include_spip('inc/autoriser');
477 477
 	if (autoriser('webmestre')) {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		$is_file = false;
526 526
 	}
527 527
 	if ($is_file) {
528
-		$is_local_file = function ($path) {
528
+		$is_local_file = function($path) {
529 529
 			if (strpos($path, '?') !== false) {
530 530
 				$path = supprimer_timestamp($path);
531 531
 				// remove ?24px added by find_in_theme on .svg files
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 						if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) {
578 578
 							$srcover = $match[1];
579 579
 							array_shift($args);
580
-							array_unshift($args, "<img src='" . $match[1] . "' />");
580
+							array_unshift($args, "<img src='".$match[1]."' />");
581 581
 							$srcover_filter = $filtre(...$args);
582 582
 							$srcover_filter = extraire_attribut($srcover_filter, 'src');
583 583
 							$reduit = str_replace($srcover, $srcover_filter, $reduit);
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			if (!$srcHeight) {
654 654
 				$hauteur_img[$src] = $srcHeight = $imagesize[1];
655 655
 			}
656
-			if (!$srcSize){
656
+			if (!$srcSize) {
657 657
 				$poids_img[$src] = filesize($src);
658 658
 			}
659 659
 		}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 				if (!$srcHeight) {
668 668
 					$hauteur_img[$src] = $srcHeight = $height;
669 669
 				}
670
-				if (!$srcSize){
670
+				if (!$srcSize) {
671 671
 					$poids_img[$src] = $srcSize = strlen($src);
672 672
 				}
673 673
 			}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 			if (!$srcHeight) {
686 686
 				$hauteur_img[$src] = $srcHeight = $valeurs['hauteur_dest'];
687 687
 			}
688
-			if (!$srcSize){
688
+			if (!$srcSize) {
689 689
 				$poids_img[$src] = $srcSize = 0;
690 690
 			}
691 691
 		}
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	return $infos['poids'];
712 712
 }
713 713
 
714
-function taille_image($img, $force_refresh = false){
714
+function taille_image($img, $force_refresh = false) {
715 715
 	$infos = infos_image($img, $force_refresh);
716 716
 	return [$infos['hauteur'], $infos['largeur']];
717 717
 }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	// " -> &quot; et tout ce genre de choses
981 981
 	$u = $GLOBALS['meta']['pcre_u'];
982 982
 	$texte = str_replace('&nbsp;', ' ', $texte);
983
-	$texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte);
983
+	$texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte);
984 984
 	// ne pas echapper les sinqle quotes car certains outils de syndication gerent mal
985 985
 	$texte = entites_html($texte, false, false);
986 986
 	// mais bien echapper les double quotes !
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
  **/
1041 1041
 function supprimer_numero($texte) {
1042 1042
 	return preg_replace(
1043
-		',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1043
+		',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S',
1044 1044
 		'',
1045 1045
 		$texte
1046 1046
 	);
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 function recuperer_numero($texte) {
1069 1069
 	if (
1070 1070
 		preg_match(
1071
-			',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1071
+			',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S',
1072 1072
 			$texte,
1073 1073
 			$regs
1074 1074
 		)
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
  **/
1160 1160
 function textebrut($texte) {
1161 1161
 	$u = $GLOBALS['meta']['pcre_u'];
1162
-	$texte = preg_replace('/\s+/S' . $u, ' ', $texte);
1163
-	$texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte);
1162
+	$texte = preg_replace('/\s+/S'.$u, ' ', $texte);
1163
+	$texte = preg_replace('/<(p|br)( [^>]*)?'.'>/iS', "\n\n", $texte);
1164 1164
 	$texte = preg_replace("/^\n+/", '', $texte);
1165 1165
 	$texte = preg_replace("/\n+$/", '', $texte);
1166 1166
 	$texte = preg_replace("/\n +/", "\n", $texte);
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		)
1195 1195
 	) {
1196 1196
 		foreach ($liens[0] as $a) {
1197
-			$rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel');
1197
+			$rel = 'noopener noreferrer '.extraire_attribut($a, 'rel');
1198 1198
 			$ablank = inserer_attribut($a, 'rel', $rel);
1199 1199
 			$ablank = inserer_attribut($ablank, 'target', '_blank');
1200 1200
 			$texte = str_replace($a, $ablank, $texte);
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 		foreach ($regs[0] as $a) {
1220 1220
 			$rel = extraire_attribut($a, 'rel') ?? '';
1221 1221
 			if (strpos($rel, 'nofollow') === false) {
1222
-				$rel = 'nofollow' . ($rel ? " $rel" : '');
1222
+				$rel = 'nofollow'.($rel ? " $rel" : '');
1223 1223
 				$anofollow = inserer_attribut($a, 'rel', $rel);
1224 1224
 				$texte = str_replace($a, $anofollow, $texte);
1225 1225
 			}
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 	$u = $GLOBALS['meta']['pcre_u'];
1249 1249
 	$texte = preg_replace('@</p>@iS', "\n", $texte);
1250 1250
 	$texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte);
1251
-	$texte = preg_replace('@^\s*<br />@S' . $u, '', $texte);
1251
+	$texte = preg_replace('@^\s*<br />@S'.$u, '', $texte);
1252 1252
 
1253 1253
 	return $texte;
1254 1254
 }
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 		return $texte;
1280 1280
 	}
1281 1281
 	include_spip('inc/texte');
1282
-	$tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ?
1282
+	$tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ?
1283 1283
 		'div' : 'span';
1284 1284
 
1285 1285
 	return "<$tag style='word-wrap:break-word;'>$texte</$tag>";
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 	}
1392 1392
 	$u = $GLOBALS['meta']['pcre_u'];
1393 1393
 	if ($textebrut) {
1394
-		$texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte));
1394
+		$texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte));
1395 1395
 	}
1396 1396
 	$texte = texte_backend($texte);
1397 1397
 	$texte = str_replace(["'", '"'], ['&#039;', '&#034;'], $texte);
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 	# un message pour abs_url
1427 1427
 	$GLOBALS['mode_abs_url'] = 'url';
1428 1428
 	$url = trim($url);
1429
-	$r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS';
1429
+	$r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS';
1430 1430
 
1431 1431
 	return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url);
1432 1432
 }
@@ -1626,14 +1626,14 @@  discard block
 block discarded – undo
1626 1626
 	if (strpos($texte, '<') !== false) {
1627 1627
 		include_spip('inc/lien');
1628 1628
 		if (defined('_PREG_MODELE')) {
1629
-			$preg_modeles = '@' . _PREG_MODELE . '@imsS';
1629
+			$preg_modeles = '@'._PREG_MODELE.'@imsS';
1630 1630
 			$texte = echappe_html($texte, '', true, $preg_modeles);
1631 1631
 		}
1632 1632
 	}
1633 1633
 
1634 1634
 	$debut = '';
1635 1635
 	$suite = $texte;
1636
-	while ($t = strpos('-' . $suite, "\n", 1)) {
1636
+	while ($t = strpos('-'.$suite, "\n", 1)) {
1637 1637
 		$debut .= substr($suite, 0, $t - 1);
1638 1638
 		$suite = substr($suite, $t);
1639 1639
 		$car = substr($suite, 0, 1);
@@ -1651,11 +1651,11 @@  discard block
 block discarded – undo
1651 1651
 			$suite = substr($suite, strlen($regs[0]));
1652 1652
 		}
1653 1653
 	}
1654
-	$texte = $debut . $suite;
1654
+	$texte = $debut.$suite;
1655 1655
 
1656 1656
 	$texte = echappe_retour($texte);
1657 1657
 
1658
-	return $texte . $fin;
1658
+	return $texte.$fin;
1659 1659
 }
1660 1660
 
1661 1661
 
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 		}
1718 1718
 
1719 1719
 		foreach ($regs as $reg) {
1720
-			$cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2];
1720
+			$cle = ($reg[1] ? $reg[1].':' : '').$reg[2];
1721 1721
 			$desc = $traduire($cle, $lang, true);
1722 1722
 			$l = $desc->langue;
1723 1723
 			// si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte.
@@ -1831,9 +1831,9 @@  discard block
 block discarded – undo
1831 1831
 					// il ne faut pas echapper en div si propre produit un seul paragraphe
1832 1832
 					include_spip('inc/texte');
1833 1833
 					$trad_propre = preg_replace(',(^<p[^>]*>|</p>$),Uims', '', propre($trad));
1834
-					$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1834
+					$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1835 1835
 					if ($mode === 'div') {
1836
-						$trad = rtrim($trad) . "\n\n";
1836
+						$trad = rtrim($trad)."\n\n";
1837 1837
 					}
1838 1838
 					$trad = code_echappement($trad, 'multi', false, $mode);
1839 1839
 					$trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 	}
2002 2002
 
2003 2003
 	// un index compris entre 0 et num exclus
2004
-	$i = ((intval($i) -1) % $num); // dans ]-$num;$num[
2004
+	$i = ((intval($i) - 1) % $num); // dans ]-$num;$num[
2005 2005
 	$i = ($i + $num) % $num; // dans [0;$num[
2006 2006
 	// renvoyer le i-ieme argument, modulo le nombre d'arguments
2007 2007
 	return $args[$i];
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
 	if (is_array($balise)) {
2034 2034
 		array_walk(
2035 2035
 			$balise,
2036
-			function (&$a, $key, $t) {
2036
+			function(&$a, $key, $t) {
2037 2037
 				$a = extraire_attribut($a, $t);
2038 2038
 			},
2039 2039
 			$attribut
@@ -2130,14 +2130,14 @@  discard block
 block discarded – undo
2130 2130
 
2131 2131
 	if ($old !== null) {
2132 2132
 		// Remplacer l'ancien attribut du meme nom
2133
-		$balise = $r[1] . $insert . $r[5];
2133
+		$balise = $r[1].$insert.$r[5];
2134 2134
 	} else {
2135 2135
 		// preferer une balise " />" (comme <img />)
2136 2136
 		if (preg_match(',/>,', $balise)) {
2137
-			$balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1);
2137
+			$balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1);
2138 2138
 		} // sinon une balise <a ...> ... </a>
2139 2139
 		else {
2140
-			$balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1);
2140
+			$balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1);
2141 2141
 		}
2142 2142
 	}
2143 2143
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		if (
2193 2193
 			$class_courante
2194 2194
 			and strpos($class_courante, (string) $c) !== false
2195
-			and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante)
2195
+			and preg_match('/(^|\s)'.preg_quote($c).'($|\s)/', $class_courante)
2196 2196
 		) {
2197 2197
 			$is_class_presente = true;
2198 2198
 		}
@@ -2200,12 +2200,12 @@  discard block
 block discarded – undo
2200 2200
 			in_array($operation, ['ajouter', 'commuter'])
2201 2201
 			and !$is_class_presente
2202 2202
 		) {
2203
-			$class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c);
2203
+			$class_new = ltrim(rtrim($class_new ?? '').' '.$c);
2204 2204
 		} elseif (
2205 2205
 			in_array($operation, ['supprimer', 'commuter'])
2206 2206
 			and $is_class_presente
2207 2207
 		) {
2208
-			$class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new));
2208
+			$class_new = trim(preg_replace('/(^|\s)'.preg_quote($c).'($|\s)/', "\\1", $class_new));
2209 2209
 		}
2210 2210
 	}
2211 2211
 
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
 // Quelques fonctions de calcul arithmetique
2269 2269
 //
2270 2270
 function floatstr($a) {
2271
- return str_replace(',', '.', (string)floatval($a));
2271
+ return str_replace(',', '.', (string) floatval($a));
2272 2272
 }
2273 2273
 function strize($f, $a, $b) {
2274 2274
  return floatstr($f(floatstr($a), floatstr($b)));
@@ -2404,13 +2404,13 @@  discard block
 block discarded – undo
2404 2404
 	if (!defined('_TAGS_NOM_AUTEUR')) {
2405 2405
 		define('_TAGS_NOM_AUTEUR', '');
2406 2406
 	}
2407
-	$tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR));
2407
+	$tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR));
2408 2408
 	foreach ($tags_acceptes as $tag) {
2409 2409
 		if (strlen($tag)) {
2410
-			$remp1[] = '<' . trim($tag) . '>';
2411
-			$remp1[] = '</' . trim($tag) . '>';
2412
-			$remp2[] = '\x60' . trim($tag) . '\x61';
2413
-			$remp2[] = '\x60/' . trim($tag) . '\x61';
2410
+			$remp1[] = '<'.trim($tag).'>';
2411
+			$remp1[] = '</'.trim($tag).'>';
2412
+			$remp2[] = '\x60'.trim($tag).'\x61';
2413
+			$remp2[] = '\x60/'.trim($tag).'\x61';
2414 2414
 		}
2415 2415
 	}
2416 2416
 	$v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom)));
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
 				. http_img_pack(
2465 2465
 					'attachment-16.png',
2466 2466
 					$t,
2467
-					'title="' . attribut_html($t) . '"'
2467
+					'title="'.attribut_html($t).'"'
2468 2468
 				)
2469 2469
 				. '</a>',
2470 2470
 				$tag
@@ -2528,10 +2528,10 @@  discard block
 block discarded – undo
2528 2528
 	$fichier = basename($url);
2529 2529
 
2530 2530
 	return '<a rel="enclosure"'
2531
-	. ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '')
2532
-	. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2533
-	. ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '')
2534
-	. '>' . $fichier . '</a>';
2531
+	. ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '')
2532
+	. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2533
+	. ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '')
2534
+	. '>'.$fichier.'</a>';
2535 2535
 }
2536 2536
 
2537 2537
 /**
@@ -2559,9 +2559,9 @@  discard block
 block discarded – undo
2559 2559
 			} # vieux data
2560 2560
 			$fichier = basename($url);
2561 2561
 			$enclosures[] = '<enclosure'
2562
-				. ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '')
2563
-				. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2564
-				. ($length ? ' length="' . $length . '"' : '')
2562
+				. ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '')
2563
+				. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2564
+				. ($length ? ' length="'.$length.'"' : '')
2565 2565
 				. ' />';
2566 2566
 		}
2567 2567
 	}
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
 		if (extraire_attribut($e, 'rel') == 'tag') {
2588 2588
 			$subjects .= '<dc:subject>'
2589 2589
 				. texte_backend(textebrut($e))
2590
-				. '</dc:subject>' . "\n";
2590
+				. '</dc:subject>'."\n";
2591 2591
 		}
2592 2592
 	}
2593 2593
 
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 	if (is_array($texte)) {
2624 2624
 		array_walk(
2625 2625
 			$texte,
2626
-			function (&$a, $key, $t) {
2626
+			function(&$a, $key, $t) {
2627 2627
 				$a = extraire_balise($a, $t);
2628 2628
 			},
2629 2629
 			$tag
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 	if (is_array($texte)) {
2672 2672
 		array_walk(
2673 2673
 			$texte,
2674
-			function (&$a, $key, $t) {
2674
+			function(&$a, $key, $t) {
2675 2675
 				$a = extraire_balises($a, $t);
2676 2676
 			},
2677 2677
 			$tag
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
 		if ($fond != '404') {
2805 2805
 			$contexte = array_shift($p);
2806 2806
 			$contexte['page'] = $fond;
2807
-			$action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action);
2807
+			$action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action);
2808 2808
 		}
2809 2809
 	}
2810 2810
 	// defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url
@@ -2859,9 +2859,9 @@  discard block
 block discarded – undo
2859 2859
 			. '"'
2860 2860
 			. (is_null($val)
2861 2861
 				? ''
2862
-				: ' value="' . entites_html($val) . '"'
2862
+				: ' value="'.entites_html($val).'"'
2863 2863
 			)
2864
-			. ' type="hidden"' . "\n/>";
2864
+			. ' type="hidden"'."\n/>";
2865 2865
 	}
2866 2866
 
2867 2867
 	return join('', $hidden);
@@ -2971,7 +2971,7 @@  discard block
 block discarded – undo
2971 2971
 
2972 2972
 	return preg_replace_callback(
2973 2973
 		",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
2974
-		fn($x) => "url('" . suivre_lien($path, $x[1]) . "')",
2974
+		fn($x) => "url('".suivre_lien($path, $x[1])."')",
2975 2975
 		$contenu
2976 2976
 	);
2977 2977
 }
@@ -3032,14 +3032,14 @@  discard block
 block discarded – undo
3032 3032
 	) {
3033 3033
 		$distant = true;
3034 3034
 		$cssf = parse_url($css);
3035
-		$cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : '');
3035
+		$cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : '');
3036 3036
 		$cssf = preg_replace(',[?:&=],', '_', $cssf);
3037 3037
 	} else {
3038 3038
 		$distant = false;
3039 3039
 		$cssf = $css;
3040 3040
 		// 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi
3041 3041
 		//propose (rien a faire dans ce cas)
3042
-		$f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css);
3042
+		$f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css);
3043 3043
 		if (@file_exists($f)) {
3044 3044
 			return $f;
3045 3045
 		}
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
 	$dir_var = sous_repertoire(_DIR_VAR, 'cache-css');
3050 3050
 	$f = $dir_var
3051 3051
 		. preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf)
3052
-		. '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css';
3052
+		. '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css';
3053 3053
 
3054 3054
 	// la css peut etre distante (url absolue !)
3055 3055
 	if ($distant) {
@@ -3095,8 +3095,8 @@  discard block
 block discarded – undo
3095 3095
 		} // si la css_direction commence par $dir_var on la fait passer pour une absolue
3096 3096
 		elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) {
3097 3097
 			$css_direction = substr($css_direction, strlen($dir_var));
3098
-			$src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction;
3099
-			$css_direction = '/@@@@@@/' . $css_direction;
3098
+			$src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction;
3099
+			$css_direction = '/@@@@@@/'.$css_direction;
3100 3100
 		}
3101 3101
 		$src[] = $regs[0][$k];
3102 3102
 		$src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]);
@@ -3145,7 +3145,7 @@  discard block
 block discarded – undo
3145 3145
 
3146 3146
 	$f = basename($css, '.css');
3147 3147
 	$f = sous_repertoire(_DIR_VAR, 'cache-css')
3148
-		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f)
3148
+		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f)
3149 3149
 		. '.css';
3150 3150
 
3151 3151
 	if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) {
@@ -3155,7 +3155,7 @@  discard block
 block discarded – undo
3155 3155
 	if ($url_absolue_css == $css) {
3156 3156
 		if (
3157 3157
 			strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0
3158
-			or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu)
3158
+			or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu)
3159 3159
 		) {
3160 3160
 			include_spip('inc/distant');
3161 3161
 			$contenu = recuperer_url($css);
@@ -3267,7 +3267,7 @@  discard block
 block discarded – undo
3267 3267
 	$expression = str_replace('\/', '/', $expression);
3268 3268
 	$expression = str_replace('/', '\/', $expression);
3269 3269
 
3270
-	if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) {
3270
+	if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) {
3271 3271
 		if (isset($r[$capte])) {
3272 3272
 			return $r[$capte];
3273 3273
 		} else {
@@ -3305,7 +3305,7 @@  discard block
 block discarded – undo
3305 3305
 	$expression = str_replace('\/', '/', $expression);
3306 3306
 	$expression = str_replace('/', '\/', $expression);
3307 3307
 
3308
-	return preg_replace('/' . $expression . '/' . $modif, $replace, $texte);
3308
+	return preg_replace('/'.$expression.'/'.$modif, $replace, $texte);
3309 3309
 }
3310 3310
 
3311 3311
 
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
 function traiter_doublons_documents(&$doublons, $letexte) {
3325 3325
 
3326 3326
 	// Verifier dans le texte & les notes (pas beau, helas)
3327
-	$t = $letexte . $GLOBALS['les_notes'];
3327
+	$t = $letexte.$GLOBALS['les_notes'];
3328 3328
 
3329 3329
 	if (
3330 3330
 		strstr($t, 'spip_document_') // evite le preg_match_all si inutile
@@ -3338,7 +3338,7 @@  discard block
 block discarded – undo
3338 3338
 		if (!isset($doublons['documents'])) {
3339 3339
 			$doublons['documents'] = '';
3340 3340
 		}
3341
-		$doublons['documents'] .= ',' . join(',', $matches[1]);
3341
+		$doublons['documents'] .= ','.join(',', $matches[1]);
3342 3342
 	}
3343 3343
 
3344 3344
 	return $letexte;
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 	if ($env) {
3396 3396
 		foreach ($env as $i => $j) {
3397 3397
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3398
-				$texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />";
3398
+				$texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />";
3399 3399
 			}
3400 3400
 		}
3401 3401
 	}
@@ -3434,7 +3434,7 @@  discard block
 block discarded – undo
3434 3434
 	if ($env) {
3435 3435
 		foreach ($env as $i => $j) {
3436 3436
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3437
-				$texte .= attribut_html($i) . "='" . attribut_html($j) . "' ";
3437
+				$texte .= attribut_html($i)."='".attribut_html($j)."' ";
3438 3438
 			}
3439 3439
 		}
3440 3440
 	}
@@ -3508,10 +3508,10 @@  discard block
 block discarded – undo
3508 3508
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
3509 3509
 	if (
3510 3510
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m)
3511
-		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg'
3511
+		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg'
3512 3512
 		and file_exists($variante_svg_generique)
3513 3513
 	) {
3514
-		if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) {
3514
+		if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg' and file_exists($variante_svg_size)) {
3515 3515
 			$img_file = $variante_svg_size;
3516 3516
 		}
3517 3517
 		else {
@@ -3569,7 +3569,7 @@  discard block
 block discarded – undo
3569 3569
 				return '';
3570 3570
 			}
3571 3571
 		}
3572
-		$atts .= " width='" . $largeur . "' height='" . $hauteur . "'";
3572
+		$atts .= " width='".$largeur."' height='".$hauteur."'";
3573 3573
 	}
3574 3574
 
3575 3575
 	if (file_exists($img_file)) {
@@ -3579,14 +3579,14 @@  discard block
 block discarded – undo
3579 3579
 		$alt = '';
3580 3580
 	}
3581 3581
 	elseif ($alt or $alt === '') {
3582
-		$alt = " alt='" . attribut_html($alt) . "'";
3582
+		$alt = " alt='".attribut_html($alt)."'";
3583 3583
 	}
3584 3584
 	else {
3585
-		$alt = " alt='" . attribut_html($title) . "'";
3585
+		$alt = " alt='".attribut_html($title)."'";
3586 3586
 	}
3587 3587
 	return "<img src='$img_file'$alt"
3588
-	. ($title ? ' title="' . attribut_html($title) . '"' : '')
3589
-	. ' ' . ltrim($atts)
3588
+	. ($title ? ' title="'.attribut_html($title).'"' : '')
3589
+	. ' '.ltrim($atts)
3590 3590
 	. ' />';
3591 3591
 }
3592 3592
 
@@ -3600,10 +3600,10 @@  discard block
 block discarded – undo
3600 3600
  */
3601 3601
 function http_style_background($img, $att = '', $size = null) {
3602 3602
 	if ($size and is_numeric($size)) {
3603
-		$size = trim($size) . 'px';
3603
+		$size = trim($size).'px';
3604 3604
 	}
3605
-	return " style='background" .
3606
-		($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';'
3605
+	return " style='background".
3606
+		($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';'
3607 3607
 		. ($size ? "background-size:{$size};" : '')
3608 3608
 		. "'";
3609 3609
 }
@@ -3718,7 +3718,7 @@  discard block
 block discarded – undo
3718 3718
 		$img = http_img_pack(
3719 3719
 			$img,
3720 3720
 			$alt,
3721
-			$class ? " class='" . attribut_html($class) . "'" : '',
3721
+			$class ? " class='".attribut_html($class)."'" : '',
3722 3722
 			'',
3723 3723
 			['chemin_image' => false, 'utiliser_suffixe_size' => false]
3724 3724
 		);
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
 	$balise_svg_source = $balise_svg;
3804 3804
 
3805 3805
 	// entete XML à supprimer
3806
-	$svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg);
3806
+	$svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg);
3807 3807
 
3808 3808
 	// IE est toujours mon ami
3809 3809
 	$balise_svg = inserer_attribut($balise_svg, 'focusable', 'false');
@@ -3821,9 +3821,9 @@  discard block
 block discarded – undo
3821 3821
 	// regler le alt
3822 3822
 	if ($alt) {
3823 3823
 		$balise_svg = inserer_attribut($balise_svg, 'role', 'img');
3824
-		$id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4);
3824
+		$id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4);
3825 3825
 		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3826
-		$title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n";
3826
+		$title = "<title id=\"$id\">".entites_html($alt)."</title>\n";
3827 3827
 		$balise_svg .= $title;
3828 3828
 	}
3829 3829
 	else {
@@ -3871,7 +3871,7 @@  discard block
 block discarded – undo
3871 3871
 	if (is_array($tableau)) {
3872 3872
 		foreach ($tableau as $k => $v) {
3873 3873
 			$res = recuperer_fond(
3874
-				'modeles/' . $modele,
3874
+				'modeles/'.$modele,
3875 3875
 				array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v]))
3876 3876
 			);
3877 3877
 			$texte .= $res;
@@ -4056,7 +4056,7 @@  discard block
 block discarded – undo
4056 4056
 	}
4057 4057
 
4058 4058
 	$c = serialize($c);
4059
-	$cle = calculer_cle_action($form . $c);
4059
+	$cle = calculer_cle_action($form.$c);
4060 4060
 	$c = "$cle:$c";
4061 4061
 
4062 4062
 	// on ne stocke pas les contextes dans des fichiers en cache
@@ -4114,15 +4114,15 @@  discard block
 block discarded – undo
4114 4114
 	}
4115 4115
 	// toujours encoder l'url source dans le bloc ajax
4116 4116
 	$r = self();
4117
-	$r = ' data-origin="' . $r . '"';
4117
+	$r = ' data-origin="'.$r.'"';
4118 4118
 	$class = 'ajaxbloc';
4119 4119
 	if ($ajaxid and is_string($ajaxid)) {
4120 4120
 		// ajaxid est normalement conforme a un nom de classe css
4121 4121
 		// on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution
4122
-		$class .= ' ajax-id-' . entites_html($ajaxid);
4122
+		$class .= ' ajax-id-'.entites_html($ajaxid);
4123 4123
 	}
4124 4124
 
4125
-	return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4125
+	return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4126 4126
 }
4127 4127
 
4128 4128
 /**
@@ -4166,7 +4166,7 @@  discard block
 block discarded – undo
4166 4166
 		$cle = substr($c, 0, $p);
4167 4167
 		$c = substr($c, $p + 1);
4168 4168
 
4169
-		if ($cle == calculer_cle_action($form . $c)) {
4169
+		if ($cle == calculer_cle_action($form.$c)) {
4170 4170
 			$env = @unserialize($c);
4171 4171
 			return $env;
4172 4172
 		}
@@ -4287,13 +4287,13 @@  discard block
 block discarded – undo
4287 4287
 				}
4288 4288
 			}
4289 4289
 		}
4290
-		$att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"';
4290
+		$att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"';
4291 4291
 	} else {
4292 4292
 		$bal = 'a';
4293 4293
 		$att = "href='$url'"
4294
-			. ($title ? " title='" . attribut_html($title) . "'" : '')
4295
-			. ($class ? " class='" . attribut_html($class) . "'" : '')
4296
-			. ($rel ? " rel='" . attribut_html($rel) . "'" : '')
4294
+			. ($title ? " title='".attribut_html($title)."'" : '')
4295
+			. ($class ? " class='".attribut_html($class)."'" : '')
4296
+			. ($rel ? " rel='".attribut_html($rel)."'" : '')
4297 4297
 			. $evt;
4298 4298
 	}
4299 4299
 	if ($libelle === null) {
@@ -4432,7 +4432,7 @@  discard block
 block discarded – undo
4432 4432
 
4433 4433
 	// Icône
4434 4434
 	$icone = http_img_pack($fond, $alt, "width='$size' height='$size'");
4435
-	$icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>";
4435
+	$icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>";
4436 4436
 
4437 4437
 	// Markup final
4438 4438
 	if ($type == 'lien') {
@@ -4709,20 +4709,20 @@  discard block
 block discarded – undo
4709 4709
 		$class_form = 'ajax';
4710 4710
 		$class = str_replace('ajax', '', $class);
4711 4711
 	}
4712
-	$class_btn = 'submit ' . trim($class);
4712
+	$class_btn = 'submit '.trim($class);
4713 4713
 
4714 4714
 	if ($confirm) {
4715
-		$confirm = 'confirm("' . attribut_html($confirm) . '")';
4715
+		$confirm = 'confirm("'.attribut_html($confirm).'")';
4716 4716
 		if ($callback) {
4717 4717
 			$callback = "$confirm?($callback):false";
4718 4718
 		} else {
4719 4719
 			$callback = $confirm;
4720 4720
 		}
4721 4721
 	}
4722
-	$onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : '';
4722
+	$onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : '';
4723 4723
 	$title = $title ? " title='$title'" : '';
4724 4724
 
4725
-	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url)
4725
+	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url)
4726 4726
 	. "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>";
4727 4727
 }
4728 4728
 
@@ -4787,14 +4787,14 @@  discard block
 block discarded – undo
4787 4787
 		$champ_titre = '';
4788 4788
 		if ($demande_titre) {
4789 4789
 			// si pas de titre declare mais champ titre, il sera peuple par le select *
4790
-			$champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : '';
4790
+			$champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : '';
4791 4791
 		}
4792 4792
 		include_spip('base/abstract_sql');
4793 4793
 		include_spip('base/connect_sql');
4794 4794
 		$objets[$type_objet][$id_objet] = sql_fetsel(
4795
-			'*' . $champ_titre,
4795
+			'*'.$champ_titre,
4796 4796
 			$desc['table_sql'],
4797
-			id_table_objet($type_objet) . ' = ' . intval($id_objet)
4797
+			id_table_objet($type_objet).' = '.intval($id_objet)
4798 4798
 		);
4799 4799
 
4800 4800
 		// Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci
@@ -4887,8 +4887,7 @@  discard block
 block discarded – undo
4887 4887
 	if (isset($ligne_sql['chapo'])) {
4888 4888
 		$chapo = $ligne_sql['chapo'];
4889 4889
 		$texte = strlen($descriptif) ?
4890
-			'' :
4891
-			"$chapo \n\n $texte";
4890
+			'' : "$chapo \n\n $texte";
4892 4891
 	}
4893 4892
 
4894 4893
 	// Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur
@@ -4963,7 +4962,7 @@  discard block
 block discarded – undo
4963 4962
 		return $texte;
4964 4963
 	}
4965 4964
 
4966
-	$traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement);
4965
+	$traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement);
4967 4966
 
4968 4967
 	// Fournir $connect et $Pile[0] au traitement si besoin
4969 4968
 	$Pile = [0 => $env];
@@ -4997,7 +4996,7 @@  discard block
 block discarded – undo
4997 4996
 	}
4998 4997
 	$url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect);
4999 4998
 
5000
-	return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>';
4999
+	return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>';
5001 5000
 }
5002 5001
 
5003 5002
 /**
@@ -5023,10 +5022,10 @@  discard block
 block discarded – undo
5023 5022
 function wrap($texte, $wrap) {
5024 5023
 	$balises = extraire_balises($wrap);
5025 5024
 	if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) {
5026
-		$texte = $wrap . $texte;
5025
+		$texte = $wrap.$texte;
5027 5026
 		$regs = array_reverse($regs[1]);
5028
-		$wrap = '</' . implode('></', $regs) . '>';
5029
-		$texte = $texte . $wrap;
5027
+		$wrap = '</'.implode('></', $regs).'>';
5028
+		$texte = $texte.$wrap;
5030 5029
 	}
5031 5030
 
5032 5031
 	return $texte;
@@ -5057,7 +5056,7 @@  discard block
 block discarded – undo
5057 5056
 
5058 5057
 	// caster $u en array si besoin
5059 5058
 	if (is_object($u)) {
5060
-		$u = (array)$u;
5059
+		$u = (array) $u;
5061 5060
 	}
5062 5061
 
5063 5062
 	if (is_array($u)) {
@@ -5079,7 +5078,7 @@  discard block
 block discarded – undo
5079 5078
 		// sinon on passe a la ligne et on indente
5080 5079
 		$i_str = str_pad('', $indent, ' ');
5081 5080
 		foreach ($u as $k => $v) {
5082
-			$out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2);
5081
+			$out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2);
5083 5082
 		}
5084 5083
 
5085 5084
 		return $out;
@@ -5133,7 +5132,7 @@  discard block
 block discarded – undo
5133 5132
  * @return string
5134 5133
  */
5135 5134
 function objet_icone($objet, $taille = 24, $class = '') {
5136
-	$icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png';
5135
+	$icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png';
5137 5136
 	$icone = chemin_image($icone);
5138 5137
 	$balise_img = charger_filtre('balise_img');
5139 5138
 
@@ -5159,7 +5158,7 @@  discard block
 block discarded – undo
5159 5158
  */
5160 5159
 function objet_T($objet, $chaine, $args = [], $options = []) {
5161 5160
 	$chaine = explode(':', $chaine);
5162
-	if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) {
5161
+	if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) {
5163 5162
 		return $t;
5164 5163
 	}
5165 5164
 	$chaine = implode(':', $chaine);
@@ -5225,7 +5224,7 @@  discard block
 block discarded – undo
5225 5224
 	$cache = recuperer_fond($fond, $contexte, $options, $connect);
5226 5225
 
5227 5226
 	// calculer le nom de la css
5228
-	$dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension);
5227
+	$dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension);
5229 5228
 	$nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond));
5230 5229
 	$contexte_implicite = calculer_contexte_implicite();
5231 5230
 
@@ -5233,14 +5232,14 @@  discard block
 block discarded – undo
5233 5232
 	// mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu
5234 5233
 	// reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5235 5234
 	if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5236
-		$hash = md5($contexte_implicite['host'] . '::' . $cache);
5235
+		$hash = md5($contexte_implicite['host'].'::'.$cache);
5237 5236
 	}
5238 5237
 	else {
5239 5238
 		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5240 5239
 		ksort($contexte);
5241
-		$hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
5240
+		$hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect);
5242 5241
 	}
5243
-	$filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
5242
+	$filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension";
5244 5243
 
5245 5244
 	// mettre a jour le fichier si il n'existe pas
5246 5245
 	// ou trop ancien
@@ -5248,8 +5247,8 @@  discard block
 block discarded – undo
5248 5247
 	// et recopie sur le fichier cible uniquement si il change
5249 5248
 	if (
5250 5249
 		!file_exists($filename)
5251
-		or !file_exists($filename . '.last')
5252
-		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified'])
5250
+		or !file_exists($filename.'.last')
5251
+		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.'.last') < $cache['lastmodified'])
5253 5252
 		or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')
5254 5253
 	) {
5255 5254
 		$contenu = $cache['texte'];
@@ -5270,10 +5269,10 @@  discard block
 block discarded – undo
5270 5269
 			}
5271 5270
 			// pas de date dans le commentaire car sinon ca invalide le md5 et force la maj
5272 5271
 			// mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non
5273
-			$comment .= "}\n   md5:" . md5($contenu) . " */\n";
5272
+			$comment .= "}\n   md5:".md5($contenu)." */\n";
5274 5273
 		}
5275 5274
 		// et ecrire le fichier si il change
5276
-		ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true);
5275
+		ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true);
5277 5276
 	}
5278 5277
 
5279 5278
 	return timestamp($filename);
@@ -5499,7 +5498,7 @@  discard block
 block discarded – undo
5499 5498
 	if ($e > 0 and strlen($mid) > 8) {
5500 5499
 		$mid = '***...***';
5501 5500
 	}
5502
-	return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : '');
5501
+	return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : '');
5503 5502
 }
5504 5503
 
5505 5504
 
@@ -5561,7 +5560,7 @@  discard block
 block discarded – undo
5561 5560
 		case 'id':
5562 5561
 		case 'anchor':
5563 5562
 			if (preg_match(',^\d,', $texte)) {
5564
-				$texte = substr($type, 0, 1) . $texte;
5563
+				$texte = substr($type, 0, 1).$texte;
5565 5564
 			}
5566 5565
 	}
5567 5566
 
@@ -5571,9 +5570,9 @@  discard block
 block discarded – undo
5571 5570
 
5572 5571
 	if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) {
5573 5572
 		if (preg_match(',^\d,', $texte)) {
5574
-			$texte = ($type ? substr($type, 0, 1) : 's') . $texte;
5573
+			$texte = ($type ? substr($type, 0, 1) : 's').$texte;
5575 5574
 		}
5576
-		$texte .= $separateur . md5($original);
5575
+		$texte .= $separateur.md5($original);
5577 5576
 		$texte = substr($texte, 0, $longueur_mini);
5578 5577
 	}
5579 5578
 
Please login to merge, or discard this patch.