@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if (!$fonc) { |
| 148 | 148 | $fonc = $GLOBALS['debug_objets']['principal']; |
| 149 | 149 | } |
| 150 | - $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' ' . $GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 150 | + $titre = !$mode ? $fonc : ($mode.(isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' '.$GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 151 | 151 | } |
| 152 | 152 | if ($message === false) { |
| 153 | 153 | lang_select(); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $fond = $GLOBALS['fond'] ?? ''; |
| 177 | 177 | // une erreur critique sort $message en array |
| 178 | 178 | $debug = is_array($msg) ? $msg[1] : $msg; |
| 179 | - spip_log('Debug: ' . $debug . ' (' . $fond . ')'); |
|
| 179 | + spip_log('Debug: '.$debug.' ('.$fond.')'); |
|
| 180 | 180 | |
| 181 | 181 | return $msg; |
| 182 | 182 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | function debusquer_bandeau($erreurs) { |
| 185 | 185 | |
| 186 | 186 | if (!empty($erreurs)) { |
| 187 | - $n = [(is_countable($erreurs) ? count($erreurs) : 0) . ' ' . _T('zbug_erreur_squelette')]; |
|
| 187 | + $n = [(is_countable($erreurs) ? count($erreurs) : 0).' '._T('zbug_erreur_squelette')]; |
|
| 188 | 188 | |
| 189 | 189 | return debusquer_navigation($erreurs, $n); |
| 190 | 190 | } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
@@ -217,25 +217,25 @@ discard block |
||
| 217 | 217 | $valeur_simple = []; |
| 218 | 218 | foreach ($valeur as $v) { |
| 219 | 219 | if (is_array($v)) { |
| 220 | - $valeur_simple[] = 'array:' . count($v); |
|
| 220 | + $valeur_simple[] = 'array:'.count($v); |
|
| 221 | 221 | } elseif (is_object($v)) { |
| 222 | 222 | $valeur_simple[] = get_class($v); |
| 223 | 223 | } elseif (is_string($v)) { |
| 224 | - $valeur_simple[] = "'" . $v . "'"; |
|
| 224 | + $valeur_simple[] = "'".$v."'"; |
|
| 225 | 225 | } else { |
| 226 | 226 | $valeur_simple[] = $v; |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | $n = count($valeur); |
| 230 | - $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 231 | - $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 230 | + $valeur = (($n > 3) ? 'array:'.$n.' ' : ''); |
|
| 231 | + $valeur .= '['.join(', ', $valeur_simple).']'; |
|
| 232 | 232 | } elseif (is_object($valeur)) { |
| 233 | 233 | $valeur = get_class($valeur); |
| 234 | 234 | } elseif (is_string($valeur)) { |
| 235 | - $valeur = "'" . $valeur . "'"; |
|
| 235 | + $valeur = "'".$valeur."'"; |
|
| 236 | 236 | } |
| 237 | - $res .= "\n<tr><td><strong>" . nl2br((string) entites_html($nom)) |
|
| 238 | - . '</strong></td><td>: ' . nl2br((string) entites_html($valeur)) |
|
| 237 | + $res .= "\n<tr><td><strong>".nl2br((string) entites_html($nom)) |
|
| 238 | + . '</strong></td><td>: '.nl2br((string) entites_html($valeur)) |
|
| 239 | 239 | . "</td></tr>\n"; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($ligne) { |
| 261 | 261 | $msg .= " L$ligne"; |
| 262 | 262 | } |
| 263 | - spip_log($msg, "debusquer" . _LOG_ERREUR); |
|
| 263 | + spip_log($msg, "debusquer"._LOG_ERREUR); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | $nom_code = $lieu->descr['nom']; |
| 286 | 286 | $skel = $lieu->descr['sourcefile']; |
| 287 | 287 | $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
| 288 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 288 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette').'#L'.$ligne; |
|
| 289 | 289 | $skel = "<a href='$h3'><b>$skel</b></a>"; |
| 290 | 290 | if ($boucle) { |
| 291 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 291 | + $h3 = parametre_url($h2.$boucle, 'var_mode_affiche', 'boucle'); |
|
| 292 | 292 | $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Requete erronee |
| 380 | - $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 380 | + $err = '<b>'._T('avis_erreur_mysql')." $errno</b><br /><tt>\n" |
|
| 381 | 381 | . spip_htmlspecialchars($msg) |
| 382 | 382 | . "\n<br /><span style='color: red'><b>" |
| 383 | 383 | . spip_htmlspecialchars($query) |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = '') { |
| 393 | 393 | |
| 394 | - $id = $nom . $boucle; |
|
| 394 | + $id = $nom.$boucle; |
|
| 395 | 395 | if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
| 396 | 396 | foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
| 397 | 397 | if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 440 | + $incl = ','.$reg[1].'[.]\w$,'; |
|
| 441 | 441 | |
| 442 | 442 | foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
| 443 | 443 | if (preg_match($incl, $v)) { |
@@ -452,16 +452,13 @@ discard block |
||
| 452 | 452 | [$skel, $boucle, $ligne] = trouve_boucle_debug($n, $nom); |
| 453 | 453 | |
| 454 | 454 | if (!$boucle) { |
| 455 | - return !$ligne ? '' : |
|
| 456 | - (' (' . |
|
| 457 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 458 | - _T('squelette_ligne')) . |
|
| 455 | + return !$ligne ? '' : (' ('. |
|
| 456 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : _T('squelette_ligne')). |
|
| 459 | 457 | " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
| 460 | 458 | } else { |
| 461 | 459 | $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
| 462 | 460 | |
| 463 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 464 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 461 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 465 | 462 | } |
| 466 | 463 | } |
| 467 | 464 | |
@@ -483,14 +480,14 @@ discard block |
||
| 483 | 480 | |
| 484 | 481 | $s = preg_replace( |
| 485 | 482 | ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
| 486 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 483 | + '<\1>\2</\1><br />'."\n".'<\1>\3</\1>', |
|
| 487 | 484 | $s |
| 488 | 485 | ); |
| 489 | 486 | |
| 490 | 487 | |
| 491 | 488 | $tableau = explode('<br />', $s); |
| 492 | 489 | |
| 493 | - $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 490 | + $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: ".($nocpt ? 'hidden' : 'visible').";%s' href='#T%s' title=\"%s\">%0".strval(@strlen(count($tableau)))."d</a></span> %s<br />\n"; |
|
| 494 | 491 | |
| 495 | 492 | $format10 = str_replace('white', 'lightgrey', $format); |
| 496 | 493 | $formaterr = 'color: red;'; |
@@ -534,7 +531,7 @@ discard block |
||
| 534 | 531 | . '" style="cursor: pointer;">' |
| 535 | 532 | . ($nocpt ? '' : _T('info_numero_abbreviation')) |
| 536 | 533 | . '</div> |
| 537 | - ' . $res . "</div>\n"; |
|
| 534 | + ' . $res."</div>\n"; |
|
| 538 | 535 | } |
| 539 | 536 | |
| 540 | 537 | // l'environnement graphique du debuggueur |
@@ -556,14 +553,14 @@ discard block |
||
| 556 | 553 | if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
| 557 | 554 | [$legend, $texte, $res2] = debusquer_source($fonc, $mode); |
| 558 | 555 | $texte .= $res2; |
| 559 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 560 | - $legend = _T('zbug_' . $mode); |
|
| 561 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 556 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc.'tout'])) { |
|
| 557 | + $legend = _T('zbug_'.$mode); |
|
| 558 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc.'tout']; |
|
| 562 | 559 | $texte = ancre_texte($texte, ['', '']); |
| 563 | 560 | } |
| 564 | 561 | } else { |
| 565 | 562 | if (strlen(trim($res))) { |
| 566 | - return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 563 | + return "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 567 | 564 | } else { |
| 568 | 565 | // cas de l'appel sur erreur: montre la page |
| 569 | 566 | return $GLOBALS['debug_objets']['resultat']['tout'] ?? ''; |
@@ -571,7 +568,7 @@ discard block |
||
| 571 | 568 | } |
| 572 | 569 | } else { |
| 573 | 570 | $valider = charger_fonction('valider', 'xml'); |
| 574 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 571 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc.'tout']); |
|
| 575 | 572 | // Si erreur, signaler leur nombre dans le formulaire admin |
| 576 | 573 | $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
| 577 | 574 | [$texte, $err] = emboite_texte($val, $fonc, $self); |
@@ -582,14 +579,14 @@ discard block |
||
| 582 | 579 | } else { |
| 583 | 580 | $err = ": $err"; |
| 584 | 581 | } |
| 585 | - $legend = _T('validation') . ' ' . $err; |
|
| 582 | + $legend = _T('validation').' '.$err; |
|
| 586 | 583 | $res = $id = ''; |
| 587 | 584 | } |
| 588 | 585 | |
| 589 | 586 | return !trim($texte) ? '' : ( |
| 590 | - "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 587 | + "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 591 | 588 | . "<div id='debug_boucle'><fieldset$id><legend>" |
| 592 | - . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 589 | + . "<a href='".$self.'#f_'.substr($fonc, 0, 37)."'> ↑ " |
|
| 593 | 590 | . ($legend ?: $mode) |
| 594 | 591 | . '</a></legend>' |
| 595 | 592 | . $texte |
@@ -600,7 +597,7 @@ discard block |
||
| 600 | 597 | |
| 601 | 598 | function emboite_texte($res, $fonc = '', $self = '') { |
| 602 | 599 | $errs = $res->err; |
| 603 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 600 | + $texte = $res->entete.($errs ? '' : $res->page); |
|
| 604 | 601 | |
| 605 | 602 | if (!$texte and !$errs) { |
| 606 | 603 | return [ancre_texte('', ['', '']), false]; |
@@ -656,7 +653,7 @@ discard block |
||
| 656 | 653 | $err = "<h2 style='text-align: center'>" |
| 657 | 654 | . $i |
| 658 | 655 | . "<a href='#fin_err'>" |
| 659 | - . ' ' . _T('erreur_texte') |
|
| 656 | + . ' '._T('erreur_texte') |
|
| 660 | 657 | . "</a></h2><table id='debut_err' style='width: 100%'>" |
| 661 | 658 | . $err |
| 662 | 659 | . " </table><a id='fin_err'></a>"; |
@@ -666,9 +663,9 @@ discard block |
||
| 666 | 663 | [$msg, $fermant, $ouvrant] = $errs[0]; |
| 667 | 664 | $rf = reference_boucle_debug($fermant, $fonc, $self); |
| 668 | 665 | $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
| 669 | - $err = $msg . |
|
| 670 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 671 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 666 | + $err = $msg. |
|
| 667 | + "<a href='#L".$fermant."'>$fermant</a>$rf<br />". |
|
| 668 | + "<a href='#L".$ouvrant."'>$ouvrant</a>$ro"; |
|
| 672 | 669 | |
| 673 | 670 | return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
| 674 | 671 | } |
@@ -701,7 +698,7 @@ discard block |
||
| 701 | 698 | ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
| 702 | 699 | ); |
| 703 | 700 | |
| 704 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 701 | + $res .= "<fieldset id='f_".$nom."'><legend>" |
|
| 705 | 702 | . $t_skel |
| 706 | 703 | . ' ' |
| 707 | 704 | . $sourcefile |
@@ -716,7 +713,7 @@ discard block |
||
| 716 | 713 | . "'>" |
| 717 | 714 | . _T('zbug_calcul') |
| 718 | 715 | . '</a></legend>' |
| 719 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 716 | + . (!$temps ? '' : ("\n<span style='display:block;float:".$GLOBALS['spip_lang_right']."'>$temps</span><br />")) |
|
| 720 | 717 | . debusquer_contexte($contexte[$sourcefile]) |
| 721 | 718 | . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
| 722 | 719 | . "</fieldset>\n"; |
@@ -737,33 +734,33 @@ discard block |
||
| 737 | 734 | $nom = $boucle->id_boucle; |
| 738 | 735 | $req = $boucle->type_requete; |
| 739 | 736 | $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
| 740 | - $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 741 | - |
|
| 742 | - $res .= "\n<tr style='background-color: " . |
|
| 743 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 744 | - "'><td align='right'>$i</td><td>\n" . |
|
| 745 | - "<a class='debug_link_boucle' href='" . |
|
| 746 | - $self2 . |
|
| 747 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 748 | - _T('zbug_boucle') . |
|
| 749 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 750 | - $self2 . |
|
| 751 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 752 | - _T('zbug_resultat') . |
|
| 753 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 754 | - $self2 . |
|
| 755 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 756 | - _T('zbug_code') . |
|
| 757 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 758 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 759 | - "'>" . |
|
| 760 | - _T('zbug_calcul') . |
|
| 761 | - "</a></td><td>\n" . |
|
| 762 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 763 | - "</td><td>\n" . |
|
| 764 | - $req . |
|
| 765 | - "</td><td>\n" . |
|
| 766 | - spip_htmlspecialchars($crit) . |
|
| 737 | + $self2 = $self.'&var_mode_objet='.$objet; |
|
| 738 | + |
|
| 739 | + $res .= "\n<tr style='background-color: ". |
|
| 740 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff'). |
|
| 741 | + "'><td align='right'>$i</td><td>\n". |
|
| 742 | + "<a class='debug_link_boucle' href='". |
|
| 743 | + $self2. |
|
| 744 | + "&var_mode_affiche=boucle#f_$nom_skel'>". |
|
| 745 | + _T('zbug_boucle'). |
|
| 746 | + "</a></td><td>\n<a class='debug_link_boucle' href='". |
|
| 747 | + $self2. |
|
| 748 | + "&var_mode_affiche=resultat#f_$nom_skel'>". |
|
| 749 | + _T('zbug_resultat'). |
|
| 750 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 751 | + $self2. |
|
| 752 | + "&var_mode_affiche=code#f_$nom_skel'>". |
|
| 753 | + _T('zbug_code'). |
|
| 754 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 755 | + str_replace('var_mode=', 'var_profile=', $self2). |
|
| 756 | + "'>". |
|
| 757 | + _T('zbug_calcul'). |
|
| 758 | + "</a></td><td>\n". |
|
| 759 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom). |
|
| 760 | + "</td><td>\n". |
|
| 761 | + $req. |
|
| 762 | + "</td><td>\n". |
|
| 763 | + spip_htmlspecialchars($crit). |
|
| 767 | 764 | '</td></tr>'; |
| 768 | 765 | } |
| 769 | 766 | } |
@@ -790,7 +787,7 @@ discard block |
||
| 790 | 787 | } |
| 791 | 788 | // permettre le copier/coller facile |
| 792 | 789 | // $res = ancre_texte($req, array(), true); |
| 793 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 790 | + $res = "<div id='T".md5($req)."'>\n<pre>\n".$req."</pre>\n</div>\n"; |
|
| 794 | 791 | // formatage et affichage des resultats bruts de la requete |
| 795 | 792 | $ress_req = spip_query($req); |
| 796 | 793 | $brut_sql = ''; |
@@ -800,10 +797,10 @@ discard block |
||
| 800 | 797 | $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
| 801 | 798 | while ($retours_sql = sql_fetch($ress_req)) { |
| 802 | 799 | if ($num <= $max_aff) { |
| 803 | - $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 800 | + $brut_sql .= '<h3>'.($num == 1 ? $num.' sur '.sql_count($ress_req) : $num).'</h3>'; |
|
| 804 | 801 | $brut_sql .= '<p>'; |
| 805 | 802 | foreach ($retours_sql as $key => $val) { |
| 806 | - $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 803 | + $brut_sql .= '<strong>'.$key.'</strong> => '.spip_htmlspecialchars(couper($val, 150))."<br />\n"; |
|
| 807 | 804 | } |
| 808 | 805 | $brut_sql .= '</p>'; |
| 809 | 806 | } |
@@ -814,14 +811,14 @@ discard block |
||
| 814 | 811 | // ne pas afficher les $contexte_inclus |
| 815 | 812 | $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
| 816 | 813 | if ($view) { |
| 817 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 814 | + $res2 .= "\n<br /><fieldset>".interdire_scripts($view).'</fieldset>'; |
|
| 818 | 815 | } |
| 819 | 816 | } |
| 820 | 817 | } elseif ($affiche == 'code') { |
| 821 | 818 | $legend = $nom; |
| 822 | - $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 819 | + $res = ancre_texte('<'."?php\n".$quoi."\n?".'>'); |
|
| 823 | 820 | } elseif ($affiche == 'boucle') { |
| 824 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 821 | + $legend = _T('zbug_boucle').' '.$nom; |
|
| 825 | 822 | // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
| 826 | 823 | $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
| 827 | 824 | $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
@@ -839,23 +836,23 @@ discard block |
||
| 839 | 836 | include_spip('public/assembler'); // pour inclure_balise_dynamique |
| 840 | 837 | include_spip('inc/texte'); // pour corriger_typo |
| 841 | 838 | |
| 842 | - return _DOCTYPE_ECRIRE . |
|
| 843 | - html_lang_attributes() . |
|
| 844 | - "<head>\n<title>" . |
|
| 845 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 846 | - _T('admin_debug') . ' ' . spip_htmlspecialchars($titre) . ' (' . |
|
| 847 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 848 | - ")</title>\n" . |
|
| 849 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 850 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 851 | - "' />\n" . |
|
| 839 | + return _DOCTYPE_ECRIRE. |
|
| 840 | + html_lang_attributes(). |
|
| 841 | + "<head>\n<title>". |
|
| 842 | + ('SPIP '.$GLOBALS['spip_version_affichee'].' '. |
|
| 843 | + _T('admin_debug').' '.spip_htmlspecialchars($titre).' ('. |
|
| 844 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))). |
|
| 845 | + ")</title>\n". |
|
| 846 | + "<meta http-equiv='Content-Type' content='text/html". |
|
| 847 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : ''). |
|
| 848 | + "' />\n". |
|
| 852 | 849 | http_script('', 'jquery.js') |
| 853 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 854 | - . "' type='text/css' />" . |
|
| 855 | - "</head>\n" . |
|
| 856 | - "<body style='margin:0 10px;'>\n" . |
|
| 857 | - "<div id='spip-debug-header'>" . |
|
| 858 | - $corps . |
|
| 859 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 850 | + . "<link rel='stylesheet' href='".url_absolue(find_in_path('spip_admin.css')) |
|
| 851 | + . "' type='text/css' />". |
|
| 852 | + "</head>\n". |
|
| 853 | + "<body style='margin:0 10px;'>\n". |
|
| 854 | + "<div id='spip-debug-header'>". |
|
| 855 | + $corps. |
|
| 856 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false). |
|
| 860 | 857 | '</div></body></html>'; |
| 861 | 858 | } |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $link = @mysqli_connect($host, $login, $pass); |
| 59 | 59 | } |
| 60 | 60 | } catch (\mysqli_sql_exception $e) { |
| 61 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 61 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 62 | 62 | $link = false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$link) { |
| 66 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 66 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | spip_log( |
| 85 | - "Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? 'operationnelle' : 'impossible'), |
|
| 85 | + "Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? 'operationnelle' : 'impossible'), |
|
| 86 | 86 | _LOG_DEBUG |
| 87 | 87 | ); |
| 88 | 88 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 175 | 175 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 176 | - spip_log('changement de charset sql : ' . 'SET NAMES ' . _q($charset), _LOG_DEBUG); |
|
| 176 | + spip_log('changement de charset sql : '.'SET NAMES '._q($charset), _LOG_DEBUG); |
|
| 177 | 177 | |
| 178 | - return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES ' . _q($charset)); |
|
| 178 | + return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES '._q($charset)); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | function spip_mysql_get_charset($charset = [], $serveur = '', $requeter = true) { |
| 191 | 191 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 192 | 192 | $connexion['last'] = $c = 'SHOW CHARACTER SET' |
| 193 | - . (!$charset ? '' : (' LIKE ' . _q($charset['charset']))); |
|
| 193 | + . (!$charset ? '' : (' LIKE '._q($charset['charset']))); |
|
| 194 | 194 | |
| 195 | 195 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 196 | 196 | } |
@@ -234,21 +234,21 @@ discard block |
||
| 234 | 234 | $debug = ''; |
| 235 | 235 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 236 | 236 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 237 | - [, $id, , $infos] = $GLOBALS['debug']['aucasou']; |
|
| 238 | - $debug .= "BOUCLE$id @ " . ($infos[0] ?? '') . ' | '; |
|
| 237 | + [, $id,, $infos] = $GLOBALS['debug']['aucasou']; |
|
| 238 | + $debug .= "BOUCLE$id @ ".($infos[0] ?? '').' | '; |
|
| 239 | 239 | } |
| 240 | 240 | if (isset($_SERVER['REQUEST_URI'])) { |
| 241 | 241 | $debug .= $_SERVER['REQUEST_URI']; |
| 242 | 242 | } |
| 243 | 243 | if (!empty($GLOBALS['ip'])) { |
| 244 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 244 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 245 | 245 | } |
| 246 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 246 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 247 | 247 | } |
| 248 | 248 | try { |
| 249 | - $r = mysqli_query($link, $query . $debug); |
|
| 249 | + $r = mysqli_query($link, $query.$debug); |
|
| 250 | 250 | } catch (\mysqli_sql_exception $e) { |
| 251 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 251 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 252 | 252 | $r = false; |
| 253 | 253 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 254 | 254 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | $link = $connexion['link']; |
| 267 | 267 | //On retente au cas où |
| 268 | 268 | try { |
| 269 | - $r = mysqli_query($link, $query . $debug); |
|
| 269 | + $r = mysqli_query($link, $query.$debug); |
|
| 270 | 270 | } catch (\mysqli_sql_exception $e) { |
| 271 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 271 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 272 | 272 | $r = false; |
| 273 | 273 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 274 | 274 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 302 | 302 | $query = preg_replace(',^TABLE\s*`([^`]*)`,i', "TABLE \\1", $query); |
| 303 | 303 | |
| 304 | - return spip_mysql_query('ALTER ' . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 304 | + return spip_mysql_query('ALTER '.$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @return bool Toujours true |
| 315 | 315 | */ |
| 316 | 316 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 317 | - spip_mysql_query('OPTIMIZE TABLE ' . $table); |
|
| 317 | + spip_mysql_query('OPTIMIZE TABLE '.$table); |
|
| 318 | 318 | |
| 319 | 319 | return true; |
| 320 | 320 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $link = $connexion['link']; |
| 338 | 338 | $db = $connexion['db']; |
| 339 | 339 | |
| 340 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 340 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 341 | 341 | $r = mysqli_query($link, $query); |
| 342 | 342 | |
| 343 | 343 | return spip_mysql_fetch($r, null, $serveur); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | . calculer_mysql_expression('WHERE', $where) |
| 389 | 389 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 390 | 390 | . calculer_mysql_expression('HAVING', $having) |
| 391 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 391 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 392 | 392 | . ($limit ? "\nLIMIT $limit" : ''); |
| 393 | 393 | |
| 394 | 394 | // renvoyer la requete inerte si demandee |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | $exp = "\n$expression "; |
| 479 | 479 | |
| 480 | 480 | if (!is_array($v)) { |
| 481 | - return $exp . $v; |
|
| 481 | + return $exp.$v; |
|
| 482 | 482 | } else { |
| 483 | 483 | if (strtoupper($join) === 'AND') { |
| 484 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 484 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 485 | 485 | } else { |
| 486 | - return $exp . join($join, $v); |
|
| 486 | + return $exp.join($join, $v); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -501,17 +501,17 @@ discard block |
||
| 501 | 501 | if (substr($k, -1) == '@') { |
| 502 | 502 | // c'est une jointure qui se refere au from precedent |
| 503 | 503 | // pas de virgule |
| 504 | - $res .= ' ' . $v; |
|
| 504 | + $res .= ' '.$v; |
|
| 505 | 505 | } else { |
| 506 | 506 | if (!is_numeric($k)) { |
| 507 | 507 | $p = strpos($v, ' '); |
| 508 | 508 | if ($p) { |
| 509 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 509 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 510 | 510 | } else { |
| 511 | 511 | $v .= " AS `$k`"; |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | - $res .= ', ' . $v; |
|
| 514 | + $res .= ', '.$v; |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
@@ -541,13 +541,13 @@ discard block |
||
| 541 | 541 | function _mysql_traite_query($query, $db = '', $prefixe = '', $echappe_textes = true) { |
| 542 | 542 | |
| 543 | 543 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 544 | - $pref = '`' . $db . '`.'; |
|
| 544 | + $pref = '`'.$db.'`.'; |
|
| 545 | 545 | } else { |
| 546 | 546 | $pref = ''; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | if ($prefixe) { |
| 550 | - $pref .= $prefixe . '_'; |
|
| 550 | + $pref .= $prefixe.'_'; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | $suite_echap = $suite; |
| 567 | 567 | } |
| 568 | 568 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) { |
| 569 | - $suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 569 | + $suite_echap = $r[1]._mysql_traite_query($r[2], $db, $prefixe, false); |
|
| 570 | 570 | if ($echappe_textes) { |
| 571 | 571 | $suite = query_reinjecte_textes($suite_echap, $textes); |
| 572 | 572 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 579 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 580 | 580 | |
| 581 | 581 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 582 | 582 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $ok = false; |
| 617 | 617 | } |
| 618 | 618 | if (!$ok) { |
| 619 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 619 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | return $ok; |
@@ -706,10 +706,10 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $character_set = ''; |
| 708 | 708 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 709 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 709 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 710 | 710 | } |
| 711 | 711 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 712 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 712 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | foreach ($champs as $k => $v) { |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | preg_match(',(char|text),i', $defs[1]) |
| 720 | 720 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 721 | 721 | ) { |
| 722 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 722 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | $s = ','; |
| 732 | 732 | } |
| 733 | 733 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 734 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')' |
|
| 735 | - . (defined('_MYSQL_ENGINE') ? ' ENGINE=' . _MYSQL_ENGINE : '') |
|
| 734 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')' |
|
| 735 | + . (defined('_MYSQL_ENGINE') ? ' ENGINE='._MYSQL_ENGINE : '') |
|
| 736 | 736 | . ($character_set ? " DEFAULT $character_set" : '') |
| 737 | 737 | . "\n"; |
| 738 | 738 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | return false; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 814 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 815 | 815 | |
| 816 | 816 | return spip_mysql_query($query, $serveur, $requeter); |
| 817 | 817 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * Ressource à utiliser avec sql_fetch() |
| 870 | 870 | **/ |
| 871 | 871 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 872 | - return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter); |
|
| 872 | + return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | /** |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | * - true si la requête a réussie, false sinon |
| 886 | 886 | */ |
| 887 | 887 | function spip_mysql_repair($table, $serveur = '', $requeter = true) { |
| 888 | - $table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = ' . _q($table), $serveur, true)); |
|
| 888 | + $table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = '._q($table), $serveur, true)); |
|
| 889 | 889 | $engine = $table_status['Engine']; |
| 890 | 890 | if ($engine == 'InnoDB') { |
| 891 | 891 | if (spip_mysql_alter("TABLE $table ENGINE = InnoDB", $serveur, $requeter)) { |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | } elseif ($engine == 'MyISAM') { |
| 895 | 895 | return spip_mysql_query("REPAIR TABLE `$table`", $serveur, $requeter); |
| 896 | 896 | } else { |
| 897 | - spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.' . _LOG_DEBUG); |
|
| 897 | + spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.'._LOG_DEBUG); |
|
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * - string : requete sql, si $requeter = true |
| 914 | 914 | **/ |
| 915 | 915 | function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) { |
| 916 | - $r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter); |
|
| 916 | + $r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter); |
|
| 917 | 917 | if (!$requeter) { |
| 918 | 918 | return $r; |
| 919 | 919 | } |
@@ -995,22 +995,22 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | if ($val['Default'] === '0' || $val['Default']) { |
| 997 | 997 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 998 | - $nfields[$val['Field']] .= ' DEFAULT ' . $val['Default']; |
|
| 998 | + $nfields[$val['Field']] .= ' DEFAULT '.$val['Default']; |
|
| 999 | 999 | } else { |
| 1000 | - $nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 1000 | + $nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'"; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | } |
| 1003 | 1003 | if ($val['Extra']) { |
| 1004 | - $nfields[$val['Field']] .= ' ' . $val['Extra']; |
|
| 1004 | + $nfields[$val['Field']] .= ' '.$val['Extra']; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | if ($val['Key'] == 'PRI') { |
| 1007 | 1007 | $nkeys['PRIMARY KEY'] = $val['Field']; |
| 1008 | 1008 | } else { |
| 1009 | 1009 | if ($val['Key'] == 'MUL') { |
| 1010 | - $nkeys['KEY ' . $val['Field']] = $val['Field']; |
|
| 1010 | + $nkeys['KEY '.$val['Field']] = $val['Field']; |
|
| 1011 | 1011 | } else { |
| 1012 | 1012 | if ($val['Key'] == 'UNI') { |
| 1013 | - $nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field']; |
|
| 1013 | + $nkeys['UNIQUE KEY '.$val['Field']] = $val['Field']; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | 1016 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | $serveur = '', |
| 1086 | 1086 | $requeter = true |
| 1087 | 1087 | ) { |
| 1088 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1088 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1089 | 1089 | |
| 1090 | 1090 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1091 | 1091 | if (!$requeter) { |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | if ($s) { |
| 1126 | 1126 | $trace = debug_backtrace(); |
| 1127 | 1127 | if ($trace[0]['function'] != 'spip_mysql_error') { |
| 1128 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1128 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1129 | 1129 | } |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | try { |
| 1252 | 1252 | $insert = mysqli_query($link, $query); |
| 1253 | 1253 | } catch (\mysqli_sql_exception $e) { |
| 1254 | - spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG); |
|
| 1254 | + spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG); |
|
| 1255 | 1255 | // TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno() |
| 1256 | 1256 | // mais il faut pour php < 8.1 forcer les exeptions via mysqli_report(). |
| 1257 | 1257 | } |
@@ -1306,8 +1306,8 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | return spip_mysql_insert( |
| 1308 | 1308 | $table, |
| 1309 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1310 | - '(' . join(',', $couples) . ')', |
|
| 1309 | + '('.join(',', array_keys($couples)).')', |
|
| 1310 | + '('.join(',', $couples).')', |
|
| 1311 | 1311 | $desc, |
| 1312 | 1312 | $serveur, |
| 1313 | 1313 | $requeter |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | } |
| 1345 | 1345 | $fields = $desc['field'] ?? []; |
| 1346 | 1346 | |
| 1347 | - $cles = '(' . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1347 | + $cles = '('.join(',', array_keys(reset($tab_couples))).')'; |
|
| 1348 | 1348 | $valeurs = []; |
| 1349 | 1349 | $r = false; |
| 1350 | 1350 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | foreach ($couples as $champ => $val) { |
| 1354 | 1354 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1355 | 1355 | } |
| 1356 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1356 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1357 | 1357 | if (count($valeurs) >= 100) { |
| 1358 | 1358 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1359 | 1359 | $valeurs = []; |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) { |
| 1391 | 1391 | $set = []; |
| 1392 | 1392 | foreach ($champs as $champ => $val) { |
| 1393 | - $set[] = $champ . "=$val"; |
|
| 1393 | + $set[] = $champ."=$val"; |
|
| 1394 | 1394 | } |
| 1395 | 1395 | if (!empty($set)) { |
| 1396 | 1396 | return spip_mysql_query( |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | } |
| 1447 | 1447 | $set = []; |
| 1448 | 1448 | foreach ($champs as $champ => $val) { |
| 1449 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1449 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | return spip_mysql_query( |
@@ -1515,10 +1515,10 @@ discard block |
||
| 1515 | 1515 | * - False en cas d'erreur. |
| 1516 | 1516 | **/ |
| 1517 | 1517 | function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) { |
| 1518 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1518 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1519 | 1519 | ',', |
| 1520 | 1520 | array_map('_q', $couples) |
| 1521 | - ) . ')', $serveur, $requeter); |
|
| 1521 | + ).')', $serveur, $requeter); |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | |
@@ -1547,10 +1547,10 @@ discard block |
||
| 1547 | 1547 | * - False en cas d'erreur. |
| 1548 | 1548 | **/ |
| 1549 | 1549 | function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) { |
| 1550 | - $cles = '(' . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1550 | + $cles = '('.join(',', array_keys($tab_couples[0])).')'; |
|
| 1551 | 1551 | $valeurs = []; |
| 1552 | 1552 | foreach ($tab_couples as $couples) { |
| 1553 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1553 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | $valeurs = implode(', ', $valeurs); |
| 1556 | 1556 | |
@@ -1570,28 +1570,28 @@ discard block |
||
| 1570 | 1570 | */ |
| 1571 | 1571 | function spip_mysql_multi($objet, $lang) { |
| 1572 | 1572 | $lengthlang = strlen("[$lang]"); |
| 1573 | - $posmulti = 'INSTR(' . $objet . ", '<multi>')"; |
|
| 1574 | - $posfinmulti = 'INSTR(' . $objet . ", '</multi>')"; |
|
| 1575 | - $debutchaine = 'LEFT(' . $objet . ", $posmulti-1)"; |
|
| 1576 | - $finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))"; |
|
| 1577 | - $chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1578 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1573 | + $posmulti = 'INSTR('.$objet.", '<multi>')"; |
|
| 1574 | + $posfinmulti = 'INSTR('.$objet.", '</multi>')"; |
|
| 1575 | + $debutchaine = 'LEFT('.$objet.", $posmulti-1)"; |
|
| 1576 | + $finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))"; |
|
| 1577 | + $chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1578 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1579 | 1579 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1580 | - $chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1581 | - $posfinlang = 'INSTR(' . $chainelang . ", '[')"; |
|
| 1580 | + $chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1581 | + $posfinlang = 'INSTR('.$chainelang.", '[')"; |
|
| 1582 | 1582 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1583 | 1583 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1584 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1585 | - ' TRIM(' . $objet . '), ' . |
|
| 1586 | - ' CONCAT( ' . |
|
| 1587 | - " $debutchaine, " . |
|
| 1588 | - ' IF( ' . |
|
| 1589 | - " $poslang = 0, " . |
|
| 1590 | - " $chainemulti, " . |
|
| 1591 | - " $chainelang" . |
|
| 1592 | - ' ), ' . |
|
| 1593 | - " $finchaine" . |
|
| 1594 | - ' ) ' . |
|
| 1584 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1585 | + ' TRIM('.$objet.'), '. |
|
| 1586 | + ' CONCAT( '. |
|
| 1587 | + " $debutchaine, ". |
|
| 1588 | + ' IF( '. |
|
| 1589 | + " $poslang = 0, ". |
|
| 1590 | + " $chainemulti, ". |
|
| 1591 | + " $chainelang". |
|
| 1592 | + ' ), '. |
|
| 1593 | + " $finchaine". |
|
| 1594 | + ' ) '. |
|
| 1595 | 1595 | '))) AS multi'; |
| 1596 | 1596 | |
| 1597 | 1597 | return $retour; |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | * Valeur hexadécimale pour MySQL |
| 1609 | 1609 | **/ |
| 1610 | 1610 | function spip_mysql_hex($v) { |
| 1611 | - return '0x' . $v; |
|
| 1611 | + return '0x'.$v; |
|
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | /** |
@@ -1648,7 +1648,7 @@ discard block |
||
| 1648 | 1648 | * Expression SQL |
| 1649 | 1649 | **/ |
| 1650 | 1650 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1651 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1651 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1652 | 1652 | return '(' |
| 1653 | 1653 | . $champ |
| 1654 | 1654 | . (($interval <= 0) ? '>' : '<') |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | } elseif ($v === null) { |
| 1704 | 1704 | return "''"; |
| 1705 | 1705 | } |
| 1706 | - return "'" . addslashes($v) . "'"; |
|
| 1706 | + return "'".addslashes($v)."'"; |
|
| 1707 | 1707 | } |
| 1708 | 1708 | |
| 1709 | 1709 | if ($v === null) { |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | } |
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | - return ("'" . addslashes($v) . "'"); |
|
| 1730 | + return ("'".addslashes($v)."'"); |
|
| 1731 | 1731 | } |
| 1732 | 1732 | |
| 1733 | 1733 | /** |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | } else { |
| 1762 | 1762 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1763 | 1763 | |
| 1764 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1764 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1765 | 1765 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1766 | 1766 | } |
| 1767 | 1767 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | if ($logo) { |
| 41 | 41 | # TODO : deprecated, a supprimer -> anciens logos IMG/artonxx.png pas en base |
| 42 | 42 | if ((is_countable($logo) ? count($logo) : 0) < 6) { |
| 43 | - spip_log('Supprimer ancien logo ' . json_encode($logo, JSON_THROW_ON_ERROR), 'logo'); |
|
| 43 | + spip_log('Supprimer ancien logo '.json_encode($logo, JSON_THROW_ON_ERROR), 'logo'); |
|
| 44 | 44 | spip_unlink($logo[0]); |
| 45 | 45 | } |
| 46 | 46 | elseif ( |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return $erreur; |
| 90 | 90 | } |
| 91 | 91 | // chercher dans la base |
| 92 | - $mode_document = 'logo' . $mode; |
|
| 92 | + $mode_document = 'logo'.$mode; |
|
| 93 | 93 | |
| 94 | 94 | include_spip('inc/documents'); |
| 95 | 95 | $erreur = ''; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $tmp_name = false; |
| 107 | 107 | if (file_exists($source)) { |
| 108 | 108 | $tmp_name = $source; |
| 109 | - } elseif (file_exists($f = determine_upload() . $source)) { |
|
| 109 | + } elseif (file_exists($f = determine_upload().$source)) { |
|
| 110 | 110 | $tmp_name = $f; |
| 111 | 111 | } |
| 112 | 112 | if (!$tmp_name) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | if (!is_numeric($id_document)) { |
| 144 | 144 | $erreur = ($id_document ?: 'Erreur inconnue'); |
| 145 | - spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source, JSON_THROW_ON_ERROR), 'logo'); |
|
| 145 | + spip_log("Erreur ajout logo : $erreur pour source=".json_encode($source, JSON_THROW_ON_ERROR), 'logo'); |
|
| 146 | 146 | return $erreur; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -175,23 +175,23 @@ discard block |
||
| 175 | 175 | $GLOBALS['meta']['articles_modif'] = 'non'; |
| 176 | 176 | |
| 177 | 177 | foreach (['on', 'off'] as $mode) { |
| 178 | - $nom_base = $type . $mode; |
|
| 178 | + $nom_base = $type.$mode; |
|
| 179 | 179 | $dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG); |
| 180 | 180 | |
| 181 | - $files = glob($dir . $nom_base . '*'); |
|
| 181 | + $files = glob($dir.$nom_base.'*'); |
|
| 182 | 182 | // est-ce que c'est une nouvelle tentative de migration ? |
| 183 | 183 | // dans ce cas les logos sont deja dans IMG/logo/ |
| 184 | 184 | if (!(is_countable($files) ? count($files) : 0)) { |
| 185 | - $files = glob($dir_logos . $nom_base . '*'); |
|
| 185 | + $files = glob($dir_logos.$nom_base.'*'); |
|
| 186 | 186 | if (is_countable($files) ? count($files) : 0) { |
| 187 | 187 | // mais il faut verifier si ils ont pas deja ete migres pour tout ou partie |
| 188 | 188 | $filescheck = []; |
| 189 | 189 | foreach ($files as $file) { |
| 190 | - $short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file); |
|
| 190 | + $short = basename(dirname($file)).DIRECTORY_SEPARATOR.basename($file); |
|
| 191 | 191 | $filescheck[$short] = $file; |
| 192 | 192 | } |
| 193 | 193 | // trouver ceux deja migres |
| 194 | - $deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'"); |
|
| 194 | + $deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck))." AND mode LIKE 'logo%'"); |
|
| 195 | 195 | if (is_countable($deja) ? count($deja) : 0) { |
| 196 | 196 | $deja = array_column($deja, 'fichier'); |
| 197 | 197 | $restant = array_diff(array_keys($filescheck), $deja); |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $count = (is_countable($files) ? count($files) : 0); |
| 214 | - spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE); |
|
| 214 | + spip_log("logo_migrer_en_base $objet $mode : ".$count.' logos restant', 'maj'._LOG_INFO_IMPORTANTE); |
|
| 215 | 215 | |
| 216 | 216 | $deja = []; |
| 217 | 217 | foreach ($files as $file) { |
| 218 | - $logo = substr($file, strlen($dir . $nom_base)); |
|
| 218 | + $logo = substr($file, strlen($dir.$nom_base)); |
|
| 219 | 219 | $logo = explode('.', $logo); |
| 220 | 220 | if ( |
| 221 | 221 | is_numeric($logo[0]) |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | // if no logo in base |
| 227 | 227 | if (!$logo or (is_countable($logo) ? count($logo) : 0) < 6) { |
| 228 | 228 | foreach ($formats_logos as $format) { |
| 229 | - if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) { |
|
| 229 | + if (@file_exists($d = ($dir.($nom = $nom_base.intval($id_objet).'.'.$format)))) { |
|
| 230 | 230 | if (isset($desc['field']['date_modif'])) { |
| 231 | 231 | $date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet"); |
| 232 | 232 | } else { |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | // s'assurer que le logo a les bon droits au passage (evite un echec en cas de sanitization d'un svg) |
| 236 | 236 | @chmod($d, _SPIP_CHMOD & 0666); |
| 237 | 237 | // logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre |
| 238 | - @rename($d, $dir_logos . $nom); |
|
| 238 | + @rename($d, $dir_logos.$nom); |
|
| 239 | 239 | // et on le declare comme nouveau logo |
| 240 | - logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom); |
|
| 240 | + logo_modifier($objet, $id_objet, $mode, $dir_logos.$nom); |
|
| 241 | 241 | if ($date_modif) { |
| 242 | 242 | sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet"); |
| 243 | 243 | } |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | // si le fichier est encore la on le move : rien a faire ici |
| 252 | 252 | // (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas) |
| 253 | 253 | if ($dir !== $dir_logos and file_exists($file)) { |
| 254 | - @rename($file, $dir_logos_erreurs . basename($file)); |
|
| 254 | + @rename($file, $dir_logos_erreurs.basename($file)); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $count--; |
| 258 | 258 | if ($count % 250 === 0) { |
| 259 | - spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE); |
|
| 259 | + spip_log("logo_migrer_en_base $objet $mode : ".$count.' logos restant', 'maj'._LOG_INFO_IMPORTANTE); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if ($time_limit and time() > $time_limit) { |
@@ -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 | '', |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $type = reset($objets); |
| 162 | 162 | $type = objet_type($type); |
| 163 | 163 | $id = intval($ref); |
| 164 | - $ref = $type . $ref; |
|
| 164 | + $ref = $type.$ref; |
|
| 165 | 165 | } |
| 166 | 166 | else { |
| 167 | 167 | // Si la référence ne correspond à rien, c'est fini |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | return json_export(false); |
| 170 | 170 | } |
| 171 | 171 | // Sinon on récupère les infos utiles |
| 172 | - [$type, , $id, , , , ] = array_pad($match, 7, null); |
|
| 172 | + [$type,, $id,,,,] = array_pad($match, 7, null); |
|
| 173 | 173 | |
| 174 | 174 | // On regarde si le type trouvé fait partie des objets sélectionnables |
| 175 | 175 | if (!in_array(table_objet($type), $objets)) { |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | $types = (is_array($types) ? array_filter($types) : []); |
| 216 | 216 | |
| 217 | 217 | // recuperer tous les freres et soeurs de la rubrique visee |
| 218 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 219 | - $fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent=' . intval($id_parent)); |
|
| 218 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 219 | + $fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent='.intval($id_parent)); |
|
| 220 | 220 | $fratrie = array_column($fratrie, 'id_rubrique'); |
| 221 | 221 | $has = sql_allfetsel('DISTINCT id_parent', 'spip_rubriques', sql_in('id_parent', $fratrie)); |
| 222 | 222 | $has = array_column($has, 'id_parent'); |
@@ -813,9 +813,9 @@ |
||
| 813 | 813 | if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
| 814 | 814 | define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
| 815 | 815 | } |
| 816 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 816 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')'; |
|
| 817 | 817 | $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)'; |
| 818 | - $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 818 | + $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml('._TRAITEMENT_TYPO_SANS_NUMERO.')'; |
|
| 819 | 819 | $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
| 820 | 820 | $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
| 821 | 821 | $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
@@ -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, $markidmodeles); |
| 571 | 571 | } |
@@ -677,11 +677,11 @@ discard block |
||
| 677 | 677 | **/ |
| 678 | 678 | function supprime_img($letexte, $message = null) { |
| 679 | 679 | if ($message === null) { |
| 680 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 680 | + $message = '('._T('img_indisponible').')'; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | return preg_replace( |
| 684 | - ',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 684 | + ',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 685 | 685 | $message, |
| 686 | 686 | $letexte |
| 687 | 687 | ); |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | |
| 122 | 122 | $offset_pos = 0; |
| 123 | 123 | foreach ($liens as $l) { |
| 124 | - $rempl = $markid . base64_encode($l['lien']) . '|@'; |
|
| 124 | + $rempl = $markid.base64_encode($l['lien']).'|@'; |
|
| 125 | 125 | $texte = substr_replace($texte, $rempl, $l['pos'] + $offset_pos, $l['length']); |
| 126 | 126 | $offset_pos += strlen($rempl) - $l['length']; |
| 127 | 127 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | protected $_lcount = 19; |
| 74 | 74 | protected $_vcount = 21; |
| 75 | 75 | protected $_tcount = 28; |
| 76 | - protected $_ncount = 588; // _vcount * _tcount |
|
| 76 | + protected $_ncount = 588; // _vcount * _tcount |
|
| 77 | 77 | protected $_scount = 11172; // _lcount * _tcount * _vcount |
| 78 | 78 | protected $_error = false; |
| 79 | 79 | protected static $_mb_string_overload = null; |
| 80 | 80 | // See {@link set_paramter()} for details of how to change the following |
| 81 | 81 | // settings from within your script / application |
| 82 | - protected $_api_encoding = 'utf8'; // Default input charset is UTF-8 |
|
| 83 | - protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden |
|
| 84 | - protected $_strict_mode = false; // Behave strict or not |
|
| 85 | - protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008 |
|
| 82 | + protected $_api_encoding = 'utf8'; // Default input charset is UTF-8 |
|
| 83 | + protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden |
|
| 84 | + protected $_strict_mode = false; // Behave strict or not |
|
| 85 | + protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008 |
|
| 86 | 86 | |
| 87 | 87 | protected $slast; |
| 88 | 88 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $this->_api_encoding = $v; |
| 143 | 143 | break; |
| 144 | 144 | default: |
| 145 | - $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k); |
|
| 145 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | break; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if (in_array($v, array('2003', '2008'))) { |
| 157 | 157 | $this->_idn_version = $v; |
| 158 | 158 | } else { |
| 159 | - $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k); |
|
| 159 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | case 'encode_german_sz': // Deprecated |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | default: |
| 170 | - $this->_error('Set Parameter: Unknown option ' . $k); |
|
| 170 | + $this->_error('Set Parameter: Unknown option '.$k); |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | case 'ucs4_array': |
| 191 | 191 | break; |
| 192 | 192 | default: |
| 193 | - $this->_error('Unknown encoding ' . $one_time_encoding); |
|
| 193 | + $this->_error('Unknown encoding '.$one_time_encoding); |
|
| 194 | 194 | return false; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | [$email_pref, $input] = explode('@', $input, 2); |
| 209 | 209 | $arr = explode('.', $input); |
| 210 | 210 | foreach ($arr as $k => $v) { |
| 211 | - if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) { |
|
| 211 | + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
|
| 212 | 212 | $conv = $this->_decode($v); |
| 213 | 213 | if ($conv) { |
| 214 | 214 | $arr[$k] = $conv; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $input = join('.', $arr); |
| 219 | 219 | $arr = explode('.', $email_pref); |
| 220 | 220 | foreach ($arr as $k => $v) { |
| 221 | - if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) { |
|
| 221 | + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
|
| 222 | 222 | $conv = $this->_decode($v); |
| 223 | 223 | if ($conv) { |
| 224 | 224 | $arr[$k] = $conv; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | $email_pref = join('.', $arr); |
| 229 | - $return = $email_pref . '@' . $input; |
|
| 229 | + $return = $email_pref.'@'.$input; |
|
| 230 | 230 | } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) |
| 231 | 231 | // No no in strict mode |
| 232 | 232 | if ($this->_strict_mode) { |
@@ -243,13 +243,13 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | $parsed['host'] = join('.', $arr); |
| 246 | - $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 247 | - (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@'). |
|
| 246 | + $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 247 | + (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@'). |
|
| 248 | 248 | $parsed['host']. |
| 249 | - (empty($parsed['port']) ? '' : ':' . $parsed['port']). |
|
| 249 | + (empty($parsed['port']) ? '' : ':'.$parsed['port']). |
|
| 250 | 250 | (empty($parsed['path']) ? '' : $parsed['path']). |
| 251 | - (empty($parsed['query']) ? '' : '?' . $parsed['query']). |
|
| 252 | - (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']); |
|
| 251 | + (empty($parsed['query']) ? '' : '?'.$parsed['query']). |
|
| 252 | + (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); |
|
| 253 | 253 | } else { // parse_url seems to have failed, try without it |
| 254 | 254 | $arr = explode('.', $input); |
| 255 | 255 | foreach ($arr as $k => $v) { |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | // The output is UTF-8 by default, other output formats need conversion here |
| 268 | 268 | // If one time encoding is given, use this, else the objects property |
| 269 | 269 | switch ($one_time_encoding ?: $this->_api_encoding) { |
| 270 | - case 'utf8': return $return; // break; |
|
| 271 | - case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break; |
|
| 270 | + case 'utf8' : return $return; // break; |
|
| 271 | + case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break; |
|
| 272 | 272 | case 'ucs4_array': return $this->_utf8_to_ucs4($return); // break; |
| 273 | 273 | default: $this->_error('Unsupported output format'); return false; |
| 274 | 274 | } |
@@ -285,15 +285,14 @@ discard block |
||
| 285 | 285 | // Forcing conversion of input to UCS4 array |
| 286 | 286 | // If one time encoding is given, use this, else the objects property |
| 287 | 287 | switch ($one_time_encoding ?: $this->_api_encoding) { |
| 288 | - case 'utf8': |
|
| 289 | - $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 288 | + case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 290 | 289 | break; |
| 291 | 290 | case 'ucs4_string': |
| 292 | 291 | $decoded = $this->_ucs4_string_to_ucs4($decoded); |
| 293 | 292 | case 'ucs4_array': |
| 294 | 293 | break; |
| 295 | 294 | default: |
| 296 | - $this->_error('Unsupported input format: ' . ($one_time_encoding ?: $this->_api_encoding)); |
|
| 295 | + $this->_error('Unsupported input format: '.($one_time_encoding ?: $this->_api_encoding)); |
|
| 297 | 296 | return false; |
| 298 | 297 | } |
| 299 | 298 | |
@@ -382,13 +381,13 @@ discard block |
||
| 382 | 381 | } |
| 383 | 382 | } |
| 384 | 383 | $parsed['host'] = join('.', $arr); |
| 385 | - $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 386 | - (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@'). |
|
| 384 | + $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 385 | + (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@'). |
|
| 387 | 386 | $parsed['host']. |
| 388 | - (empty($parsed['port']) ? '' : ':' . $parsed['port']). |
|
| 387 | + (empty($parsed['port']) ? '' : ':'.$parsed['port']). |
|
| 389 | 388 | (empty($parsed['path']) ? '' : $parsed['path']). |
| 390 | - (empty($parsed['query']) ? '' : '?' . $parsed['query']). |
|
| 391 | - (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']); |
|
| 389 | + (empty($parsed['query']) ? '' : '?'.$parsed['query']). |
|
| 390 | + (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); |
|
| 392 | 391 | return $return; |
| 393 | 392 | } |
| 394 | 393 | |
@@ -411,11 +410,11 @@ discard block |
||
| 411 | 410 | { |
| 412 | 411 | $decoded = array(); |
| 413 | 412 | // find the Punycode prefix |
| 414 | - if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) { |
|
| 413 | + if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { |
|
| 415 | 414 | $this->_error('This is not a punycode string'); |
| 416 | 415 | return false; |
| 417 | 416 | } |
| 418 | - $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded); |
|
| 417 | + $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); |
|
| 419 | 418 | // If nothing left after removing the prefix, it is hopeless |
| 420 | 419 | if (!$encode_test) { |
| 421 | 420 | $this->_error('The given encoded string was empty'); |
@@ -441,8 +440,7 @@ discard block |
||
| 441 | 440 | for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) { |
| 442 | 441 | $digit = $this->_decode_digit($encoded[$enco_idx++]); |
| 443 | 442 | $idx += $digit * $w; |
| 444 | - $t = ($k <= $bias) ? $this->_tmin : |
|
| 445 | - (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 443 | + $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 446 | 444 | if ($digit < $t) { |
| 447 | 445 | break; |
| 448 | 446 | } |
@@ -515,7 +513,7 @@ discard block |
||
| 515 | 513 | return $encoded; // All codepoints were basic ones |
| 516 | 514 | } |
| 517 | 515 | // Start with the prefix; copy it to output |
| 518 | - $encoded = $this->_punycode_prefix . $encoded; |
|
| 516 | + $encoded = $this->_punycode_prefix.$encoded; |
|
| 519 | 517 | // If we have basic code points in output, add an hyphen to the end |
| 520 | 518 | if ($codecount) { |
| 521 | 519 | $encoded .= '-'; |
@@ -542,8 +540,7 @@ discard block |
||
| 542 | 540 | $delta++; |
| 543 | 541 | } elseif ($decoded[$i] == $cur_code) { |
| 544 | 542 | for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { |
| 545 | - $t = ($k <= $bias) ? $this->_tmin : |
|
| 546 | - (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 543 | + $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 547 | 544 | if ($q < $t) { |
| 548 | 545 | break; |
| 549 | 546 | } |
@@ -630,12 +627,12 @@ discard block |
||
| 630 | 627 | } |
| 631 | 628 | // Try to find prohibited input |
| 632 | 629 | if (in_array($v, self::$NP['prohibit']) || in_array($v, self::$NP['general_prohibited'])) { |
| 633 | - $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v)); |
|
| 630 | + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
|
| 634 | 631 | return false; |
| 635 | 632 | } |
| 636 | 633 | foreach (self::$NP['prohibit_ranges'] as $range) { |
| 637 | 634 | if ($range[0] <= $v && $v <= $range[1]) { |
| 638 | - $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v)); |
|
| 635 | + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
|
| 639 | 636 | return false; |
| 640 | 637 | } |
| 641 | 638 | } |
@@ -873,7 +870,7 @@ discard block |
||
| 873 | 870 | $output[$out_len] = $v; |
| 874 | 871 | ++$out_len; |
| 875 | 872 | if ('add' == $mode) { |
| 876 | - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
| 873 | + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
| 877 | 874 | return false; |
| 878 | 875 | } |
| 879 | 876 | continue; |
@@ -898,7 +895,7 @@ discard block |
||
| 898 | 895 | $next_byte = 4; |
| 899 | 896 | $v = ($v - 252) << 30; |
| 900 | 897 | } else { |
| 901 | - $this->_error('This might be UTF-8, but I don\'t understand it at byte ' . $k); |
|
| 898 | + $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k); |
|
| 902 | 899 | return false; |
| 903 | 900 | } |
| 904 | 901 | if ('add' == $mode) { |
@@ -911,7 +908,7 @@ discard block |
||
| 911 | 908 | if (!$this->_allow_overlong && $test == 'range') { |
| 912 | 909 | $test = 'none'; |
| 913 | 910 | if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { |
| 914 | - $this->_error('Bogus UTF-8 character detected (out of legal range) at byte ' . $k); |
|
| 911 | + $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
|
| 915 | 912 | return false; |
| 916 | 913 | } |
| 917 | 914 | } |
@@ -920,7 +917,7 @@ discard block |
||
| 920 | 917 | $output[($out_len - 1)] += $v; |
| 921 | 918 | --$next_byte; |
| 922 | 919 | } else { |
| 923 | - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
| 920 | + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
| 924 | 921 | return false; |
| 925 | 922 | } |
| 926 | 923 | if ($next_byte < 0) { |
@@ -944,13 +941,13 @@ discard block |
||
| 944 | 941 | if ($v < 128) { // 7bit are transferred literally |
| 945 | 942 | $output .= chr($v); |
| 946 | 943 | } elseif ($v < (1 << 11)) { // 2 bytes |
| 947 | - $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 944 | + $output .= chr(192 + ($v >> 6)).chr(128 + ($v & 63)); |
|
| 948 | 945 | } elseif ($v < (1 << 16)) { // 3 bytes |
| 949 | - $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 946 | + $output .= chr(224 + ($v >> 12)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63)); |
|
| 950 | 947 | } elseif ($v < (1 << 21)) { // 4 bytes |
| 951 | - $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 948 | + $output .= chr(240 + ($v >> 18)).chr(128 + (($v >> 12) & 63)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63)); |
|
| 952 | 949 | } else { |
| 953 | - $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte ' . $k); |
|
| 950 | + $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); |
|
| 954 | 951 | return false; |
| 955 | 952 | } |
| 956 | 953 | } |
@@ -969,7 +966,7 @@ discard block |
||
| 969 | 966 | // Take array values and split output to 4 bytes per value |
| 970 | 967 | // The bit mask is 255, which reads &11111111 |
| 971 | 968 | foreach ($input as $v) { |
| 972 | - $output .= chr(($v >> 24) & 255) . chr(($v >> 16) & 255) . chr(($v >> 8) & 255) . chr($v & 255); |
|
| 969 | + $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); |
|
| 973 | 970 | } |
| 974 | 971 | return $output; |
| 975 | 972 | } |
@@ -999,7 +996,7 @@ discard block |
||
| 999 | 996 | $out_len++; |
| 1000 | 997 | $output[$out_len] = 0; |
| 1001 | 998 | } |
| 1002 | - $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) ); |
|
| 999 | + $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4))); |
|
| 1003 | 1000 | } |
| 1004 | 1001 | return $output; |
| 1005 | 1002 | } |