Completed
Push — master ( 6d9132...eebacf )
by cam
01:06
created
ecrire/inc/texte_mini.php 1 patch
Spacing   +29 added lines, -29 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,13 +68,13 @@  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 ($attributs) {
73
-		$attributs = " " . trim($attributs);
73
+		$attributs = " ".trim($attributs);
74 74
 	}
75 75
 	if ($langage) {
76 76
 		$class .= " language-$langage";
77
-		$attributs .= ' data-language="'. $langage .'"';
77
+		$attributs .= ' data-language="'.$langage.'"';
78 78
 	}
79 79
 	if ($bloc) {
80 80
 		$html = "<div class=\"precode\">"
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	else {
89 89
 		$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
90 90
 		$echap = str_replace("  ", " &nbsp;", $echap);
91
-		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>" . $echap . '</code>';
91
+		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>".$echap.'</code>';
92 92
 	}
93 93
 
94 94
 	return $html;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 }
107 107
 
108 108
 if (!defined('_BALISES_BLOCS_REGEXP')) {
109
-	define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS');
109
+	define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS');
110 110
 }
111 111
 
112 112
 //
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 	// Tester si on echappe en span ou en div
125 125
 	if (is_null($mode) or !in_array($mode, ['div', 'span'])) {
126
-		$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span';
126
+		$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span';
127 127
 	}
128 128
 
129 129
 	// Decouper en morceaux, base64 a des probleme selon la taille de la pile
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	) {
159 159
 		foreach ($matches as $m) {
160 160
 			if ($m[1] === 'code') {
161
-				$code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>';
161
+				$code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>';
162 162
 				$pre = str_replace($m[0], $code, $pre);
163 163
 			}
164 164
 		}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 // Echapper les <code>...</ code>
170 170
 function traiter_echap_code_dist($regs, $options = []) {
171
-	[, , $att, $corps] = $regs;
171
+	[,, $att, $corps] = $regs;
172 172
 
173 173
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
174 174
 	if (strpos($corps, "\n") !== false) {
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 			else {
253 253
 				$callback_secure_prefix = ($callback_options['secure_prefix'] ?? '');
254 254
 				if (
255
-					function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1]))
256
-					or function_exists($f = $f . '_dist')
255
+					function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1]))
256
+					or function_exists($f = $f.'_dist')
257 257
 					or ($callback_secure_prefix and (
258
-						function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1]))
259
-						or function_exists($f = $f . '_dist')
258
+						function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1]))
259
+						or function_exists($f = $f.'_dist')
260 260
 					))
261 261
 				) {
262 262
 					$echap = $f($regs, $callback_options);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	// dans une callback autonommee
279 279
 	if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) {
280 280
 		if (
281
-			strpos($letexte, '<' . '?') !== false and preg_match_all(
281
+			strpos($letexte, '<'.'?') !== false and preg_match_all(
282 282
 				',<[?].*($|[?]>),UisS',
283 283
 				$letexte,
284 284
 				$matches,
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			strpos($letexte, '<') !== false
311 311
 			and
312 312
 			preg_match_all(
313
-				',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS',
313
+				',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS',
314 314
 				$letexte,
315 315
 				$regs,
316 316
 				PREG_SET_ORDER
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 					}
328 328
 				}
329 329
 				if ($at) {
330
-					$rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>';
330
+					$rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>';
331 331
 					foreach ($at as $attr => $a) {
332 332
 						$rempl = inserer_attribut($rempl, $attr, $a);
333 333
 					}
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	$texte = nettoyer_raccourcis_typo($texte);
409 409
 
410 410
 	// balises de sauts de ligne et paragraphe
411
-	$texte = preg_replace('/<p( [^>]*)?' . '>/', "\r", $texte);
412
-	$texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte);
411
+	$texte = preg_replace('/<p( [^>]*)?'.'>/', "\r", $texte);
412
+	$texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte);
413 413
 
414 414
 	// on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier
415 415
 	$texte = str_replace("\n\n", "\r", $texte);
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	// supprimer les tags
418 418
 	$texte = supprimer_tags($texte);
419 419
 	$texte = trim(str_replace("\n", ' ', $texte));
420
-	$texte .= "\n";  // marquer la fin
420
+	$texte .= "\n"; // marquer la fin
421 421
 
422 422
 	// corriger la longueur de coupe
423 423
 	// en fonction de la presence de caracteres utf
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	// couper au mot precedent
433 433
 	$long = spip_substr($texte, 0, max($taille - 4, 1));
434 434
 	$u = $GLOBALS['meta']['pcre_u'];
435
-	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
435
+	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
436 436
 	if (is_null($suite)) {
437 437
 		$suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : '&nbsp;(...)');
438 438
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	if (spip_strlen($court) < max(0.75 * $taille, 2)) {
443 443
 		$points = '';
444 444
 		$long = spip_substr($texte, 0, $taille);
445
-		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
445
+		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
446 446
 		// encore trop court ? couper au caractere
447 447
 		if (spip_strlen($texte) < 0.75 * $taille) {
448 448
 			$texte = $long;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	// supprimer l'eventuelle entite finale mal coupee
462 462
 	$texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte);
463 463
 
464
-	return quote_amp(trim($texte)) . $points;
464
+	return quote_amp(trim($texte)).$points;
465 465
 }
466 466
 
467 467
 
@@ -473,16 +473,16 @@  discard block
 block discarded – undo
473 473
 				define('_PROTEGE_JS_MODELES', creer_uniqid());
474 474
 			}
475 475
 			foreach ($r as $regs) {
476
-				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t);
476
+				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t);
477 477
 			}
478 478
 		}
479
-		if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) {
479
+		if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) {
480 480
 			if (!defined('_PROTEGE_PHP_MODELES')) {
481 481
 				include_spip('inc/acces');
482 482
 				define('_PROTEGE_PHP_MODELES', creer_uniqid());
483 483
 			}
484 484
 			foreach ($r as $regs) {
485
-				$t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t);
485
+				$t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t);
486 486
 			}
487 487
 		}
488 488
 	}
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 			if (!empty($options['wrap_suspect'])) {
601 601
 				$texte = wrap($texte, $options['wrap_suspect']);
602 602
 			}
603
-			$texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte;
603
+			$texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte;
604 604
 		}
605 605
 
606 606
 		$texte = $collecteurModeles->retablir($texte);
@@ -747,11 +747,11 @@  discard block
 block discarded – undo
747 747
  **/
748 748
 function supprime_img($letexte, $message = null) {
749 749
 	if ($message === null) {
750
-		$message = '(' . _T('img_indisponible') . ')';
750
+		$message = '('._T('img_indisponible').')';
751 751
 	}
752 752
 
753 753
 	return preg_replace(
754
-		',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i',
754
+		',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i',
755 755
 		$message,
756 756
 		$letexte
757 757
 	);
Please login to merge, or discard this patch.