Completed
Push — master ( ad50fe...1f1b29 )
by cam
01:13
created
ecrire/inc/texte_mini.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	// celle du texte) et public (spip_lang est la langue du texte)
45 45
 	$dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']);
46 46
 
47
-	$p = 'puce' . (test_espace_prive() ? '_prive' : '');
47
+	$p = 'puce'.(test_espace_prive() ? '_prive' : '');
48 48
 	if ($dir == 'rtl') {
49 49
 		$p .= '_rtl';
50 50
 	}
51 51
 
52 52
 	if (!isset($GLOBALS[$p])) {
53
-		$GLOBALS[$p] = '<span class="spip-puce ' . $dir . '"><b>–</b></span>';
53
+		$GLOBALS[$p] = '<span class="spip-puce '.$dir.'"><b>–</b></span>';
54 54
 	}
55 55
 
56 56
 	return $GLOBALS[$p];
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 function spip_balisage_code(string $corps, bool $bloc = false, string $attributs = '', string $langage = '') {
69 69
 
70 70
 	$echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code !
71
-	$class = "spip_code " . ($bloc ? 'spip_code_block' : 'spip_code_inline');
71
+	$class = "spip_code ".($bloc ? 'spip_code_block' : 'spip_code_inline');
72 72
 	if ($langage) {
73 73
 		$class .= " language-$langage";
74 74
 	}
75 75
 	if ($attributs) {
76
-		$attributs = " " . trim($attributs);
76
+		$attributs = " ".trim($attributs);
77 77
 	}
78 78
 	if ($bloc) {
79 79
 		$html = "<div class=\"precode\">"
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	else {
88 88
 		$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
89 89
 		$echap = str_replace("  ", " &nbsp;", $echap);
90
-		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>" . $echap . '</code>';
90
+		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>".$echap.'</code>';
91 91
 	}
92 92
 
93 93
 	return $html;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 }
106 106
 
107 107
 if (!defined('_BALISES_BLOCS_REGEXP')) {
108
-	define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS');
108
+	define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS');
109 109
 }
110 110
 
111 111
 //
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 	// Tester si on echappe en span ou en div
124 124
 	if (is_null($mode) or !in_array($mode, ['div', 'span'])) {
125
-		$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span';
125
+		$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span';
126 126
 	}
127 127
 
128 128
 	// Decouper en morceaux, base64 a des probleme selon la taille de la pile
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	) {
158 158
 		foreach ($matches as $m) {
159 159
 			if ($m[1] === 'code') {
160
-				$code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>';
160
+				$code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>';
161 161
 				$pre = str_replace($m[0], $code, $pre);
162 162
 			}
163 163
 		}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 // Echapper les <code>...</ code>
169 169
 function traiter_echap_code_dist($regs, $options = []) {
170
-	[, , $att, $corps] = $regs;
170
+	[,, $att, $corps] = $regs;
171 171
 
172 172
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
173 173
 	if (strpos($corps, "\n") !== false) {
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 			else {
252 252
 				$callback_secure_prefix = ($callback_options['secure_prefix'] ?? '');
253 253
 				if (
254
-					function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1]))
255
-					or function_exists($f = $f . '_dist')
254
+					function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1]))
255
+					or function_exists($f = $f.'_dist')
256 256
 					or ($callback_secure_prefix and (
257
-						function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1]))
258
-						or function_exists($f = $f . '_dist')
257
+						function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1]))
258
+						or function_exists($f = $f.'_dist')
259 259
 					))
