Completed
Push — master ( 3898e1...ad50fe )
by cam
01:35
created
ecrire/inc/texte_mini.php 1 patch
Spacing   +27 added lines, -27 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,7 +68,7 @@  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
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	else {
85 85
 		$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
86 86
 		$echap = str_replace("  ", " &nbsp;", $echap);
87
-		$html = "<code class=\"$class\" dir=\"ltr\" $attributs>" . $echap . '</code>';
87
+		$html = "<code class=\"$class\" dir=\"ltr\" $attributs>".$echap.'</code>';
88 88
 	}
89 89
 
90 90
 	return $html;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 }
103 103
 
104 104
 if (!defined('_BALISES_BLOCS_REGEXP')) {
105
-	define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS');
105
+	define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS');
106 106
 }
107 107
 
108 108
 //
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	// Tester si on echappe en span ou en div
121 121
 	if (is_null($mode) or !in_array($mode, ['div', 'span'])) {
122
-		$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span';
122
+		$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span';
123 123
 	}
124 124
 
125 125
 	// Decouper en morceaux, base64 a des probleme selon la taille de la pile
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	) {
155 155
 		foreach ($matches as $m) {
156 156
 			if ($m[1] === 'code') {
157
-				$code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>';
157
+				$code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>';
158 158
 				$pre = str_replace($m[0], $code, $pre);
159 159
 			}
160 160
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 // Echapper les <code>...</ code>
166 166
 function traiter_echap_code_dist($regs, $options = []) {
167
-	[, , $att, $corps] = $regs;
167
+	[,, $att, $corps] = $regs;
168 168
 
169 169
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
170 170
 	if (strpos($corps, "\n") !== false) {
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
 			else {
249 249
 				$callback_secure_prefix = ($callback_options['secure_prefix'] ?? '');
250 250
 				if (
251
-					function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1]))
252
-					or function_exists($f = $f . '_dist')
251
+					function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1]))
252
+					or function_exists($f = $f.'_dist')
253 253
 					or ($callback_secure_prefix and (
254
-						function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1]))
255
-						or function_exists($f = $f . '_dist')
254
+						function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1]))
255
+						or function_exists($f = $f.'_dist')
256 256
 					))
257 257
 				) {
258 258
 					$echap = $f($regs, $callback_options);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	// dans une callback autonommee
275 275
 	if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) {
276 276
 		if (
277
-			strpos($letexte, '<' . '?') !== false and preg_match_all(
277
+			strpos($letexte, '<'.'?') !== false and preg_match_all(
278 278
 				',<[?].*($|[?]>),UisS',
279 279
 				$letexte,
280 280
 				$matches,
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			strpos($letexte, '<') !== false
307 307
 			and
308 308
 			preg_match_all(
309
-				',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS',
309
+				',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS',
310 310
 				$letexte,
311 311
 				$regs,
312 312
 				PREG_SET_ORDER
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 					}
324 324
 				}
325 325
 				if ($at) {
326
-					$rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>';
326
+					$rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>';
327 327
 					foreach ($at as $attr => $a) {
328 328
 						$rempl = inserer_attribut($rempl, $attr, $a);
329 329
 					}
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	$texte = nettoyer_raccourcis_typo($texte);
405 405
 
406 406
 	// balises de sauts de ligne et paragraphe
407
-	$texte = preg_replace('/<p( [^>]*)?' . '>/', "\r", $texte);
408
-	$texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte);
407
+	$texte = preg_replace('/<p( [^>]*)?'.'>/', "\r", $texte);
408
+	$texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte);
409 409
 
410 410
 	// on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier
411 411
 	$texte = str_replace("\n\n", "\r", $texte);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 	// supprimer les tags
414 414
 	$texte = supprimer_tags($texte);
415 415
 	$texte = trim(str_replace("\n", ' ', $texte));
416
-	$texte .= "\n";  // marquer la fin
416
+	$texte .= "\n"; // marquer la fin
417 417
 
418 418
 	// corriger la longueur de coupe
419 419
 	// en fonction de la presence de caracteres utf
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	// couper au mot precedent
429 429
 	$long = spip_substr($texte, 0, max($taille - 4, 1));
430 430
 	$u = $GLOBALS['meta']['pcre_u'];
431
-	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
431
+	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
432 432
 	if (is_null($suite)) {
433 433
 		$suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : '&nbsp;(...)');
434 434
 	}
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	if (spip_strlen($court) < max(0.75 * $taille, 2)) {
439 439
 		$points = '';
440 440
 		$long = spip_substr($texte, 0, $taille);
441
-		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
441
+		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
442 442
 		// encore trop court ? couper au caractere
443 443
 		if (spip_strlen($texte) < 0.75 * $taille) {
444 444
 			$texte = $long;
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	// supprimer l'eventuelle entite finale mal coupee
458 458
 	$texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte);
459 459
 
460
-	return quote_amp(trim($texte)) . $points;
460
+	return quote_amp(trim($texte)).$points;
461 461
 }
462 462
 
463 463
 
@@ -469,16 +469,16 @@  discard block
 block discarded – undo
469 469
 				define('_PROTEGE_JS_MODELES', creer_uniqid());
470 470
 			}
471 471
 			foreach ($r as $regs) {
472
-				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t);
472
+				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t);
473 473
 			}
474 474
 		}
475
-		if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) {
475
+		if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) {
476 476
 			if (!defined('_PROTEGE_PHP_MODELES')) {
477 477
 				include_spip('inc/acces');
478 478
 				define('_PROTEGE_PHP_MODELES', creer_uniqid());
479 479
 			}
480 480
 			foreach ($r as $regs) {
481
-				$t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t);
481
+				$t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t);
482 482
 			}
483 483
 		}
484 484
 	}
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 			if (!empty($options['wrap_suspect'])) {
597 597
 				$texte = wrap($texte, $options['wrap_suspect']);
598 598
 			}
599
-			$texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte;
599
+			$texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte;
600 600
 		}
601 601
 
602 602
 		$texte = $collecteurModeles->retablir($texte);
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
  **/
744 744
 function supprime_img($letexte, $message = null) {
745 745
 	if ($message === null) {
746
-		$message = '(' . _T('img_indisponible') . ')';
746
+		$message = '('._T('img_indisponible').')';
747 747
 	}
748 748
 
749 749
 	return preg_replace(
750
-		',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i',
750
+		',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i',
751 751
 		$message,
752 752
 		$letexte
753 753
 	);
Please login to merge, or discard this patch.