@@ -44,13 +44,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 88 | 88 | else { |
| 89 | 89 | $echap = str_replace("\t", " ", $echap); |
| 90 | 90 | $echap = str_replace(" ", " ", $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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 408 | 408 | $texte = nettoyer_raccourcis_typo($texte); |
| 409 | 409 | |
| 410 | 410 | // balises de sauts de ligne et paragraphe |
| 411 | - $texte = preg_replace('/<p( [^>]*)?' . '>/', "\r\r", $texte); |
|
| 412 | - $texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte); |
|
| 411 | + $texte = preg_replace('/<p( [^>]*)?'.'>/', "\r\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\r", $texte); |
@@ -434,15 +434,15 @@ discard block |
||
| 434 | 434 | // excédentaire est ensuite supprimé par l'appel à preg_replace() |
| 435 | 435 | $long = spip_substr($texte, 0, max($taille + 1 - $taille_suite, 1)); |
| 436 | 436 | $u = $GLOBALS['meta']['pcre_u']; |
| 437 | - $court = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, "\\2", $long); |
|
| 437 | + $court = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, "\\2", $long); |
|
| 438 | 438 | $points = $suite; |
| 439 | 439 | |
| 440 | 440 | // trop court ? ne pas faire de (...) |
| 441 | 441 | if (spip_strlen($court) < max(0.75 * $taille, 2)) { |
| 442 | 442 | $points = ''; |
| 443 | 443 | $long = spip_substr($texte, 0, $taille + 1); |
| 444 | - preg_match('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, $long, $m); |
|
| 445 | - $texte = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, "\\2", $long); |
|
| 444 | + preg_match('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, $long, $m); |
|
| 445 | + $texte = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, "\\2", $long); |
|
| 446 | 446 | // encore trop court ? couper au caractere |
| 447 | 447 | if (spip_strlen($texte) < 0.75 * $taille) { |
| 448 | 448 | $texte = spip_substr($long, 0, $taille); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | // supprimer l'eventuelle entite finale mal coupee |
| 459 | 459 | $texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte); |
| 460 | 460 | |
| 461 | - return quote_amp(trim($texte)) . $points; |
|
| 461 | + return quote_amp(trim($texte)).$points; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | |
@@ -470,16 +470,16 @@ discard block |
||
| 470 | 470 | define('_PROTEGE_JS_MODELES', creer_uniqid()); |
| 471 | 471 | } |
| 472 | 472 | foreach ($r as $regs) { |
| 473 | - $t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t); |
|
| 473 | + $t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t); |
|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | - if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 476 | + if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 477 | 477 | if (!defined('_PROTEGE_PHP_MODELES')) { |
| 478 | 478 | include_spip('inc/acces'); |
| 479 | 479 | define('_PROTEGE_PHP_MODELES', creer_uniqid()); |
| 480 | 480 | } |
| 481 | 481 | foreach ($r as $regs) { |
| 482 | - $t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t); |
|
| 482 | + $t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | if (!empty($options['wrap_suspect'])) { |
| 598 | 598 | $texte = wrap($texte, $options['wrap_suspect']); |
| 599 | 599 | } |
| 600 | - $texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte; |
|
| 600 | + $texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte; |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | $texte = $collecteurModeles->retablir($texte); |
@@ -744,11 +744,11 @@ discard block |
||
| 744 | 744 | **/ |
| 745 | 745 | function supprime_img($letexte, $message = null) { |
| 746 | 746 | if ($message === null) { |
| 747 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 747 | + $message = '('._T('img_indisponible').')'; |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | return preg_replace( |
| 751 | - ',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 751 | + ',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 752 | 752 | $message, |
| 753 | 753 | $letexte |
| 754 | 754 | ); |