260 260
 				) {
261 261
 					$echap = $f($regs, $callback_options);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	// dans une callback autonommee
278 278
 	if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) {
279 279
 		if (
280
-			strpos($letexte, '<' . '?') !== false and preg_match_all(
280
+			strpos($letexte, '<'.'?') !== false and preg_match_all(
281 281
 				',<[?].*($|[?]>),UisS',
282 282
 				$letexte,
283 283
 				$matches,
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 			strpos($letexte, '<') !== false
310 310
 			and
311 311
 			preg_match_all(
312
-				',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS',
312
+				',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS',
313 313
 				$letexte,
314 314
 				$regs,
315 315
 				PREG_SET_ORDER
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 					}
327 327
 				}
328 328
 				if ($at) {
329
-					$rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>';
329
+					$rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>';
330 330
 					foreach ($at as $attr => $a) {
331 331
 						$rempl = inserer_attribut($rempl, $attr, $a);
332 332
 					}
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	$texte = nettoyer_raccourcis_typo($texte);
408 408
 
409 409
 	// balises de sauts de ligne et paragraphe
410
-	$texte = preg_replace('/<p( [^>]*)?' . '>/', "\r", $texte);
411
-	$texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte);
410
+	$texte = preg_replace('/<p( [^>]*)?'.'>/', "\r", $texte);
411
+	$texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte);
412 412
 
413 413
 	// on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier
414 414
 	$texte = str_replace("\n\n", "\r", $texte);
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	// supprimer les tags
417 417
 	$texte = supprimer_tags($texte);
418 418
 	$texte = trim(str_replace("\n", ' ', $texte));
419
-	$texte .= "\n";  // marquer la fin
419
+	$texte .= "\n"; // marquer la fin
420 420
 
421 421
 	// corriger la longueur de coupe
422 422
 	// en fonction de la presence de caracteres utf
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	// couper au mot precedent
432 432
 	$long = spip_substr($texte, 0, max($taille - 4, 1));
433 433
 	$u = $GLOBALS['meta']['pcre_u'];
434
-	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
434
+	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
435 435
 	if (is_null($suite)) {
436 436
 		$suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : '&nbsp;(...)');
437 437
 	}
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	if (spip_strlen($court) < max(0.75 * $taille, 2)) {
442 442
 		$points = '';
443 443
 		$long = spip_substr($texte, 0, $taille);
444
-		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
444
+		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
445 445
 		// encore trop court ? couper au caractere
446 446
 		if (spip_strlen($texte) < 0.75 * $taille) {
447 447
 			$texte = $long;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	// supprimer l'eventuelle entite finale mal coupee
461 461
 	$texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte);
462 462
 
463
-	return quote_amp(trim($texte)) . $points;
463
+	return quote_amp(trim($texte)).$points;
464 464
 }
465 465
 
466 466
 
@@ -472,16 +472,16 @@  discard block
 block discarded – undo
472 472
 				define('_PROTEGE_JS_MODELES', creer_uniqid());
473 473
 			}
474 474
 			foreach ($r as $regs) {
475
-				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t);
475
+				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t);
476 476
 			}
477 477
 		}
478
-		if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) {
478
+		if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) {
479 479
 			if (!defined('_PROTEGE_PHP_MODELES')) {
480 480
 				include_spip('inc/acces');
481 481
 				define('_PROTEGE_PHP_MODELES', creer_uniqid());
482 482
 			}
483 483
 			foreach ($r as $regs) {
484
-				$t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t);
484
+				$t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t);
485 485
 			}
486 486
 		}
487 487
 	}
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 			if (!empty($options['wrap_suspect'])) {
600 600
 				$texte = wrap($texte, $options['wrap_suspect']);
601 601
 			}
602
-			$texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte;
602
+			$texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte;
603 603
 		}
604 604
 
605 605
 		$texte = $collecteurModeles->retablir($texte);
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
  **/
747 747
 function supprime_img($letexte, $message = null) {
748 748
 	if ($message === null) {
749
-		$message = '(' . _T('img_indisponible') . ')';
749
+		$message = '('._T('img_indisponible').')';
750 750
 	}
751 751
 
752 752
 	return preg_replace(
753
-		',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i',
753
+		',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i',
754 754
 		$message,
755 755
 		$letexte
756 756
 	);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@  discard block
 block discarded – undo
83 83
 		  . '</code>'
84 84
 		  . '</pre>'
85 85
 		  . '</div>';
86
-	}
87
-	else {
86
+	} else {
88 87
 		$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
89 88
 		$echap = str_replace("  ", " &nbsp;", $echap);
90 89
 		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>" . $echap . '</code>';
@@ -611,8 +610,7 @@  discard block
 block discarded – undo
611 610
 		$collecteurLiens = $collecteurModeles = null;
612 611
 		if (!empty($options['expanser_liens'])) {
613 612
 			$texte = expanser_liens($texte, $env['connect'] ?? '', $env['env'] ?? []);
614
-		}
615
-		else {
613
+		} else {
616 614
 			include_spip("src/Texte/Collecteur/AbstractCollecteur");
617 615
 			include_spip("src/Texte/Collecteur/Liens");
618 616
 			include_spip("src/Texte/Collecteur/Modeles");
Please login to merge, or discard this patch.