@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | '(<([a-z_-]{3,})' # <modele |
| 27 | 27 | . '\s*([0-9]*)\s*' # id |
| 28 | 28 | . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
| 29 | - . '\s*/?' . '>)' # fin du modele > |
|
| 29 | + . '\s*/?'.'>)' # fin du modele > |
|
| 30 | 30 | ); |
| 31 | 31 | |
| 32 | 32 | define( |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | . '\s*(<\/a>)?' # eventuel </a> |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | -define('_RACCOURCI_MODELE_DEBUT', '@^' . _RACCOURCI_MODELE . '@isS'); |
|
| 38 | +define('_RACCOURCI_MODELE_DEBUT', '@^'._RACCOURCI_MODELE.'@isS'); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Detecter et collecter les modeles d'un texte dans un tableau descriptif |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $pos = 0; |
| 56 | 56 | // Recuperer l'appel complet (y compris un eventuel lien) |
| 57 | 57 | foreach ($matches as $match) { |
| 58 | - $a = strpos($texte, (string)$match[0], $pos); |
|
| 58 | + $a = strpos($texte, (string) $match[0], $pos); |
|
| 59 | 59 | |
| 60 | 60 | if (preg_match(_RACCOURCI_MODELE_DEBUT, substr($texte, $a), $regs)) { |
| 61 | 61 | // s'assurer qu'il y a toujours un 5e arg, eventuellement vide |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $modeles[] = $modele; |
| 104 | 104 | } |
| 105 | - $pos = $a + strlen((string)$match[0]); |
|
| 105 | + $pos = $a + strlen((string) $match[0]); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | return $modeles; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $offset_pos = 0; |
| 132 | 132 | foreach ($modeles as $m) { |
| 133 | - $rempl = $markid . base64_encode($m['modele']) . '|@'; |
|
| 133 | + $rempl = $markid.base64_encode($m['modele']).'|@'; |
|
| 134 | 134 | $texte = substr_replace($texte, $rempl, $m['pos'] + $offset_pos, $m['length']); |
| 135 | 135 | $offset_pos += strlen($rempl) - $m['length']; |
| 136 | 136 | } |
@@ -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,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if (!defined('_BALISES_BLOCS_REGEXP')) { |
| 71 | - define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS'); |
|
| 71 | + define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Tester si on echappe en span ou en div |
| 87 | 87 | if (is_null($mode) or !in_array($mode, ['div', 'span'])) { |
| 88 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 88 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Decouper en morceaux, base64 a des probleme selon la taille de la pile |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ) { |
| 121 | 121 | foreach ($matches as $m) { |
| 122 | 122 | if ($m[1] === 'code') { |
| 123 | - $code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>'; |
|
| 123 | + $code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>'; |
|
| 124 | 124 | $pre = str_replace($m[0], $code, $pre); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | // Echapper les <code>...</ code> |
| 132 | 132 | function traiter_echap_code_dist($regs, $options = []) { |
| 133 | - [, , $att, $corps] = $regs; |
|
| 133 | + [,, $att, $corps] = $regs; |
|
| 134 | 134 | $echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code ! |
| 135 | 135 | |
| 136 | 136 | // ne pas mettre le <div...> s'il n'y a qu'une ligne |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $echap = nl2br($echap); |
| 142 | 142 | $echap = "<div style='text-align: left;' " |
| 143 | 143 | . "class='spip_code' dir='ltr'><code$att>" |
| 144 | - . $echap . '</code></div>'; |
|
| 144 | + . $echap.'</code></div>'; |
|
| 145 | 145 | } else { |
| 146 | - $echap = "<code$att class='spip_code' dir='ltr'>" . $echap . '</code>'; |
|
| 146 | + $echap = "<code$att class='spip_code' dir='ltr'>".$echap.'</code>'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $echap = str_replace("\t", ' ', $echap); |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | else { |
| 221 | 221 | $callback_secure_prefix = ($callback_options['secure_prefix'] ?? ''); |
| 222 | 222 | if ( |
| 223 | - function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1])) |
|
| 224 | - or function_exists($f = $f . '_dist') |
|
| 223 | + function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1])) |
|
| 224 | + or function_exists($f = $f.'_dist') |
|
| 225 | 225 | or ($callback_secure_prefix and ( |
| 226 | - function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1])) |
|
| 227 | - or function_exists($f = $f . '_dist') |
|
| 226 | + function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1])) |
|
| 227 | + or function_exists($f = $f.'_dist') |
|
| 228 | 228 | )) |
| 229 | 229 | ) { |
| 230 | 230 | $echap = $f($regs, $callback_options); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | // dans une callback autonommee |
| 247 | 247 | if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) { |
| 248 | 248 | if ( |
| 249 | - strpos($letexte, '<' . '?') !== false and preg_match_all( |
|
| 249 | + strpos($letexte, '<'.'?') !== false and preg_match_all( |
|
| 250 | 250 | ',<[?].*($|[?]>),UisS', |
| 251 | 251 | $letexte, |
| 252 | 252 | $matches, |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | strpos($letexte, '<') !== false |
| 279 | 279 | and |
| 280 | 280 | preg_match_all( |
| 281 | - ',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 281 | + ',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 282 | 282 | $letexte, |
| 283 | 283 | $regs, |
| 284 | 284 | PREG_SET_ORDER |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | if ($at) { |
| 298 | - $rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>'; |
|
| 298 | + $rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>'; |
|
| 299 | 299 | foreach ($at as $attr => $a) { |
| 300 | 300 | $rempl = inserer_attribut($rempl, $attr, $a); |
| 301 | 301 | } |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | $texte = nettoyer_raccourcis_typo($texte); |
| 377 | 377 | |
| 378 | 378 | // balises de sauts de ligne et paragraphe |
| 379 | - $texte = preg_replace('/<p( [^>]*)?' . '>/', "\r", $texte); |
|
| 380 | - $texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte); |
|
| 379 | + $texte = preg_replace('/<p( [^>]*)?'.'>/', "\r", $texte); |
|
| 380 | + $texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte); |
|
| 381 | 381 | |
| 382 | 382 | // on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier |
| 383 | 383 | $texte = str_replace("\n\n", "\r", $texte); |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | // supprimer les tags |
| 386 | 386 | $texte = supprimer_tags($texte); |
| 387 | 387 | $texte = trim(str_replace("\n", ' ', $texte)); |
| 388 | - $texte .= "\n"; // marquer la fin |
|
| 388 | + $texte .= "\n"; // marquer la fin |
|
| 389 | 389 | |
| 390 | 390 | // corriger la longueur de coupe |
| 391 | 391 | // en fonction de la presence de caracteres utf |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | // couper au mot precedent |
| 401 | 401 | $long = spip_substr($texte, 0, max($taille - 4, 1)); |
| 402 | 402 | $u = $GLOBALS['meta']['pcre_u']; |
| 403 | - $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 403 | + $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 404 | 404 | if (is_null($suite)) { |
| 405 | 405 | $suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : ' (...)'); |
| 406 | 406 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | if (spip_strlen($court) < max(0.75 * $taille, 2)) { |
| 411 | 411 | $points = ''; |
| 412 | 412 | $long = spip_substr($texte, 0, $taille); |
| 413 | - $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 413 | + $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 414 | 414 | // encore trop court ? couper au caractere |
| 415 | 415 | if (spip_strlen($texte) < 0.75 * $taille) { |
| 416 | 416 | $texte = $long; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | // supprimer l'eventuelle entite finale mal coupee |
| 430 | 430 | $texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte); |
| 431 | 431 | |
| 432 | - return quote_amp(trim($texte)) . $points; |
|
| 432 | + return quote_amp(trim($texte)).$points; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -441,16 +441,16 @@ discard block |
||
| 441 | 441 | define('_PROTEGE_JS_MODELES', creer_uniqid()); |
| 442 | 442 | } |
| 443 | 443 | foreach ($r as $regs) { |
| 444 | - $t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t); |
|
| 444 | + $t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | - if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 447 | + if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 448 | 448 | if (!defined('_PROTEGE_PHP_MODELES')) { |
| 449 | 449 | include_spip('inc/acces'); |
| 450 | 450 | define('_PROTEGE_PHP_MODELES', creer_uniqid()); |
| 451 | 451 | } |
| 452 | 452 | foreach ($r as $regs) { |
| 453 | - $t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t); |
|
| 453 | + $t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t); |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | if (!empty($options['wrap_suspect'])) { |
| 566 | 566 | $texte = wrap($texte, $options['wrap_suspect']); |
| 567 | 567 | } |
| 568 | - $texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte; |
|
| 568 | + $texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte; |
|
| 569 | 569 | } |
| 570 | 570 | $texte = modele_retablir_raccourcis_echappes($texte, $markid); |
| 571 | 571 | } |
@@ -673,11 +673,11 @@ discard block |
||
| 673 | 673 | **/ |
| 674 | 674 | function supprime_img($letexte, $message = null) { |
| 675 | 675 | if ($message === null) { |
| 676 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 676 | + $message = '('._T('img_indisponible').')'; |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | return preg_replace( |
| 680 | - ',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 680 | + ',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 681 | 681 | $message, |
| 682 | 682 | $letexte |
| 683 | 683 | ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | -define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS'); |
|
| 114 | +define('_EXTRAIRE_LIEN', ',^\s*(?:'._PROTOCOLES_STD.'):?/?/?\s*$,iS'); |
|
| 115 | 115 | |
| 116 | 116 | function traiter_lien_explicite($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) { |
| 117 | 117 | if (preg_match(_EXTRAIRE_LIEN, $ref)) { |
@@ -127,19 +127,19 @@ discard block |
||
| 127 | 127 | $lien_court = charger_fonction('lien_court', 'inc'); |
| 128 | 128 | $texte = $lien_court($texte); |
| 129 | 129 | if ($echappe_typo) { |
| 130 | - $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 130 | + $texte = '<html>'.quote_amp($texte).'</html>'; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // petites corrections d'URL |
| 135 | 135 | if (preg_match('/^www\.[^@]+$/S', $lien)) { |
| 136 | - $lien = 'http://' . $lien; |
|
| 136 | + $lien = 'http://'.$lien; |
|
| 137 | 137 | } else { |
| 138 | 138 | if (strpos($lien, '@') && email_valide($lien)) { |
| 139 | 139 | if (!$texte) { |
| 140 | 140 | $texte = $lien; |
| 141 | 141 | } |
| 142 | - $lien = 'mailto:' . $lien; |
|
| 142 | + $lien = 'mailto:'.$lien; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, string $connect = '') { |
| 158 | - if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 158 | + if (function_exists($f = 'glossaire_'.$ancre)) { |
|
| 159 | 159 | $url = $f($texte, $id); |
| 160 | 160 | } else { |
| 161 | 161 | $url = glossaire_std($texte); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - [$type, , $id, , $args, , $ancre] = array_pad($match, 7, null); |
|
| 191 | + [$type,, $id,, $args,, $ancre] = array_pad($match, 7, null); |
|
| 192 | 192 | |
| 193 | 193 | # attention dans le cas des sites le lien doit pointer non pas sur |
| 194 | 194 | # la page locale du site, mais directement sur le site lui-meme |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (!@$r['titre']) { |
| 227 | - $r['titre'] = _T($type) . " $id"; |
|
| 227 | + $r['titre'] = _T($type)." $id"; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if ($pour == 'titre') { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | and $mime = sql_getfetsel( |
| 240 | 240 | 'mime_type', |
| 241 | 241 | 'spip_types_documents', |
| 242 | - 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 242 | + 'extension IN ('.sql_get_select('extension', 'spip_documents', 'id_document='.sql_quote($id)).')', |
|
| 243 | 243 | '', |
| 244 | 244 | '', |
| 245 | 245 | '', |