@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 27 | 27 | } |
| 28 | 28 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 29 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 29 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 30 | 30 | } |
| 31 | 31 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 32 | 32 | define('_INC_DISTANT_MAX_SIZE', 2_097_152); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 38 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 39 | 39 | preg_replace( |
| 40 | 40 | '@^https?:@', |
| 41 | 41 | 'https?:', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // si c'est la protection de soi-meme, retourner le path |
| 72 | 72 | if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 73 | - $source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]); |
|
| 73 | + $source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]); |
|
| 74 | 74 | |
| 75 | 75 | return @file_exists($source) ? $source : false; |
| 76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $localrac = _DIR_RACINE . $local; |
|
| 93 | + $localrac = _DIR_RACINE.$local; |
|
| 94 | 94 | $t = ($mode === 'force') ? false : @file_exists($localrac); |
| 95 | 95 | |
| 96 | 96 | // test d'existence du fichier |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | ['file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : ''] |
| 116 | 116 | ); |
| 117 | 117 | if (!$res or (!$res['length'] and $res['status'] != 304)) { |
| 118 | - spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | else { |
| 121 | - spip_log("copie_locale : recuperation $source sur $localrac OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant'); |
|
| 121 | + spip_log("copie_locale : recuperation $source sur $localrac OK | taille ".$res['length'].' status '.$res['status'], 'distant'); |
|
| 122 | 122 | } |
| 123 | 123 | if (!$res or !$res['length']) { |
| 124 | 124 | // si $t c'est sans doute juste un not-modified-since |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | if (!$is_known_host) { |
| 209 | 209 | $host = trim($parsed_url['host'], '.'); |
| 210 | - if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 210 | + if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) { |
|
| 211 | 211 | $ip = gethostbyname($host); |
| 212 | 212 | if ($ip === $host) { |
| 213 | 213 | // Error condition for gethostbyname() |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | if ($ip) { |
| 231 | - if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 231 | + if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $port = $parsed_url['port']; |
| 242 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 242 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 243 | 243 | return $url; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | if ($taille > 500) { |
| 312 | - $boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8); |
|
| 312 | + $boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
@@ -337,16 +337,16 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } else { |
| 339 | 339 | // fabrique une chaine HTTP simple pour un POST |
| 340 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 340 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 341 | 341 | $chaine = []; |
| 342 | 342 | if (is_array($donnees)) { |
| 343 | 343 | foreach ($donnees as $cle => $valeur) { |
| 344 | 344 | if (is_array($valeur)) { |
| 345 | 345 | foreach ($valeur as $val2) { |
| 346 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 346 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 347 | 347 | } |
| 348 | 348 | } else { |
| 349 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 349 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | $chaine = implode('&', $chaine); |
@@ -451,13 +451,13 @@ discard block |
||
| 451 | 451 | $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - spip_log("recuperer_url " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); |
|
| 454 | + spip_log("recuperer_url ".$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 455 | 455 | |
| 456 | 456 | // Ajout des en-têtes spécifiques si besoin |
| 457 | 457 | $formatted_data = ''; |
| 458 | 458 | if (!empty($options['headers'])) { |
| 459 | 459 | foreach ($options['headers'] as $champ => $valeur) { |
| 460 | - $formatted_data .= $champ . ': ' . $valeur . "\r\n"; |
|
| 460 | + $formatted_data .= $champ.': '.$valeur."\r\n"; |
|
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | [$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']); |
| 466 | 466 | $head .= $formatted_data; |
| 467 | 467 | if (stripos($head, 'Content-Length:') === false) { |
| 468 | - $head .= 'Content-Length: ' . strlen($postdata) . "\r\n"; |
|
| 468 | + $head .= 'Content-Length: '.strlen($postdata)."\r\n"; |
|
| 469 | 469 | } |
| 470 | - $formatted_data = $head . "\r\n" . $postdata; |
|
| 470 | + $formatted_data = $head."\r\n".$postdata; |
|
| 471 | 471 | if ( |
| 472 | 472 | strlen($postdata) |
| 473 | 473 | and !$methode_demandee |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 482 | 482 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 483 | 483 | if (!tester_url_absolue($url)) { |
| 484 | - $url = 'http://' . $url; |
|
| 484 | + $url = 'http://'.$url; |
|
| 485 | 485 | } elseif (strncmp($url, '//', 2) == 0) { |
| 486 | - $url = 'http:' . $url; |
|
| 486 | + $url = 'http:'.$url; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $url = url_to_ascii($url); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $options['if_modified_since'] |
| 513 | 513 | ); |
| 514 | 514 | if (!$handle) { |
| 515 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 515 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 516 | 516 | |
| 517 | 517 | return false; |
| 518 | 518 | } |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | 'status' => 200, |
| 543 | 543 | ]; |
| 544 | 544 | } else { |
| 545 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 545 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 546 | 546 | return false; |
| 547 | 547 | } |
| 548 | 548 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | $options['datas'] = ''; |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | - spip_log("recuperer_url recommence " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); |
|
| 561 | + spip_log("recuperer_url recommence ".$options['methode']." sur $url", 'distant'._LOG_DEBUG); |
|
| 562 | 562 | |
| 563 | 563 | return recuperer_url($url, $options); |
| 564 | 564 | } elseif ($res['status'] !== 200) { |
| 565 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 565 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 566 | 566 | } |
| 567 | 567 | $result['status'] = $res['status']; |
| 568 | 568 | if (isset($res['headers'])) { |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // on ne veut que les entetes |
| 580 | 580 | if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') { |
| 581 | - spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG); |
|
| 581 | + spip_log("RESULTAT recuperer_url ".$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG); |
|
| 582 | 582 | return $result; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $gz = false; |
| 590 | 590 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 591 | - $gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz'); |
|
| 591 | + $gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz'); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | $trace = json_decode(json_encode($result), true); |
| 626 | 626 | $trace['page'] = '...'; |
| 627 | - spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG); |
|
| 627 | + spip_log("RESULTAT recuperer_url ".$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG); |
|
| 628 | 628 | |
| 629 | 629 | return $result; |
| 630 | 630 | } |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $sig['url'] = $url; |
| 679 | 679 | |
| 680 | 680 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 681 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 681 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 682 | 682 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 683 | 683 | $cache = "$sub$cache"; |
| 684 | 684 | |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | $fp = false; |
| 733 | 733 | if ($fichier) { |
| 734 | 734 | include_spip('inc/acces'); |
| 735 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 735 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 736 | 736 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 737 | 737 | if (!$fp and file_exists($fichier)) { |
| 738 | 738 | return filesize($fichier); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | $result['status'] = intval($r[1]); |
| 793 | 793 | while ($s = trim(fgets($handle, 16384))) { |
| 794 | - $result['headers'][] = $s . "\n"; |
|
| 794 | + $result['headers'][] = $s."\n"; |
|
| 795 | 795 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 796 | 796 | [, $d, $v] = $r; |
| 797 | 797 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -840,13 +840,13 @@ discard block |
||
| 840 | 840 | |
| 841 | 841 | // on se place tout le temps comme si on etait a la racine |
| 842 | 842 | if (_DIR_RACINE) { |
| 843 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 843 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | $m = md5($source); |
| 847 | 847 | |
| 848 | 848 | return $d |
| 849 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 849 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 850 | 850 | . substr($m, 0, 4) |
| 851 | 851 | . ".$extension"; |
| 852 | 852 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | // Si c'est deja local pas de souci |
| 870 | 870 | if (!tester_url_absolue($source)) { |
| 871 | 871 | if (_DIR_RACINE) { |
| 872 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 872 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | return $source; |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $ext |
| 888 | 888 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 889 | 889 | and $f = nom_fichier_copie_locale($source, $ext) |
| 890 | - and file_exists(_DIR_RACINE . $f) |
|
| 890 | + and file_exists(_DIR_RACINE.$f) |
|
| 891 | 891 | ) { |
| 892 | 892 | return $f; |
| 893 | 893 | } |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | |
| 896 | 896 | // Si c'est deja dans la table des documents, |
| 897 | 897 | // ramener le nom de sa copie potentielle |
| 898 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 898 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 899 | 899 | |
| 900 | 900 | if ($ext) { |
| 901 | 901 | return nom_fichier_copie_locale($source, $ext); |
@@ -906,9 +906,9 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 908 | 908 | |
| 909 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 909 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 910 | 910 | $f = nom_fichier_copie_locale($source, $ext); |
| 911 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 911 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 912 | 912 | return $f; |
| 913 | 913 | } |
| 914 | 914 | } |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | // Ping pour voir si son extension est connue et autorisee |
| 917 | 917 | // avec mise en cache du resultat du ping |
| 918 | 918 | |
| 919 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 919 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 920 | 920 | if ( |
| 921 | 921 | !@file_exists($cache) |
| 922 | 922 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
@@ -926,10 +926,10 @@ discard block |
||
| 926 | 926 | ecrire_fichier($cache, serialize($path_parts)); |
| 927 | 927 | } |
| 928 | 928 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 929 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 929 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 930 | 930 | return nom_fichier_copie_locale($source, $ext); |
| 931 | 931 | } |
| 932 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 932 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | } else { |
| 1014 | 1014 | if ($a['body']) { |
| 1015 | 1015 | $a['extension'] = $extension; |
| 1016 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1016 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1017 | 1017 | ecrire_fichier($a['fichier'], $a['body']); |
| 1018 | 1018 | $size_image = @spip_getimagesize($a['fichier']); |
| 1019 | 1019 | $a['largeur'] = intval($size_image[0]); |
@@ -1081,20 +1081,20 @@ discard block |
||
| 1081 | 1081 | !$t |
| 1082 | 1082 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1083 | 1083 | ) { |
| 1084 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1084 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | if ( |
| 1087 | 1087 | !$t |
| 1088 | 1088 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1089 | 1089 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1090 | 1090 | ) { |
| 1091 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1091 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1096 | 1096 | if (!$t) { |
| 1097 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1097 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1105,11 +1105,11 @@ discard block |
||
| 1105 | 1105 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1106 | 1106 | ) { |
| 1107 | 1107 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1108 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1108 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text')); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | if ($t) { |
| 1112 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1112 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1113 | 1113 | return $t['extension']; |
| 1114 | 1114 | } else { |
| 1115 | 1115 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | } |
| 1213 | 1213 | } else { |
| 1214 | 1214 | $scheme = $t['scheme']; |
| 1215 | - $noproxy = $scheme . '://'; |
|
| 1215 | + $noproxy = $scheme.'://'; |
|
| 1216 | 1216 | } |
| 1217 | 1217 | if (isset($t['user'])) { |
| 1218 | 1218 | $user = [$t['user'], $t['pass']]; |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | if (!empty($t['query'])) { |
| 1229 | - $path .= '?' . $t['query']; |
|
| 1229 | + $path .= '?'.$t['query']; |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1300,29 +1300,29 @@ discard block |
||
| 1300 | 1300 | $proxy_user = ''; |
| 1301 | 1301 | $http_proxy = need_proxy($host); |
| 1302 | 1302 | if ($user) { |
| 1303 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1303 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | $connect = ''; |
| 1307 | 1307 | if ($http_proxy) { |
| 1308 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) { |
|
| 1309 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1310 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1308 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) { |
|
| 1309 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1310 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1311 | 1311 | . "Host: $path_host\r\n" |
| 1312 | 1312 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1313 | 1313 | } else { |
| 1314 | - $path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://") |
|
| 1314 | + $path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://") |
|
| 1315 | 1315 | . (!$user ? '' : "$user@") |
| 1316 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1316 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1317 | 1317 | } |
| 1318 | 1318 | $t2 = @parse_url($http_proxy); |
| 1319 | 1319 | $first_host = $t2['host']; |
| 1320 | 1320 | $port = ($t2['port'] ?? null) ?: 80; |
| 1321 | 1321 | if ($t2['user'] ?? null) { |
| 1322 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1322 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1323 | 1323 | } |
| 1324 | 1324 | } else { |
| 1325 | - $first_host = $noproxy . $host; |
|
| 1325 | + $first_host = $noproxy.$host; |
|
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | if ($connect) { |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | ); |
| 1345 | 1345 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1346 | 1346 | if (!$f) { |
| 1347 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1347 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1348 | 1348 | return $errno; |
| 1349 | 1349 | } |
| 1350 | 1350 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | or !count($res = explode(' ', $res)) |
| 1358 | 1358 | or $res[1] !== '200' |
| 1359 | 1359 | ) { |
| 1360 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1360 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1361 | 1361 | fclose($f); |
| 1362 | 1362 | |
| 1363 | 1363 | return false; |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1375 | 1375 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1376 | 1376 | if (!$f) { |
| 1377 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1377 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1378 | 1378 | |
| 1379 | 1379 | return $errno; |
| 1380 | 1380 | } |
@@ -1384,16 +1384,16 @@ discard block |
||
| 1384 | 1384 | $site = $GLOBALS['meta']['adresse_site'] ?? ''; |
| 1385 | 1385 | |
| 1386 | 1386 | $host_port = $host; |
| 1387 | - if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) { |
|
| 1387 | + if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) { |
|
| 1388 | 1388 | $host_port .= ":$port"; |
| 1389 | 1389 | } |
| 1390 | 1390 | $req = "$method $path $vers\r\n" |
| 1391 | 1391 | . "Host: $host_port\r\n" |
| 1392 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1393 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1392 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1393 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1394 | 1394 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1395 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1396 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1395 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1396 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1397 | 1397 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1398 | 1398 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1399 | 1399 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | include_fichiers_fonctions(); |
| 99 | - foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) { |
|
| 99 | + foreach (['filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc] as $f) { |
|
| 100 | 100 | trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels |
| 101 | 101 | // fonction ou name\space\fonction |
| 102 | 102 | if (is_callable($f)) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // affichage "GIT [master: abcdef]" |
| 240 | 240 | $commit = $desc['commit_short'] ?? $desc['commit']; |
| 241 | 241 | if ($desc['branch']) { |
| 242 | - $commit = $desc['branch'] . ': ' . $commit; |
|
| 242 | + $commit = $desc['branch'].': '.$commit; |
|
| 243 | 243 | } |
| 244 | 244 | return "{$desc['vcs']} [$commit]"; |
| 245 | 245 | } |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // version installee par GIT |
| 261 | - if (lire_fichier($dir . '/.git/HEAD', $c)) { |
|
| 261 | + if (lire_fichier($dir.'/.git/HEAD', $c)) { |
|
| 262 | 262 | $currentHead = trim(substr($c, 4)); |
| 263 | - if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) { |
|
| 263 | + if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) { |
|
| 264 | 264 | return [ |
| 265 | 265 | 'vcs' => 'GIT', |
| 266 | 266 | 'branch' => basename($currentHead), |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | $dir = '.'; |
| 288 | 288 | } |
| 289 | 289 | // version installee par SVN |
| 290 | - if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) { |
|
| 291 | - $db = new SQLite3($dir . '/.svn/wc.db'); |
|
| 290 | + if (file_exists($dir.'/.svn/wc.db') && class_exists(\SQLite3::class)) { |
|
| 291 | + $db = new SQLite3($dir.'/.svn/wc.db'); |
|
| 292 | 292 | $result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1'); |
| 293 | 293 | if ($result) { |
| 294 | 294 | $row = $result->fetchArray(); |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images |
| 308 | 308 | // et laisser passer les fonctions personnelles baptisees image_... |
| 309 | -$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php'; |
|
| 310 | -$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php'; |
|
| 311 | -$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php'; |
|
| 312 | -$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php'; |
|
| 313 | -$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php'; |
|
| 314 | -$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php'; |
|
| 309 | +$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php'; |
|
| 310 | +$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php'; |
|
| 311 | +$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php'; |
|
| 312 | +$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php'; |
|
| 313 | +$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php'; |
|
| 314 | +$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php'; |
|
| 315 | 315 | |
| 316 | 316 | $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php'; |
| 317 | 317 | $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php'; |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | function filtre_debug($val, $key = null) { |
| 472 | 472 | $debug = ( |
| 473 | - is_null($key) ? '' : (var_export($key, true) . ' = ') |
|
| 474 | - ) . var_export($val, true); |
|
| 473 | + is_null($key) ? '' : (var_export($key, true).' = ') |
|
| 474 | + ).var_export($val, true); |
|
| 475 | 475 | |
| 476 | 476 | include_spip('inc/autoriser'); |
| 477 | 477 | if (autoriser('webmestre')) { |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | $is_file = false; |
| 526 | 526 | } |
| 527 | 527 | if ($is_file) { |
| 528 | - $is_local_file = function ($path) { |
|
| 528 | + $is_local_file = function($path) { |
|
| 529 | 529 | if (strpos($path, '?') !== false) { |
| 530 | 530 | $path = supprimer_timestamp($path); |
| 531 | 531 | // remove ?24px added by find_in_theme on .svg files |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) { |
| 578 | 578 | $srcover = $match[1]; |
| 579 | 579 | array_shift($args); |
| 580 | - array_unshift($args, "<img src='" . $match[1] . "' />"); |
|
| 580 | + array_unshift($args, "<img src='".$match[1]."' />"); |
|
| 581 | 581 | $srcover_filter = call_user_func_array($filtre, $args); |
| 582 | 582 | $srcover_filter = extraire_attribut($srcover_filter, 'src'); |
| 583 | 583 | $reduit = str_replace($srcover, $srcover_filter, $reduit); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | if (!$srcHeight) { |
| 654 | 654 | $hauteur_img[$src] = $srcHeight = $imagesize[1]; |
| 655 | 655 | } |
| 656 | - if (!$srcSize){ |
|
| 656 | + if (!$srcSize) { |
|
| 657 | 657 | $poids_img[$src] = filesize($src); |
| 658 | 658 | } |
| 659 | 659 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | if (!$srcHeight) { |
| 668 | 668 | $hauteur_img[$src] = $srcHeight = $height; |
| 669 | 669 | } |
| 670 | - if (!$srcSize){ |
|
| 670 | + if (!$srcSize) { |
|
| 671 | 671 | $poids_img[$src] = $srcSize = strlen($src); |
| 672 | 672 | } |
| 673 | 673 | } |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | if (!$srcHeight) { |
| 686 | 686 | $hauteur_img[$src] = $srcHeight = $valeurs['hauteur_dest']; |
| 687 | 687 | } |
| 688 | - if (!$srcSize){ |
|
| 688 | + if (!$srcSize) { |
|
| 689 | 689 | $poids_img[$src] = $srcSize = 0; |
| 690 | 690 | } |
| 691 | 691 | } |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | return $infos['poids']; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | -function taille_image($img, $force_refresh = false){ |
|
| 714 | +function taille_image($img, $force_refresh = false) { |
|
| 715 | 715 | $infos = infos_image($img, $force_refresh); |
| 716 | 716 | return [$infos['hauteur'], $infos['largeur']]; |
| 717 | 717 | } |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | // " -> " et tout ce genre de choses |
| 981 | 981 | $u = $GLOBALS['meta']['pcre_u']; |
| 982 | 982 | $texte = str_replace(' ', ' ', $texte); |
| 983 | - $texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte); |
|
| 983 | + $texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte); |
|
| 984 | 984 | // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal |
| 985 | 985 | $texte = entites_html($texte, false, false); |
| 986 | 986 | // mais bien echapper les double quotes ! |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | **/ |
| 1041 | 1041 | function supprimer_numero($texte) { |
| 1042 | 1042 | return preg_replace( |
| 1043 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1043 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1044 | 1044 | '', |
| 1045 | 1045 | $texte |
| 1046 | 1046 | ); |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | function recuperer_numero($texte) { |
| 1069 | 1069 | if ( |
| 1070 | 1070 | preg_match( |
| 1071 | - ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S', |
|
| 1071 | + ',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S', |
|
| 1072 | 1072 | $texte, |
| 1073 | 1073 | $regs |
| 1074 | 1074 | ) |
@@ -1159,8 +1159,8 @@ discard block |
||
| 1159 | 1159 | **/ |
| 1160 | 1160 | function textebrut($texte) { |
| 1161 | 1161 | $u = $GLOBALS['meta']['pcre_u']; |
| 1162 | - $texte = preg_replace('/\s+/S' . $u, ' ', $texte); |
|
| 1163 | - $texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte); |
|
| 1162 | + $texte = preg_replace('/\s+/S'.$u, ' ', $texte); |
|
| 1163 | + $texte = preg_replace('/<(p|br)( [^>]*)?'.'>/iS', "\n\n", $texte); |
|
| 1164 | 1164 | $texte = preg_replace("/^\n+/", '', $texte); |
| 1165 | 1165 | $texte = preg_replace("/\n+$/", '', $texte); |
| 1166 | 1166 | $texte = preg_replace("/\n +/", "\n", $texte); |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | ) |
| 1195 | 1195 | ) { |
| 1196 | 1196 | foreach ($liens[0] as $a) { |
| 1197 | - $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel'); |
|
| 1197 | + $rel = 'noopener noreferrer '.extraire_attribut($a, 'rel'); |
|
| 1198 | 1198 | $ablank = inserer_attribut($a, 'rel', $rel); |
| 1199 | 1199 | $ablank = inserer_attribut($ablank, 'target', '_blank'); |
| 1200 | 1200 | $texte = str_replace($a, $ablank, $texte); |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | foreach ($regs[0] as $a) { |
| 1220 | 1220 | $rel = extraire_attribut($a, 'rel') ?? ''; |
| 1221 | 1221 | if (strpos($rel, 'nofollow') === false) { |
| 1222 | - $rel = 'nofollow' . ($rel ? " $rel" : ''); |
|
| 1222 | + $rel = 'nofollow'.($rel ? " $rel" : ''); |
|
| 1223 | 1223 | $anofollow = inserer_attribut($a, 'rel', $rel); |
| 1224 | 1224 | $texte = str_replace($a, $anofollow, $texte); |
| 1225 | 1225 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | $u = $GLOBALS['meta']['pcre_u']; |
| 1249 | 1249 | $texte = preg_replace('@</p>@iS', "\n", $texte); |
| 1250 | 1250 | $texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte); |
| 1251 | - $texte = preg_replace('@^\s*<br />@S' . $u, '', $texte); |
|
| 1251 | + $texte = preg_replace('@^\s*<br />@S'.$u, '', $texte); |
|
| 1252 | 1252 | |
| 1253 | 1253 | return $texte; |
| 1254 | 1254 | } |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | return $texte; |
| 1280 | 1280 | } |
| 1281 | 1281 | include_spip('inc/texte'); |
| 1282 | - $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ? |
|
| 1282 | + $tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ? |
|
| 1283 | 1283 | 'div' : 'span'; |
| 1284 | 1284 | |
| 1285 | 1285 | return "<$tag style='word-wrap:break-word;'>$texte</$tag>"; |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | } |
| 1392 | 1392 | $u = $GLOBALS['meta']['pcre_u']; |
| 1393 | 1393 | if ($textebrut) { |
| 1394 | - $texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte)); |
|
| 1394 | + $texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte)); |
|
| 1395 | 1395 | } |
| 1396 | 1396 | $texte = texte_backend($texte); |
| 1397 | 1397 | $texte = str_replace(["'", '"'], [''', '"'], $texte); |
@@ -1426,7 +1426,7 @@ discard block |
||
| 1426 | 1426 | # un message pour abs_url |
| 1427 | 1427 | $GLOBALS['mode_abs_url'] = 'url'; |
| 1428 | 1428 | $url = trim($url); |
| 1429 | - $r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS'; |
|
| 1429 | + $r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS'; |
|
| 1430 | 1430 | |
| 1431 | 1431 | return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url); |
| 1432 | 1432 | } |
@@ -1626,14 +1626,14 @@ discard block |
||
| 1626 | 1626 | if (strpos($texte, '<') !== false) { |
| 1627 | 1627 | include_spip('inc/lien'); |
| 1628 | 1628 | if (defined('_PREG_MODELE')) { |
| 1629 | - $preg_modeles = '@' . _PREG_MODELE . '@imsS'; |
|
| 1629 | + $preg_modeles = '@'._PREG_MODELE.'@imsS'; |
|
| 1630 | 1630 | $texte = echappe_html($texte, '', true, $preg_modeles); |
| 1631 | 1631 | } |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | $debut = ''; |
| 1635 | 1635 | $suite = $texte; |
| 1636 | - while ($t = strpos('-' . $suite, "\n", 1)) { |
|
| 1636 | + while ($t = strpos('-'.$suite, "\n", 1)) { |
|
| 1637 | 1637 | $debut .= substr($suite, 0, $t - 1); |
| 1638 | 1638 | $suite = substr($suite, $t); |
| 1639 | 1639 | $car = substr($suite, 0, 1); |
@@ -1651,11 +1651,11 @@ discard block |
||
| 1651 | 1651 | $suite = substr($suite, strlen($regs[0])); |
| 1652 | 1652 | } |
| 1653 | 1653 | } |
| 1654 | - $texte = $debut . $suite; |
|
| 1654 | + $texte = $debut.$suite; |
|
| 1655 | 1655 | |
| 1656 | 1656 | $texte = echappe_retour($texte); |
| 1657 | 1657 | |
| 1658 | - return $texte . $fin; |
|
| 1658 | + return $texte.$fin; |
|
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | } |
| 1718 | 1718 | |
| 1719 | 1719 | foreach ($regs as $reg) { |
| 1720 | - $cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2]; |
|
| 1720 | + $cle = ($reg[1] ? $reg[1].':' : '').$reg[2]; |
|
| 1721 | 1721 | $desc = $traduire($cle, $lang, true); |
| 1722 | 1722 | $l = $desc->langue; |
| 1723 | 1723 | // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte. |
@@ -1831,9 +1831,9 @@ discard block |
||
| 1831 | 1831 | // il ne faut pas echapper en div si propre produit un seul paragraphe |
| 1832 | 1832 | include_spip('inc/texte'); |
| 1833 | 1833 | $trad_propre = preg_replace(',(^<p[^>]*>|</p>$),Uims', '', propre($trad)); |
| 1834 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1834 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; |
|
| 1835 | 1835 | if ($mode === 'div') { |
| 1836 | - $trad = rtrim($trad) . "\n\n"; |
|
| 1836 | + $trad = rtrim($trad)."\n\n"; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | $trad = code_echappement($trad, 'multi', false, $mode); |
| 1839 | 1839 | $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); |
@@ -2029,7 +2029,7 @@ discard block |
||
| 2029 | 2029 | if (is_array($balise)) { |
| 2030 | 2030 | array_walk( |
| 2031 | 2031 | $balise, |
| 2032 | - function (&$a, $key, $t) { |
|
| 2032 | + function(&$a, $key, $t) { |
|
| 2033 | 2033 | $a = extraire_attribut($a, $t); |
| 2034 | 2034 | }, |
| 2035 | 2035 | $attribut |
@@ -2126,14 +2126,14 @@ discard block |
||
| 2126 | 2126 | |
| 2127 | 2127 | if ($old !== null) { |
| 2128 | 2128 | // Remplacer l'ancien attribut du meme nom |
| 2129 | - $balise = $r[1] . $insert . $r[5]; |
|
| 2129 | + $balise = $r[1].$insert.$r[5]; |
|
| 2130 | 2130 | } else { |
| 2131 | 2131 | // preferer une balise " />" (comme <img />) |
| 2132 | 2132 | if (preg_match(',/>,', $balise)) { |
| 2133 | - $balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1); |
|
| 2133 | + $balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1); |
|
| 2134 | 2134 | } // sinon une balise <a ...> ... </a> |
| 2135 | 2135 | else { |
| 2136 | - $balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1); |
|
| 2136 | + $balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1); |
|
| 2137 | 2137 | } |
| 2138 | 2138 | } |
| 2139 | 2139 | |
@@ -2188,7 +2188,7 @@ discard block |
||
| 2188 | 2188 | if ( |
| 2189 | 2189 | $class_courante |
| 2190 | 2190 | and strpos($class_courante, (string) $c) !== false |
| 2191 | - and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante) |
|
| 2191 | + and preg_match('/(^|\s)'.preg_quote($c).'($|\s)/', $class_courante) |
|
| 2192 | 2192 | ) { |
| 2193 | 2193 | $is_class_presente = true; |
| 2194 | 2194 | } |
@@ -2196,12 +2196,12 @@ discard block |
||
| 2196 | 2196 | in_array($operation, ['ajouter', 'commuter']) |
| 2197 | 2197 | and !$is_class_presente |
| 2198 | 2198 | ) { |
| 2199 | - $class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c); |
|
| 2199 | + $class_new = ltrim(rtrim($class_new ?? '').' '.$c); |
|
| 2200 | 2200 | } elseif ( |
| 2201 | 2201 | in_array($operation, ['supprimer', 'commuter']) |
| 2202 | 2202 | and $is_class_presente |
| 2203 | 2203 | ) { |
| 2204 | - $class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new)); |
|
| 2204 | + $class_new = trim(preg_replace('/(^|\s)'.preg_quote($c).'($|\s)/', "\\1", $class_new)); |
|
| 2205 | 2205 | } |
| 2206 | 2206 | } |
| 2207 | 2207 | |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | // Quelques fonctions de calcul arithmetique |
| 2265 | 2265 | // |
| 2266 | 2266 | function floatstr($a) { |
| 2267 | - return str_replace(',', '.', (string)floatval($a)); |
|
| 2267 | + return str_replace(',', '.', (string) floatval($a)); |
|
| 2268 | 2268 | } |
| 2269 | 2269 | function strize($f, $a, $b) { |
| 2270 | 2270 | return floatstr($f(floatstr($a), floatstr($b))); |
@@ -2400,13 +2400,13 @@ discard block |
||
| 2400 | 2400 | if (!defined('_TAGS_NOM_AUTEUR')) { |
| 2401 | 2401 | define('_TAGS_NOM_AUTEUR', ''); |
| 2402 | 2402 | } |
| 2403 | - $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR)); |
|
| 2403 | + $tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR)); |
|
| 2404 | 2404 | foreach ($tags_acceptes as $tag) { |
| 2405 | 2405 | if (strlen($tag)) { |
| 2406 | - $remp1[] = '<' . trim($tag) . '>'; |
|
| 2407 | - $remp1[] = '</' . trim($tag) . '>'; |
|
| 2408 | - $remp2[] = '\x60' . trim($tag) . '\x61'; |
|
| 2409 | - $remp2[] = '\x60/' . trim($tag) . '\x61'; |
|
| 2406 | + $remp1[] = '<'.trim($tag).'>'; |
|
| 2407 | + $remp1[] = '</'.trim($tag).'>'; |
|
| 2408 | + $remp2[] = '\x60'.trim($tag).'\x61'; |
|
| 2409 | + $remp2[] = '\x60/'.trim($tag).'\x61'; |
|
| 2410 | 2410 | } |
| 2411 | 2411 | } |
| 2412 | 2412 | $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom))); |
@@ -2460,7 +2460,7 @@ discard block |
||
| 2460 | 2460 | . http_img_pack( |
| 2461 | 2461 | 'attachment-16.png', |
| 2462 | 2462 | $t, |
| 2463 | - 'title="' . attribut_html($t) . '"' |
|
| 2463 | + 'title="'.attribut_html($t).'"' |
|
| 2464 | 2464 | ) |
| 2465 | 2465 | . '</a>', |
| 2466 | 2466 | $tag |
@@ -2524,10 +2524,10 @@ discard block |
||
| 2524 | 2524 | $fichier = basename($url); |
| 2525 | 2525 | |
| 2526 | 2526 | return '<a rel="enclosure"' |
| 2527 | - . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2528 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2529 | - . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '') |
|
| 2530 | - . '>' . $fichier . '</a>'; |
|
| 2527 | + . ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2528 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2529 | + . ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '') |
|
| 2530 | + . '>'.$fichier.'</a>'; |
|
| 2531 | 2531 | } |
| 2532 | 2532 | |
| 2533 | 2533 | /** |
@@ -2555,9 +2555,9 @@ discard block |
||
| 2555 | 2555 | } # vieux data |
| 2556 | 2556 | $fichier = basename($url); |
| 2557 | 2557 | $enclosures[] = '<enclosure' |
| 2558 | - . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '') |
|
| 2559 | - . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '') |
|
| 2560 | - . ($length ? ' length="' . $length . '"' : '') |
|
| 2558 | + . ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '') |
|
| 2559 | + . ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '') |
|
| 2560 | + . ($length ? ' length="'.$length.'"' : '') |
|
| 2561 | 2561 | . ' />'; |
| 2562 | 2562 | } |
| 2563 | 2563 | } |
@@ -2583,7 +2583,7 @@ discard block |
||
| 2583 | 2583 | if (extraire_attribut($e, 'rel') == 'tag') { |
| 2584 | 2584 | $subjects .= '<dc:subject>' |
| 2585 | 2585 | . texte_backend(textebrut($e)) |
| 2586 | - . '</dc:subject>' . "\n"; |
|
| 2586 | + . '</dc:subject>'."\n"; |
|
| 2587 | 2587 | } |
| 2588 | 2588 | } |
| 2589 | 2589 | |
@@ -2619,7 +2619,7 @@ discard block |
||
| 2619 | 2619 | if (is_array($texte)) { |
| 2620 | 2620 | array_walk( |
| 2621 | 2621 | $texte, |
| 2622 | - function (&$a, $key, $t) { |
|
| 2622 | + function(&$a, $key, $t) { |
|
| 2623 | 2623 | $a = extraire_balise($a, $t); |
| 2624 | 2624 | }, |
| 2625 | 2625 | $tag |
@@ -2667,7 +2667,7 @@ discard block |
||
| 2667 | 2667 | if (is_array($texte)) { |
| 2668 | 2668 | array_walk( |
| 2669 | 2669 | $texte, |
| 2670 | - function (&$a, $key, $t) { |
|
| 2670 | + function(&$a, $key, $t) { |
|
| 2671 | 2671 | $a = extraire_balises($a, $t); |
| 2672 | 2672 | }, |
| 2673 | 2673 | $tag |
@@ -2800,7 +2800,7 @@ discard block |
||
| 2800 | 2800 | if ($fond != '404') { |
| 2801 | 2801 | $contexte = array_shift($p); |
| 2802 | 2802 | $contexte['page'] = $fond; |
| 2803 | - $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2803 | + $action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action); |
|
| 2804 | 2804 | } |
| 2805 | 2805 | } |
| 2806 | 2806 | // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url |
@@ -2855,9 +2855,9 @@ discard block |
||
| 2855 | 2855 | . '"' |
| 2856 | 2856 | . (is_null($val) |
| 2857 | 2857 | ? '' |
| 2858 | - : ' value="' . entites_html($val) . '"' |
|
| 2858 | + : ' value="'.entites_html($val).'"' |
|
| 2859 | 2859 | ) |
| 2860 | - . ' type="hidden"' . "\n/>"; |
|
| 2860 | + . ' type="hidden"'."\n/>"; |
|
| 2861 | 2861 | } |
| 2862 | 2862 | |
| 2863 | 2863 | return join('', $hidden); |
@@ -2967,7 +2967,7 @@ discard block |
||
| 2967 | 2967 | |
| 2968 | 2968 | return preg_replace_callback( |
| 2969 | 2969 | ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims", |
| 2970 | - fn($x) => "url('" . suivre_lien($path, $x[1]) . "')", |
|
| 2970 | + fn($x) => "url('".suivre_lien($path, $x[1])."')", |
|
| 2971 | 2971 | $contenu |
| 2972 | 2972 | ); |
| 2973 | 2973 | } |
@@ -3028,14 +3028,14 @@ discard block |
||
| 3028 | 3028 | ) { |
| 3029 | 3029 | $distant = true; |
| 3030 | 3030 | $cssf = parse_url($css); |
| 3031 | - $cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : ''); |
|
| 3031 | + $cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : ''); |
|
| 3032 | 3032 | $cssf = preg_replace(',[?:&=],', '_', $cssf); |
| 3033 | 3033 | } else { |
| 3034 | 3034 | $distant = false; |
| 3035 | 3035 | $cssf = $css; |
| 3036 | 3036 | // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi |
| 3037 | 3037 | //propose (rien a faire dans ce cas) |
| 3038 | - $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css); |
|
| 3038 | + $f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css); |
|
| 3039 | 3039 | if (@file_exists($f)) { |
| 3040 | 3040 | return $f; |
| 3041 | 3041 | } |
@@ -3045,7 +3045,7 @@ discard block |
||
| 3045 | 3045 | $dir_var = sous_repertoire(_DIR_VAR, 'cache-css'); |
| 3046 | 3046 | $f = $dir_var |
| 3047 | 3047 | . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf) |
| 3048 | - . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css'; |
|
| 3048 | + . '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css'; |
|
| 3049 | 3049 | |
| 3050 | 3050 | // la css peut etre distante (url absolue !) |
| 3051 | 3051 | if ($distant) { |
@@ -3091,8 +3091,8 @@ discard block |
||
| 3091 | 3091 | } // si la css_direction commence par $dir_var on la fait passer pour une absolue |
| 3092 | 3092 | elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) { |
| 3093 | 3093 | $css_direction = substr($css_direction, strlen($dir_var)); |
| 3094 | - $src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction; |
|
| 3095 | - $css_direction = '/@@@@@@/' . $css_direction; |
|
| 3094 | + $src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction; |
|
| 3095 | + $css_direction = '/@@@@@@/'.$css_direction; |
|
| 3096 | 3096 | } |
| 3097 | 3097 | $src[] = $regs[0][$k]; |
| 3098 | 3098 | $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]); |
@@ -3141,7 +3141,7 @@ discard block |
||
| 3141 | 3141 | |
| 3142 | 3142 | $f = basename($css, '.css'); |
| 3143 | 3143 | $f = sous_repertoire(_DIR_VAR, 'cache-css') |
| 3144 | - . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f) |
|
| 3144 | + . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f) |
|
| 3145 | 3145 | . '.css'; |
| 3146 | 3146 | |
| 3147 | 3147 | if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) { |
@@ -3151,7 +3151,7 @@ discard block |
||
| 3151 | 3151 | if ($url_absolue_css == $css) { |
| 3152 | 3152 | if ( |
| 3153 | 3153 | strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0 |
| 3154 | - or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu) |
|
| 3154 | + or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu) |
|
| 3155 | 3155 | ) { |
| 3156 | 3156 | include_spip('inc/distant'); |
| 3157 | 3157 | $contenu = recuperer_url($css); |
@@ -3263,7 +3263,7 @@ discard block |
||
| 3263 | 3263 | $expression = str_replace('\/', '/', $expression); |
| 3264 | 3264 | $expression = str_replace('/', '\/', $expression); |
| 3265 | 3265 | |
| 3266 | - if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) { |
|
| 3266 | + if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) { |
|
| 3267 | 3267 | if (isset($r[$capte])) { |
| 3268 | 3268 | return $r[$capte]; |
| 3269 | 3269 | } else { |
@@ -3301,7 +3301,7 @@ discard block |
||
| 3301 | 3301 | $expression = str_replace('\/', '/', $expression); |
| 3302 | 3302 | $expression = str_replace('/', '\/', $expression); |
| 3303 | 3303 | |
| 3304 | - return preg_replace('/' . $expression . '/' . $modif, $replace, $texte); |
|
| 3304 | + return preg_replace('/'.$expression.'/'.$modif, $replace, $texte); |
|
| 3305 | 3305 | } |
| 3306 | 3306 | |
| 3307 | 3307 | |
@@ -3320,7 +3320,7 @@ discard block |
||
| 3320 | 3320 | function traiter_doublons_documents(&$doublons, $letexte) { |
| 3321 | 3321 | |
| 3322 | 3322 | // Verifier dans le texte & les notes (pas beau, helas) |
| 3323 | - $t = $letexte . $GLOBALS['les_notes']; |
|
| 3323 | + $t = $letexte.$GLOBALS['les_notes']; |
|
| 3324 | 3324 | |
| 3325 | 3325 | if ( |
| 3326 | 3326 | strstr($t, 'spip_document_') // evite le preg_match_all si inutile |
@@ -3334,7 +3334,7 @@ discard block |
||
| 3334 | 3334 | if (!isset($doublons['documents'])) { |
| 3335 | 3335 | $doublons['documents'] = ''; |
| 3336 | 3336 | } |
| 3337 | - $doublons['documents'] .= ',' . join(',', $matches[1]); |
|
| 3337 | + $doublons['documents'] .= ','.join(',', $matches[1]); |
|
| 3338 | 3338 | } |
| 3339 | 3339 | |
| 3340 | 3340 | return $letexte; |
@@ -3391,7 +3391,7 @@ discard block |
||
| 3391 | 3391 | if ($env) { |
| 3392 | 3392 | foreach ($env as $i => $j) { |
| 3393 | 3393 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3394 | - $texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />"; |
|
| 3394 | + $texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />"; |
|
| 3395 | 3395 | } |
| 3396 | 3396 | } |
| 3397 | 3397 | } |
@@ -3430,7 +3430,7 @@ discard block |
||
| 3430 | 3430 | if ($env) { |
| 3431 | 3431 | foreach ($env as $i => $j) { |
| 3432 | 3432 | if (is_string($j) and !in_array($i, $ignore_params)) { |
| 3433 | - $texte .= attribut_html($i) . "='" . attribut_html($j) . "' "; |
|
| 3433 | + $texte .= attribut_html($i)."='".attribut_html($j)."' "; |
|
| 3434 | 3434 | } |
| 3435 | 3435 | } |
| 3436 | 3436 | } |
@@ -3504,10 +3504,10 @@ discard block |
||
| 3504 | 3504 | // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png |
| 3505 | 3505 | if ( |
| 3506 | 3506 | preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m) |
| 3507 | - and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg' |
|
| 3507 | + and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg' |
|
| 3508 | 3508 | and file_exists($variante_svg_generique) |
| 3509 | 3509 | ) { |
| 3510 | - if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) { |
|
| 3510 | + if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg' and file_exists($variante_svg_size)) { |
|
| 3511 | 3511 | $img_file = $variante_svg_size; |
| 3512 | 3512 | } |
| 3513 | 3513 | else { |
@@ -3565,7 +3565,7 @@ discard block |
||
| 3565 | 3565 | return ''; |
| 3566 | 3566 | } |
| 3567 | 3567 | } |
| 3568 | - $atts .= " width='" . $largeur . "' height='" . $hauteur . "'"; |
|
| 3568 | + $atts .= " width='".$largeur."' height='".$hauteur."'"; |
|
| 3569 | 3569 | } |
| 3570 | 3570 | |
| 3571 | 3571 | if (file_exists($img_file)) { |
@@ -3575,14 +3575,14 @@ discard block |
||
| 3575 | 3575 | $alt = ''; |
| 3576 | 3576 | } |
| 3577 | 3577 | elseif ($alt or $alt === '') { |
| 3578 | - $alt = " alt='" . attribut_html($alt) . "'"; |
|
| 3578 | + $alt = " alt='".attribut_html($alt)."'"; |
|
| 3579 | 3579 | } |
| 3580 | 3580 | else { |
| 3581 | - $alt = " alt='" . attribut_html($title) . "'"; |
|
| 3581 | + $alt = " alt='".attribut_html($title)."'"; |
|
| 3582 | 3582 | } |
| 3583 | 3583 | return "<img src='$img_file'$alt" |
| 3584 | - . ($title ? ' title="' . attribut_html($title) . '"' : '') |
|
| 3585 | - . ' ' . ltrim($atts) |
|
| 3584 | + . ($title ? ' title="'.attribut_html($title).'"' : '') |
|
| 3585 | + . ' '.ltrim($atts) |
|
| 3586 | 3586 | . ' />'; |
| 3587 | 3587 | } |
| 3588 | 3588 | |
@@ -3596,10 +3596,10 @@ discard block |
||
| 3596 | 3596 | */ |
| 3597 | 3597 | function http_style_background($img, $att = '', $size = null) { |
| 3598 | 3598 | if ($size and is_numeric($size)) { |
| 3599 | - $size = trim($size) . 'px'; |
|
| 3599 | + $size = trim($size).'px'; |
|
| 3600 | 3600 | } |
| 3601 | - return " style='background" . |
|
| 3602 | - ($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';' |
|
| 3601 | + return " style='background". |
|
| 3602 | + ($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';' |
|
| 3603 | 3603 | . ($size ? "background-size:{$size};" : '') |
| 3604 | 3604 | . "'"; |
| 3605 | 3605 | } |
@@ -3714,7 +3714,7 @@ discard block |
||
| 3714 | 3714 | $img = http_img_pack( |
| 3715 | 3715 | $img, |
| 3716 | 3716 | $alt, |
| 3717 | - $class ? " class='" . attribut_html($class) . "'" : '', |
|
| 3717 | + $class ? " class='".attribut_html($class)."'" : '', |
|
| 3718 | 3718 | '', |
| 3719 | 3719 | ['chemin_image' => false, 'utiliser_suffixe_size' => false] |
| 3720 | 3720 | ); |
@@ -3799,7 +3799,7 @@ discard block |
||
| 3799 | 3799 | $balise_svg_source = $balise_svg; |
| 3800 | 3800 | |
| 3801 | 3801 | // entete XML à supprimer |
| 3802 | - $svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg); |
|
| 3802 | + $svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg); |
|
| 3803 | 3803 | |
| 3804 | 3804 | // IE est toujours mon ami |
| 3805 | 3805 | $balise_svg = inserer_attribut($balise_svg, 'focusable', 'false'); |
@@ -3817,9 +3817,9 @@ discard block |
||
| 3817 | 3817 | // regler le alt |
| 3818 | 3818 | if ($alt) { |
| 3819 | 3819 | $balise_svg = inserer_attribut($balise_svg, 'role', 'img'); |
| 3820 | - $id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3820 | + $id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4); |
|
| 3821 | 3821 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3822 | - $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n"; |
|
| 3822 | + $title = "<title id=\"$id\">".entites_html($alt)."</title>\n"; |
|
| 3823 | 3823 | $balise_svg .= $title; |
| 3824 | 3824 | } |
| 3825 | 3825 | else { |
@@ -3867,7 +3867,7 @@ discard block |
||
| 3867 | 3867 | if (is_array($tableau)) { |
| 3868 | 3868 | foreach ($tableau as $k => $v) { |
| 3869 | 3869 | $res = recuperer_fond( |
| 3870 | - 'modeles/' . $modele, |
|
| 3870 | + 'modeles/'.$modele, |
|
| 3871 | 3871 | array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v])) |
| 3872 | 3872 | ); |
| 3873 | 3873 | $texte .= $res; |
@@ -4052,7 +4052,7 @@ discard block |
||
| 4052 | 4052 | } |
| 4053 | 4053 | |
| 4054 | 4054 | $c = serialize($c); |
| 4055 | - $cle = calculer_cle_action($form . $c); |
|
| 4055 | + $cle = calculer_cle_action($form.$c); |
|
| 4056 | 4056 | $c = "$cle:$c"; |
| 4057 | 4057 | |
| 4058 | 4058 | // on ne stocke pas les contextes dans des fichiers en cache |
@@ -4110,15 +4110,15 @@ discard block |
||
| 4110 | 4110 | } |
| 4111 | 4111 | // toujours encoder l'url source dans le bloc ajax |
| 4112 | 4112 | $r = self(); |
| 4113 | - $r = ' data-origin="' . $r . '"'; |
|
| 4113 | + $r = ' data-origin="'.$r.'"'; |
|
| 4114 | 4114 | $class = 'ajaxbloc'; |
| 4115 | 4115 | if ($ajaxid and is_string($ajaxid)) { |
| 4116 | 4116 | // ajaxid est normalement conforme a un nom de classe css |
| 4117 | 4117 | // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution |
| 4118 | - $class .= ' ajax-id-' . entites_html($ajaxid); |
|
| 4118 | + $class .= ' ajax-id-'.entites_html($ajaxid); |
|
| 4119 | 4119 | } |
| 4120 | 4120 | |
| 4121 | - return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 4121 | + return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n"; |
|
| 4122 | 4122 | } |
| 4123 | 4123 | |
| 4124 | 4124 | /** |
@@ -4162,7 +4162,7 @@ discard block |
||
| 4162 | 4162 | $cle = substr($c, 0, $p); |
| 4163 | 4163 | $c = substr($c, $p + 1); |
| 4164 | 4164 | |
| 4165 | - if ($cle == calculer_cle_action($form . $c)) { |
|
| 4165 | + if ($cle == calculer_cle_action($form.$c)) { |
|
| 4166 | 4166 | $env = @unserialize($c); |
| 4167 | 4167 | return $env; |
| 4168 | 4168 | } |
@@ -4283,13 +4283,13 @@ discard block |
||
| 4283 | 4283 | } |
| 4284 | 4284 | } |
| 4285 | 4285 | } |
| 4286 | - $att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"'; |
|
| 4286 | + $att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"'; |
|
| 4287 | 4287 | } else { |
| 4288 | 4288 | $bal = 'a'; |
| 4289 | 4289 | $att = "href='$url'" |
| 4290 | - . ($title ? " title='" . attribut_html($title) . "'" : '') |
|
| 4291 | - . ($class ? " class='" . attribut_html($class) . "'" : '') |
|
| 4292 | - . ($rel ? " rel='" . attribut_html($rel) . "'" : '') |
|
| 4290 | + . ($title ? " title='".attribut_html($title)."'" : '') |
|
| 4291 | + . ($class ? " class='".attribut_html($class)."'" : '') |
|
| 4292 | + . ($rel ? " rel='".attribut_html($rel)."'" : '') |
|
| 4293 | 4293 | . $evt; |
| 4294 | 4294 | } |
| 4295 | 4295 | if ($libelle === null) { |
@@ -4428,7 +4428,7 @@ discard block |
||
| 4428 | 4428 | |
| 4429 | 4429 | // Icône |
| 4430 | 4430 | $icone = http_img_pack($fond, $alt, "width='$size' height='$size'"); |
| 4431 | - $icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>"; |
|
| 4431 | + $icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>"; |
|
| 4432 | 4432 | |
| 4433 | 4433 | // Markup final |
| 4434 | 4434 | if ($type == 'lien') { |
@@ -4705,20 +4705,20 @@ discard block |
||
| 4705 | 4705 | $class_form = 'ajax'; |
| 4706 | 4706 | $class = str_replace('ajax', '', $class); |
| 4707 | 4707 | } |
| 4708 | - $class_btn = 'submit ' . trim($class); |
|
| 4708 | + $class_btn = 'submit '.trim($class); |
|
| 4709 | 4709 | |
| 4710 | 4710 | if ($confirm) { |
| 4711 | - $confirm = 'confirm("' . attribut_html($confirm) . '")'; |
|
| 4711 | + $confirm = 'confirm("'.attribut_html($confirm).'")'; |
|
| 4712 | 4712 | if ($callback) { |
| 4713 | 4713 | $callback = "$confirm?($callback):false"; |
| 4714 | 4714 | } else { |
| 4715 | 4715 | $callback = $confirm; |
| 4716 | 4716 | } |
| 4717 | 4717 | } |
| 4718 | - $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : ''; |
|
| 4718 | + $onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : ''; |
|
| 4719 | 4719 | $title = $title ? " title='$title'" : ''; |
| 4720 | 4720 | |
| 4721 | - return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url) |
|
| 4721 | + return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url) |
|
| 4722 | 4722 | . "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>"; |
| 4723 | 4723 | } |
| 4724 | 4724 | |
@@ -4783,14 +4783,14 @@ discard block |
||
| 4783 | 4783 | $champ_titre = ''; |
| 4784 | 4784 | if ($demande_titre) { |
| 4785 | 4785 | // si pas de titre declare mais champ titre, il sera peuple par le select * |
| 4786 | - $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : ''; |
|
| 4786 | + $champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : ''; |
|
| 4787 | 4787 | } |
| 4788 | 4788 | include_spip('base/abstract_sql'); |
| 4789 | 4789 | include_spip('base/connect_sql'); |
| 4790 | 4790 | $objets[$type_objet][$id_objet] = sql_fetsel( |
| 4791 | - '*' . $champ_titre, |
|
| 4791 | + '*'.$champ_titre, |
|
| 4792 | 4792 | $desc['table_sql'], |
| 4793 | - id_table_objet($type_objet) . ' = ' . intval($id_objet) |
|
| 4793 | + id_table_objet($type_objet).' = '.intval($id_objet) |
|
| 4794 | 4794 | ); |
| 4795 | 4795 | |
| 4796 | 4796 | // Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci |
@@ -4883,8 +4883,7 @@ discard block |
||
| 4883 | 4883 | if (isset($ligne_sql['chapo'])) { |
| 4884 | 4884 | $chapo = $ligne_sql['chapo']; |
| 4885 | 4885 | $texte = strlen($descriptif) ? |
| 4886 | - '' : |
|
| 4887 | - "$chapo \n\n $texte"; |
|
| 4886 | + '' : "$chapo \n\n $texte"; |
|
| 4888 | 4887 | } |
| 4889 | 4888 | |
| 4890 | 4889 | // Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur |
@@ -4959,7 +4958,7 @@ discard block |
||
| 4959 | 4958 | return $texte; |
| 4960 | 4959 | } |
| 4961 | 4960 | |
| 4962 | - $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement); |
|
| 4961 | + $traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement); |
|
| 4963 | 4962 | |
| 4964 | 4963 | // Fournir $connect et $Pile[0] au traitement si besoin |
| 4965 | 4964 | $Pile = [0 => $env]; |
@@ -4993,7 +4992,7 @@ discard block |
||
| 4993 | 4992 | } |
| 4994 | 4993 | $url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect); |
| 4995 | 4994 | |
| 4996 | - return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>'; |
|
| 4995 | + return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>'; |
|
| 4997 | 4996 | } |
| 4998 | 4997 | |
| 4999 | 4998 | /** |
@@ -5019,10 +5018,10 @@ discard block |
||
| 5019 | 5018 | function wrap($texte, $wrap) { |
| 5020 | 5019 | $balises = extraire_balises($wrap); |
| 5021 | 5020 | if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) { |
| 5022 | - $texte = $wrap . $texte; |
|
| 5021 | + $texte = $wrap.$texte; |
|
| 5023 | 5022 | $regs = array_reverse($regs[1]); |
| 5024 | - $wrap = '</' . implode('></', $regs) . '>'; |
|
| 5025 | - $texte = $texte . $wrap; |
|
| 5023 | + $wrap = '</'.implode('></', $regs).'>'; |
|
| 5024 | + $texte = $texte.$wrap; |
|
| 5026 | 5025 | } |
| 5027 | 5026 | |
| 5028 | 5027 | return $texte; |
@@ -5053,7 +5052,7 @@ discard block |
||
| 5053 | 5052 | |
| 5054 | 5053 | // caster $u en array si besoin |
| 5055 | 5054 | if (is_object($u)) { |
| 5056 | - $u = (array)$u; |
|
| 5055 | + $u = (array) $u; |
|
| 5057 | 5056 | } |
| 5058 | 5057 | |
| 5059 | 5058 | if (is_array($u)) { |
@@ -5075,7 +5074,7 @@ discard block |
||
| 5075 | 5074 | // sinon on passe a la ligne et on indente |
| 5076 | 5075 | $i_str = str_pad('', $indent, ' '); |
| 5077 | 5076 | foreach ($u as $k => $v) { |
| 5078 | - $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2); |
|
| 5077 | + $out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2); |
|
| 5079 | 5078 | } |
| 5080 | 5079 | |
| 5081 | 5080 | return $out; |
@@ -5129,7 +5128,7 @@ discard block |
||
| 5129 | 5128 | * @return string |
| 5130 | 5129 | */ |
| 5131 | 5130 | function objet_icone($objet, $taille = 24, $class = '') { |
| 5132 | - $icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png'; |
|
| 5131 | + $icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png'; |
|
| 5133 | 5132 | $icone = chemin_image($icone); |
| 5134 | 5133 | $balise_img = charger_filtre('balise_img'); |
| 5135 | 5134 | |
@@ -5155,7 +5154,7 @@ discard block |
||
| 5155 | 5154 | */ |
| 5156 | 5155 | function objet_T($objet, $chaine, $args = [], $options = []) { |
| 5157 | 5156 | $chaine = explode(':', $chaine); |
| 5158 | - if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5157 | + if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) { |
|
| 5159 | 5158 | return $t; |
| 5160 | 5159 | } |
| 5161 | 5160 | $chaine = implode(':', $chaine); |
@@ -5221,7 +5220,7 @@ discard block |
||
| 5221 | 5220 | $cache = recuperer_fond($fond, $contexte, $options, $connect); |
| 5222 | 5221 | |
| 5223 | 5222 | // calculer le nom de la css |
| 5224 | - $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension); |
|
| 5223 | + $dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension); |
|
| 5225 | 5224 | $nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond)); |
| 5226 | 5225 | $contexte_implicite = calculer_contexte_implicite(); |
| 5227 | 5226 | |
@@ -5229,14 +5228,14 @@ discard block |
||
| 5229 | 5228 | // mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu |
| 5230 | 5229 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 5231 | 5230 | if (isset($options['hash_on_content']) and $options['hash_on_content']) { |
| 5232 | - $hash = md5($contexte_implicite['host'] . '::' . $cache); |
|
| 5231 | + $hash = md5($contexte_implicite['host'].'::'.$cache); |
|
| 5233 | 5232 | } |
| 5234 | 5233 | else { |
| 5235 | 5234 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 5236 | 5235 | ksort($contexte); |
| 5237 | - $hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect); |
|
| 5236 | + $hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect); |
|
| 5238 | 5237 | } |
| 5239 | - $filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension"; |
|
| 5238 | + $filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension"; |
|
| 5240 | 5239 | |
| 5241 | 5240 | // mettre a jour le fichier si il n'existe pas |
| 5242 | 5241 | // ou trop ancien |
@@ -5244,8 +5243,8 @@ discard block |
||
| 5244 | 5243 | // et recopie sur le fichier cible uniquement si il change |
| 5245 | 5244 | if ( |
| 5246 | 5245 | !file_exists($filename) |
| 5247 | - or !file_exists($filename . '.last') |
|
| 5248 | - or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified']) |
|
| 5246 | + or !file_exists($filename.'.last') |
|
| 5247 | + or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.'.last') < $cache['lastmodified']) |
|
| 5249 | 5248 | or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') |
| 5250 | 5249 | ) { |
| 5251 | 5250 | $contenu = $cache['texte']; |
@@ -5266,10 +5265,10 @@ discard block |
||
| 5266 | 5265 | } |
| 5267 | 5266 | // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj |
| 5268 | 5267 | // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non |
| 5269 | - $comment .= "}\n md5:" . md5($contenu) . " */\n"; |
|
| 5268 | + $comment .= "}\n md5:".md5($contenu)." */\n"; |
|
| 5270 | 5269 | } |
| 5271 | 5270 | // et ecrire le fichier si il change |
| 5272 | - ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true); |
|
| 5271 | + ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true); |
|
| 5273 | 5272 | } |
| 5274 | 5273 | |
| 5275 | 5274 | return timestamp($filename); |
@@ -5495,7 +5494,7 @@ discard block |
||
| 5495 | 5494 | if ($e > 0 and strlen($mid) > 8) { |
| 5496 | 5495 | $mid = '***...***'; |
| 5497 | 5496 | } |
| 5498 | - return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : ''); |
|
| 5497 | + return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : ''); |
|
| 5499 | 5498 | } |
| 5500 | 5499 | |
| 5501 | 5500 | |
@@ -5557,7 +5556,7 @@ discard block |
||
| 5557 | 5556 | case 'id': |
| 5558 | 5557 | case 'anchor': |
| 5559 | 5558 | if (preg_match(',^\d,', $texte)) { |
| 5560 | - $texte = substr($type, 0, 1) . $texte; |
|
| 5559 | + $texte = substr($type, 0, 1).$texte; |
|
| 5561 | 5560 | } |
| 5562 | 5561 | } |
| 5563 | 5562 | |
@@ -5567,9 +5566,9 @@ discard block |
||
| 5567 | 5566 | |
| 5568 | 5567 | if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) { |
| 5569 | 5568 | if (preg_match(',^\d,', $texte)) { |
| 5570 | - $texte = ($type ? substr($type, 0, 1) : 's') . $texte; |
|
| 5569 | + $texte = ($type ? substr($type, 0, 1) : 's').$texte; |
|
| 5571 | 5570 | } |
| 5572 | - $texte .= $separateur . md5($original); |
|
| 5571 | + $texte .= $separateur.md5($original); |
|
| 5573 | 5572 | $texte = substr($texte, 0, $longueur_mini); |
| 5574 | 5573 | } |
| 5575 | 5574 | |