@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Regarder dans le repertoire local des images TeX et blocs MathML |
| 41 | - if (!@is_dir($dir_tex = _DIR_VAR . 'cache-TeX/')) { |
|
| 41 | + if (!@is_dir($dir_tex = _DIR_VAR.'cache-TeX/')) { |
|
| 42 | 42 | @mkdir($dir_tex, _SPIP_CHMOD); |
| 43 | 43 | } |
| 44 | - $fichier = $dir_tex . md5(trim($tex)) . $ext; |
|
| 44 | + $fichier = $dir_tex.md5(trim($tex)).$ext; |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | if (!@file_exists($fichier)) { |
| 48 | 48 | // Aller chercher l'image sur le serveur |
| 49 | 49 | if ($server) { |
| 50 | - spip_log($url = $server . '?' . rawurlencode($tex)); |
|
| 50 | + spip_log($url = $server.'?'.rawurlencode($tex)); |
|
| 51 | 51 | include_spip('inc/distant'); |
| 52 | 52 | recuperer_page($url, $fichier); |
| 53 | 53 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | return join(file("$fichier"), ""); |
| 64 | 64 | } // TeX |
| 65 | 65 | else { |
| 66 | - list(, , , $size) = @spip_getimagesize($fichier); |
|
| 66 | + list(,,, $size) = @spip_getimagesize($fichier); |
|
| 67 | 67 | $alt = "alt=\"$tex\" title=\"$tex\""; |
| 68 | 68 | |
| 69 | 69 | return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />"; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | if ($defaire_amp) { |
| 127 | 127 | $expression = str_replace('&', '&', $expression); |
| 128 | 128 | } |
| 129 | - $echap = "\n<p class=\"spip\" style=\"text-align: center;\">" . produire_image_math($expression) . "</p>\n"; |
|
| 129 | + $echap = "\n<p class=\"spip\" style=\"text-align: center;\">".produire_image_math($expression)."</p>\n"; |
|
| 130 | 130 | $pos = strpos($texte_milieu, $regs[0]); |
| 131 | 131 | $texte_milieu = substr($texte_milieu, 0, $pos) |
| 132 | 132 | . code_echappement($echap, $source) |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | . substr($texte_milieu, $pos + strlen($regs[0])); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $texte_a_voir = $texte_debut . $texte_milieu . $texte_fin; |
|
| 149 | + $texte_a_voir = $texte_debut.$texte_milieu.$texte_fin; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $texte_a_voir; |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $blue = dechex($blue); |
| 45 | 45 | |
| 46 | 46 | if (strlen($red) == 1) { |
| 47 | - $red = "0" . $red; |
|
| 47 | + $red = "0".$red; |
|
| 48 | 48 | } |
| 49 | 49 | if (strlen($green) == 1) { |
| 50 | - $green = "0" . $green; |
|
| 50 | + $green = "0".$green; |
|
| 51 | 51 | } |
| 52 | 52 | if (strlen($blue) == 1) { |
| 53 | - $blue = "0" . $blue; |
|
| 53 | + $blue = "0".$blue; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return "$red$green$blue"; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $couleur = couleur_html_to_hex($couleur); |
| 69 | 69 | $couleur = ltrim($couleur, '#'); |
| 70 | 70 | if (strlen($couleur) === 3) { |
| 71 | - $couleur = $couleur[0] . $couleur[0] . $couleur[1] . $couleur[1] . $couleur[2] . $couleur[2]; |
|
| 71 | + $couleur = $couleur[0].$couleur[0].$couleur[1].$couleur[1].$couleur[2].$couleur[2]; |
|
| 72 | 72 | } |
| 73 | 73 | $retour["red"] = hexdec(substr($couleur, 0, 2)); |
| 74 | 74 | $retour["green"] = hexdec(substr($couleur, 2, 2)); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $img = "<img src='$source' />"; |
| 157 | 157 | } # gerer img src="data:....base64" |
| 158 | 158 | elseif (preg_match('@^data:image/(jpe?g|png|gif|svg+xml);base64,(.*)$@isS', $source, $regs)) { |
| 159 | - $local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . str_replace('jpeg', 'jpg', $regs[1]); |
|
| 159 | + $local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'.str_replace('jpeg', 'jpg', $regs[1]); |
|
| 160 | 160 | if (!file_exists($local)) { |
| 161 | 161 | ecrire_fichier($local, base64_decode($regs[2])); |
| 162 | 162 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // les protocoles web prennent au moins 3 lettres |
| 171 | 171 | if (tester_url_absolue($source)) { |
| 172 | 172 | include_spip('inc/distant'); |
| 173 | - $fichier = _DIR_RACINE . copie_locale($source); |
|
| 173 | + $fichier = _DIR_RACINE.copie_locale($source); |
|
| 174 | 174 | if (!$fichier) { |
| 175 | 175 | return ""; |
| 176 | 176 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | if ($forcer_format !== false |
| 197 | 197 | // ignorer forcer_format si on a une image svg, que le filtre appelant ne supporte pas SVG, et que le forcage est un autre format image |
| 198 | - and ($terminaison_dest !== 'svg' or $support_svg or !in_array($forcer_format,['png','gif','jpg']))) { |
|
| 198 | + and ($terminaison_dest !== 'svg' or $support_svg or !in_array($forcer_format, ['png', 'gif', 'jpg']))) { |
|
| 199 | 199 | $terminaison_dest = $forcer_format; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | // on garde la terminaison initiale car image simplement copiee |
| 258 | 258 | // et on postfixe son nom avec un md5 du path |
| 259 | 259 | $terminaison_dest = $terminaison; |
| 260 | - $fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5); |
|
| 260 | + $fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5); |
|
| 261 | 261 | } else { |
| 262 | - $fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5); |
|
| 262 | + $fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5); |
|
| 263 | 263 | } |
| 264 | 264 | $cache = sous_repertoire(_DIR_VAR, $cache); |
| 265 | 265 | $cache = sous_repertoire($cache, $effet); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $fichier_dest = substr($fichier_dest, 2); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $fichier_dest = $cache . $fichier_dest . "." . $terminaison_dest; |
|
| 278 | + $fichier_dest = $cache.$fichier_dest.".".$terminaison_dest; |
|
| 279 | 279 | |
| 280 | 280 | $GLOBALS["images_calculees"][] = $fichier_dest; |
| 281 | 281 | |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if ($creer) { |
| 314 | - spip_log("filtre image " . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier", |
|
| 315 | - "images" . _LOG_DEBUG); |
|
| 314 | + spip_log("filtre image ".($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier", |
|
| 315 | + "images"._LOG_DEBUG); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | $term_fonction = _image_trouver_extension_pertinente($fichier); |
| 319 | - $ret["fonction_imagecreatefrom"] = "_imagecreatefrom" . $term_fonction; |
|
| 319 | + $ret["fonction_imagecreatefrom"] = "_imagecreatefrom".$term_fonction; |
|
| 320 | 320 | $ret["fichier"] = $fichier; |
| 321 | - $ret["fonction_image"] = "_image_image" . $terminaison_dest; |
|
| 321 | + $ret["fonction_image"] = "_image_image".$terminaison_dest; |
|
| 322 | 322 | $ret["fichier_dest"] = $fichier_dest; |
| 323 | 323 | $ret["format_source"] = ($terminaison != 'jpeg' ? $terminaison : 'jpg'); |
| 324 | 324 | $ret["format_dest"] = $terminaison_dest; |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $_terminaison = ''; |
| 439 | 439 | } |
| 440 | 440 | if ($_terminaison and $_terminaison !== $terminaison) { |
| 441 | - spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", "images." . _LOG_INFO_IMPORTANTE); |
|
| 441 | + spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", "images."._LOG_INFO_IMPORTANTE); |
|
| 442 | 442 | $terminaison = $_terminaison; |
| 443 | 443 | } |
| 444 | 444 | return $terminaison; |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if (!function_exists('imagepng')) { |
| 529 | 529 | return false; |
| 530 | 530 | } |
| 531 | - $tmp = $fichier . ".tmp"; |
|
| 531 | + $tmp = $fichier.".tmp"; |
|
| 532 | 532 | $ret = imagepng($img, $tmp); |
| 533 | 533 | if (file_exists($tmp)) { |
| 534 | 534 | $taille_test = getimagesize($tmp); |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | if (!function_exists('imagegif')) { |
| 564 | 564 | return false; |
| 565 | 565 | } |
| 566 | - $tmp = $fichier . ".tmp"; |
|
| 566 | + $tmp = $fichier.".tmp"; |
|
| 567 | 567 | $ret = imagegif($img, $tmp); |
| 568 | 568 | if (file_exists($tmp)) { |
| 569 | 569 | $taille_test = getimagesize($tmp); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | if (!function_exists('imagejpeg')) { |
| 604 | 604 | return false; |
| 605 | 605 | } |
| 606 | - $tmp = $fichier . ".tmp"; |
|
| 606 | + $tmp = $fichier.".tmp"; |
|
| 607 | 607 | |
| 608 | 608 | // Enable interlancing |
| 609 | 609 | imageinterlace($img, true); |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | function _image_imagesvg($img, $fichier) { |
| 665 | 665 | |
| 666 | - $tmp = $fichier . ".tmp"; |
|
| 666 | + $tmp = $fichier.".tmp"; |
|
| 667 | 667 | if (strpos($img, "<") === false) { |
| 668 | 668 | $img = supprimer_timestamp($img); |
| 669 | 669 | if (!file_exists($img)) { |
@@ -719,12 +719,12 @@ discard block |
||
| 719 | 719 | * - false sinon. |
| 720 | 720 | */ |
| 721 | 721 | function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE) { |
| 722 | - $fonction = "_image_image" . $valeurs['format_dest']; |
|
| 722 | + $fonction = "_image_image".$valeurs['format_dest']; |
|
| 723 | 723 | $ret = false; |
| 724 | 724 | #un flag pour reperer les images gravees |
| 725 | 725 | $lock = |
| 726 | 726 | !statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout |
| 727 | - or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src')); |
|
| 727 | + or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src')); |
|
| 728 | 728 | if ( |
| 729 | 729 | function_exists($fonction) |
| 730 | 730 | && ($ret = $fonction($img, $valeurs['fichier_dest'], $qualite)) # on a reussi a creer l'image |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | // dans tous les cas mettre a jour la taille de l'image finale |
| 736 | 736 | list($valeurs["hauteur_dest"], $valeurs["largeur_dest"]) = taille_image($valeurs['fichier_dest']); |
| 737 | 737 | $valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition |
| 738 | - ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true); |
|
| 738 | + ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true); |
|
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | function reconstruire_image_intermediaire($fichier_manquant) { |
| 755 | 755 | $reconstruire = array(); |
| 756 | 756 | $fichier = $fichier_manquant; |
| 757 | - while (strpos($fichier,"://")===false |
|
| 757 | + while (strpos($fichier, "://") === false |
|
| 758 | 758 | and !@file_exists($fichier) |
| 759 | 759 | and lire_fichier($src = "$fichier.src", $source) |
| 760 | 760 | and $valeurs = unserialize($source) |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | * Chemin du fichier d'image calculé |
| 792 | 792 | **/ |
| 793 | 793 | function ramasse_miettes($fichier) { |
| 794 | - if (strpos($fichier,"://")!==false |
|
| 794 | + if (strpos($fichier, "://") !== false |
|
| 795 | 795 | or !lire_fichier($src = "$fichier.src", $source) |
| 796 | 796 | or !$valeurs = unserialize($source) |
| 797 | 797 | ) { |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | } |
| 848 | 848 | # si jamais le fichier final n'a pas ete calcule car suppose temporaire |
| 849 | 849 | # et qu'il ne s'agit pas d'une URL |
| 850 | - if (strpos($fichier,"://")===false and !@file_exists($fichier)) { |
|
| 850 | + if (strpos($fichier, "://") === false and !@file_exists($fichier)) { |
|
| 851 | 851 | reconstruire_image_intermediaire($fichier); |
| 852 | 852 | } |
| 853 | 853 | ramasse_miettes($fichier); |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | // attributs deprecies. Transformer en CSS |
| 946 | 946 | if ($espace = extraire_attribut($tag, 'hspace')) { |
| 947 | - $style = "margin:${espace}px;" . $style; |
|
| 947 | + $style = "margin:${espace}px;".$style; |
|
| 948 | 948 | $tag = inserer_attribut($tag, 'hspace', ''); |
| 949 | 949 | } |
| 950 | 950 | |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | $image = $valeurs['fichier']; |
| 1069 | 1069 | $format = $valeurs['format_source']; |
| 1070 | 1070 | $destdir = dirname($valeurs['fichier_dest']); |
| 1071 | - $destfile = basename($valeurs['fichier_dest'], "." . $valeurs["format_dest"]); |
|
| 1071 | + $destfile = basename($valeurs['fichier_dest'], ".".$valeurs["format_dest"]); |
|
| 1072 | 1072 | |
| 1073 | 1073 | $format_sortie = $valeurs['format_dest']; |
| 1074 | 1074 | |
@@ -1098,14 +1098,14 @@ discard block |
||
| 1098 | 1098 | |
| 1099 | 1099 | // Si l'image est de la taille demandee (ou plus petite), simplement la retourner |
| 1100 | 1100 | if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) { |
| 1101 | - $vignette = $destination . '.' . $format; |
|
| 1101 | + $vignette = $destination.'.'.$format; |
|
| 1102 | 1102 | @copy($image, $vignette); |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | elseif ($valeurs["format_source"] === 'svg') { |
| 1106 | - if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)){ |
|
| 1106 | + if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) { |
|
| 1107 | 1107 | $format_sortie = 'svg'; |
| 1108 | - $vignette = $destination . "." . $format_sortie; |
|
| 1108 | + $vignette = $destination.".".$format_sortie; |
|
| 1109 | 1109 | $valeurs['fichier_dest'] = $vignette; |
| 1110 | 1110 | _image_gd_output($svg, $valeurs); |
| 1111 | 1111 | } |
@@ -1117,9 +1117,9 @@ discard block |
||
| 1117 | 1117 | define('_CONVERT_COMMAND', 'convert'); |
| 1118 | 1118 | } // Securite : mes_options.php peut preciser le chemin absolu |
| 1119 | 1119 | if (!defined('_RESIZE_COMMAND')) { |
| 1120 | - define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -resize %xx%y! %src %dest'); |
|
| 1120 | + define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -resize %xx%y! %src %dest'); |
|
| 1121 | 1121 | } |
| 1122 | - $vignette = $destination . "." . $format_sortie; |
|
| 1122 | + $vignette = $destination.".".$format_sortie; |
|
| 1123 | 1123 | $commande = str_replace( |
| 1124 | 1124 | array('%x', '%y', '%src', '%dest'), |
| 1125 | 1125 | array( |
@@ -1134,13 +1134,13 @@ discard block |
||
| 1134 | 1134 | if (!@file_exists($vignette)) { |
| 1135 | 1135 | spip_log("echec convert sur $vignette"); |
| 1136 | 1136 | |
| 1137 | - return; // echec commande |
|
| 1137 | + return; // echec commande |
|
| 1138 | 1138 | } |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | // php5 imagemagick |
| 1142 | 1142 | elseif ($process == 'imagick') { |
| 1143 | - $vignette = "$destination." . $format_sortie; |
|
| 1143 | + $vignette = "$destination.".$format_sortie; |
|
| 1144 | 1144 | |
| 1145 | 1145 | if (!class_exists('Imagick')) { |
| 1146 | 1146 | spip_log("Classe Imagick absente !", _LOG_ERREUR); |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | $imagick = new Imagick(); |
| 1151 | 1151 | $imagick->readImage($image); |
| 1152 | 1152 | $imagick->resizeImage($destWidth, $destHeight, Imagick::FILTER_LANCZOS, |
| 1153 | - 1);//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1153 | + 1); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100); |
|
| 1154 | 1154 | $imagick->writeImage($vignette); |
| 1155 | 1155 | |
| 1156 | 1156 | if (!@file_exists($vignette)) { |
@@ -1168,12 +1168,12 @@ discard block |
||
| 1168 | 1168 | if (_PNMSCALE_COMMAND == '') { |
| 1169 | 1169 | return; |
| 1170 | 1170 | } |
| 1171 | - $vignette = $destination . "." . $format_sortie; |
|
| 1171 | + $vignette = $destination.".".$format_sortie; |
|
| 1172 | 1172 | $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND); |
| 1173 | 1173 | if ($format == "jpg") { |
| 1174 | 1174 | |
| 1175 | 1175 | $jpegtopnm_command = str_replace("pnmscale", "jpegtopnm", _PNMSCALE_COMMAND); |
| 1176 | - exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1176 | + exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1177 | 1177 | if (!($s = @filesize($vignette))) { |
| 1178 | 1178 | spip_unlink($vignette); |
| 1179 | 1179 | } |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | } else { |
| 1186 | 1186 | if ($format == "gif") { |
| 1187 | 1187 | $giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND); |
| 1188 | - exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1188 | + exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1189 | 1189 | if (!($s = @filesize($vignette))) { |
| 1190 | 1190 | spip_unlink($vignette); |
| 1191 | 1191 | } |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | } else { |
| 1198 | 1198 | if ($format == "png") { |
| 1199 | 1199 | $pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND); |
| 1200 | - exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1200 | + exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette"); |
|
| 1201 | 1201 | if (!($s = @filesize($vignette))) { |
| 1202 | 1202 | spip_unlink($vignette); |
| 1203 | 1203 | } |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | return; |
| 1220 | 1220 | } |
| 1221 | 1221 | if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) { |
| 1222 | - spip_log("vignette gd1/gd2 impossible : " . $srcWidth * $srcHeight . "pixels"); |
|
| 1222 | + spip_log("vignette gd1/gd2 impossible : ".$srcWidth * $srcHeight."pixels"); |
|
| 1223 | 1223 | |
| 1224 | 1224 | return; |
| 1225 | 1225 | } |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | // de l'image, de facon a tromper le cache du navigateur |
| 1525 | 1525 | // quand on fait supprimer/reuploader un logo |
| 1526 | 1526 | // (pas de filemtime si SAFE MODE) |
| 1527 | - $date = test_espace_prive() ? ('?' . $date) : ''; |
|
| 1527 | + $date = test_espace_prive() ? ('?'.$date) : ''; |
|
| 1528 | 1528 | |
| 1529 | 1529 | return _image_ecrire_tag($image, array('src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight)); |
| 1530 | 1530 | } |
@@ -1572,7 +1572,7 @@ discard block |
||
| 1572 | 1572 | public static function LittleEndian2String($number, $minbytes = 1) { |
| 1573 | 1573 | $intstring = ''; |
| 1574 | 1574 | while ($number > 0) { |
| 1575 | - $intstring = $intstring . chr($number & 255); |
|
| 1575 | + $intstring = $intstring.chr($number & 255); |
|
| 1576 | 1576 | $number >>= 8; |
| 1577 | 1577 | } |
| 1578 | 1578 | |
@@ -1605,9 +1605,9 @@ discard block |
||
| 1605 | 1605 | $b = $argb['blue']; |
| 1606 | 1606 | |
| 1607 | 1607 | if ($bpp[$key] == 32) { |
| 1608 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a); |
|
| 1608 | + $icXOR[$key] .= chr($b).chr($g).chr($r).chr($a); |
|
| 1609 | 1609 | } elseif ($bpp[$key] == 24) { |
| 1610 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r); |
|
| 1610 | + $icXOR[$key] .= chr($b).chr($g).chr($r); |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | if ($a < 128) { |
@@ -1635,44 +1635,44 @@ discard block |
||
| 1635 | 1635 | |
| 1636 | 1636 | // BITMAPINFOHEADER - 40 bytes |
| 1637 | 1637 | $BitmapInfoHeader[$key] = ''; |
| 1638 | - $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1639 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1638 | + $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
| 1639 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
| 1640 | 1640 | // The biHeight member specifies the combined |
| 1641 | 1641 | // height of the XOR and AND masks. |
| 1642 | 1642 | $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight; |
| 1643 | - $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1644 | - $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00"; // wBitCount; |
|
| 1645 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1646 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1647 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1648 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1649 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1650 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1643 | + $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
| 1644 | + $BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount; |
|
| 1645 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
| 1646 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
| 1647 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
| 1648 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
| 1649 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
| 1650 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | |
| 1654 | - $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1655 | - $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1656 | - $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1654 | + $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
| 1655 | + $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
| 1656 | + $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
| 1657 | 1657 | |
| 1658 | 1658 | $dwImageOffset = 6 + (count($gd_image_array) * 16); |
| 1659 | 1659 | foreach ($gd_image_array as $key => $gd_image) { |
| 1660 | 1660 | // ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em) |
| 1661 | 1661 | |
| 1662 | - $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1663 | - $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1664 | - $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1665 | - $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1662 | + $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
| 1663 | + $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
| 1664 | + $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
| 1665 | + $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
| 1666 | 1666 | |
| 1667 | - $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1668 | - $icondata .= chr($bpp[$key]) . "\x00"; // wBitCount; // Bits per pixel |
|
| 1667 | + $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
| 1668 | + $icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel |
|
| 1669 | 1669 | |
| 1670 | 1670 | $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]); |
| 1671 | 1671 | $icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes, |
| 1672 | - 4); // dwBytesInRes; // How many bytes in this resource? |
|
| 1672 | + 4); // dwBytesInRes; // How many bytes in this resource? |
|
| 1673 | 1673 | |
| 1674 | 1674 | $icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset, |
| 1675 | - 4); // dwImageOffset; // Where in the file is this image? |
|
| 1675 | + 4); // dwImageOffset; // Where in the file is this image? |
|
| 1676 | 1676 | $dwImageOffset += strlen($BitmapInfoHeader[$key]); |
| 1677 | 1677 | $dwImageOffset += strlen($icXOR[$key]); |
| 1678 | 1678 | $dwImageOffset += strlen($icAND[$key]); |
@@ -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', 2097152); |
@@ -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,13 +115,13 @@ discard block |
||
| 115 | 115 | array('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['status'], _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".$res['status'], _LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | if (!$res['length']) { |
| 121 | 121 | // si $t c'est sans doute juste un not-modified-since |
| 122 | 122 | return $t ? $local : false; |
| 123 | 123 | } |
| 124 | - spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK'); |
|
| 124 | + spip_log("copie_locale : recuperation $source sur $localrac taille ".$res['length'].' OK'); |
|
| 125 | 125 | |
| 126 | 126 | // pour une eventuelle indexation |
| 127 | 127 | pipeline( |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * url ou false en cas d'echec |
| 154 | 154 | */ |
| 155 | 155 | function valider_url_distante($url, $known_hosts = array()) { |
| 156 | - if (!function_exists('protocole_verifier')){ |
|
| 156 | + if (!function_exists('protocole_verifier')) { |
|
| 157 | 157 | include_spip('inc/filtres_mini'); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $parsed_url = parse_url($url); |
| 165 | - if (!$parsed_url or empty($parsed_url['host']) ) { |
|
| 165 | + if (!$parsed_url or empty($parsed_url['host'])) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | if ($ip) { |
| 206 | - $parts = array_map('intval', explode( '.', $ip )); |
|
| 206 | + $parts = array_map('intval', explode('.', $ip)); |
|
| 207 | 207 | if (127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0] |
| 208 | - or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] ) |
|
| 209 | - or ( 192 === $parts[0] && 168 === $parts[1] ) |
|
| 208 | + or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1]) |
|
| 209 | + or (192 === $parts[0] && 168 === $parts[1]) |
|
| 210 | 210 | ) { |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $port = $parsed_url['port']; |
| 221 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 221 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 222 | 222 | return $url; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | if ($taille > 500) { |
| 288 | - $boundary = substr(md5(rand() . 'spip'), 0, 8); |
|
| 288 | + $boundary = substr(md5(rand().'spip'), 0, 8); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -313,16 +313,16 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | } else { |
| 315 | 315 | // fabrique une chaine HTTP simple pour un POST |
| 316 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 316 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 317 | 317 | $chaine = array(); |
| 318 | 318 | if (is_array($donnees)) { |
| 319 | 319 | foreach ($donnees as $cle => $valeur) { |
| 320 | 320 | if (is_array($valeur)) { |
| 321 | 321 | foreach ($valeur as $val2) { |
| 322 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 322 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 323 | 323 | } |
| 324 | 324 | } else { |
| 325 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 325 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | $chaine = implode('&', $chaine); |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | if (!empty($options['datas'])) { |
| 424 | 424 | list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']); |
| 425 | 425 | if (stripos($head, 'Content-Length:') === false) { |
| 426 | - $head .= 'Content-Length: ' . strlen($postdata); |
|
| 426 | + $head .= 'Content-Length: '.strlen($postdata); |
|
| 427 | 427 | } |
| 428 | - $options['datas'] = $head . "\r\n\r\n" . $postdata; |
|
| 428 | + $options['datas'] = $head."\r\n\r\n".$postdata; |
|
| 429 | 429 | if (strlen($postdata)) { |
| 430 | 430 | $options['methode'] = 'POST'; |
| 431 | 431 | } |
@@ -434,9 +434,9 @@ discard block |
||
| 434 | 434 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 435 | 435 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 436 | 436 | if (!tester_url_absolue($url)) { |
| 437 | - $url = 'http://' . $url; |
|
| 437 | + $url = 'http://'.$url; |
|
| 438 | 438 | } elseif (strncmp($url, '//', 2) == 0) { |
| 439 | - $url = 'http:' . $url; |
|
| 439 | + $url = 'http:'.$url; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $url = url_to_ascii($url); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | return recuperer_url($url, $options); |
| 507 | 507 | } elseif ($res['status'] !== 200) { |
| 508 | - spip_log('HTTP status ' . $res['status'] . " pour $url"); |
|
| 508 | + spip_log('HTTP status '.$res['status']." pour $url"); |
|
| 509 | 509 | } |
| 510 | 510 | $result['status'] = $res['status']; |
| 511 | 511 | if (isset($res['headers'])) { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | $gz = false; |
| 532 | 532 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 533 | - $gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz'); |
|
| 533 | + $gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz'); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $sig['url'] = $url; |
| 617 | 617 | |
| 618 | 618 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 619 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 619 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 620 | 620 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 621 | 621 | $cache = "$sub$cache"; |
| 622 | 622 | |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | return false; |
| 726 | 726 | } |
| 727 | 727 | if ($get_headers) { |
| 728 | - return $res['headers'] . "\n" . $res['page']; |
|
| 728 | + return $res['headers']."\n".$res['page']; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | return $res['page']; |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $fp = false; |
| 830 | 830 | if ($fichier) { |
| 831 | 831 | include_spip('inc/acces'); |
| 832 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 832 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 833 | 833 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 834 | 834 | if (!$fp and file_exists($fichier)) { |
| 835 | 835 | return filesize($fichier); |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | } |
| 889 | 889 | $result['status'] = intval($r[1]); |
| 890 | 890 | while ($s = trim(fgets($handle, 16384))) { |
| 891 | - $result['headers'][] = $s . "\n"; |
|
| 891 | + $result['headers'][] = $s."\n"; |
|
| 892 | 892 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 893 | 893 | list(, $d, $v) = $r; |
| 894 | 894 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -971,13 +971,13 @@ discard block |
||
| 971 | 971 | |
| 972 | 972 | // on se place tout le temps comme si on etait a la racine |
| 973 | 973 | if (_DIR_RACINE) { |
| 974 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 974 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | $m = md5($source); |
| 978 | 978 | |
| 979 | 979 | return $d |
| 980 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 980 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 981 | 981 | . substr($m, 0, 4) |
| 982 | 982 | . ".$extension"; |
| 983 | 983 | } |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | // Si c'est deja local pas de souci |
| 1001 | 1001 | if (!tester_url_absolue($source)) { |
| 1002 | 1002 | if (_DIR_RACINE) { |
| 1003 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 1003 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | return $source; |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | if ($ext |
| 1018 | 1018 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 1019 | 1019 | and $f = nom_fichier_copie_locale($source, $ext) |
| 1020 | - and file_exists(_DIR_RACINE . $f) |
|
| 1020 | + and file_exists(_DIR_RACINE.$f) |
|
| 1021 | 1021 | ) { |
| 1022 | 1022 | return $f; |
| 1023 | 1023 | } |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | |
| 1026 | 1026 | // Si c'est deja dans la table des documents, |
| 1027 | 1027 | // ramener le nom de sa copie potentielle |
| 1028 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 1028 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 1029 | 1029 | |
| 1030 | 1030 | if ($ext) { |
| 1031 | 1031 | return nom_fichier_copie_locale($source, $ext); |
@@ -1036,9 +1036,9 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 1038 | 1038 | |
| 1039 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 1039 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 1040 | 1040 | $f = nom_fichier_copie_locale($source, $ext); |
| 1041 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 1041 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 1042 | 1042 | return $f; |
| 1043 | 1043 | } |
| 1044 | 1044 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | // Ping pour voir si son extension est connue et autorisee |
| 1047 | 1047 | // avec mise en cache du resultat du ping |
| 1048 | 1048 | |
| 1049 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 1049 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 1050 | 1050 | if (!@file_exists($cache) |
| 1051 | 1051 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
| 1052 | 1052 | or _request('var_mode') == 'recalcul' |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | ecrire_fichier($cache, serialize($path_parts)); |
| 1056 | 1056 | } |
| 1057 | 1057 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 1058 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 1058 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 1059 | 1059 | return nom_fichier_copie_locale($source, $ext); |
| 1060 | 1060 | } |
| 1061 | 1061 | spip_log("pas de copie locale pour $source"); |
@@ -1123,19 +1123,19 @@ discard block |
||
| 1123 | 1123 | if (!$t |
| 1124 | 1124 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1125 | 1125 | ) { |
| 1126 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1126 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1127 | 1127 | } |
| 1128 | 1128 | if (!$t |
| 1129 | 1129 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1130 | 1130 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1131 | 1131 | ) { |
| 1132 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1132 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1133 | 1133 | } |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1137 | 1137 | if (!$t) { |
| 1138 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1138 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1145,11 +1145,11 @@ discard block |
||
| 1145 | 1145 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1146 | 1146 | ) { |
| 1147 | 1147 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1148 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1148 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | if ($t) { |
| 1152 | - spip_log("mime-type $mime_type ok, extension " . $t['extension']); |
|
| 1152 | + spip_log("mime-type $mime_type ok, extension ".$t['extension']); |
|
| 1153 | 1153 | $a['extension'] = $t['extension']; |
| 1154 | 1154 | } else { |
| 1155 | 1155 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | $a = recuperer_infos_distantes($source, _INC_DISTANT_MAX_SIZE); |
| 1189 | 1189 | } else { |
| 1190 | 1190 | if ($a['body']) { |
| 1191 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $a['extension']); |
|
| 1191 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $a['extension']); |
|
| 1192 | 1192 | ecrire_fichier($a['fichier'], $a['body']); |
| 1193 | 1193 | $size_image = @spip_getimagesize($a['fichier']); |
| 1194 | 1194 | $a['largeur'] = intval($size_image[0]); |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | } |
| 1313 | 1313 | } else { |
| 1314 | 1314 | $scheme = $t['scheme']; |
| 1315 | - $noproxy = $scheme . '://'; |
|
| 1315 | + $noproxy = $scheme.'://'; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | if (isset($t['user'])) { |
| 1318 | 1318 | $user = array($t['user'], $t['pass']); |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | if (!empty($t['query'])) { |
| 1329 | - $path .= '?' . $t['query']; |
|
| 1329 | + $path .= '?'.$t['query']; |
|
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1399,20 +1399,20 @@ discard block |
||
| 1399 | 1399 | $proxy_user = ''; |
| 1400 | 1400 | $http_proxy = need_proxy($host); |
| 1401 | 1401 | if ($user) { |
| 1402 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1402 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | 1405 | $connect = ''; |
| 1406 | 1406 | if ($http_proxy) { |
| 1407 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme , array('tls','ssl'))) { |
|
| 1408 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1409 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1407 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, array('tls', 'ssl'))) { |
|
| 1408 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1409 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1410 | 1410 | . "Host: $path_host\r\n" |
| 1411 | 1411 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1412 | 1412 | } else { |
| 1413 | - $path = (in_array($scheme , array('tls','ssl')) ? 'https://' : "$scheme://") |
|
| 1413 | + $path = (in_array($scheme, array('tls', 'ssl')) ? 'https://' : "$scheme://") |
|
| 1414 | 1414 | . (!$user ? '' : "$user@") |
| 1415 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1415 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1416 | 1416 | } |
| 1417 | 1417 | $t2 = @parse_url($http_proxy); |
| 1418 | 1418 | $first_host = $t2['host']; |
@@ -1420,10 +1420,10 @@ discard block |
||
| 1420 | 1420 | $port = 80; |
| 1421 | 1421 | } |
| 1422 | 1422 | if ($t2['user']) { |
| 1423 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1423 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1424 | 1424 | } |
| 1425 | 1425 | } else { |
| 1426 | - $first_host = $noproxy . $host; |
|
| 1426 | + $first_host = $noproxy.$host; |
|
| 1427 | 1427 | } |
| 1428 | 1428 | |
| 1429 | 1429 | if ($connect) { |
@@ -1460,7 +1460,7 @@ discard block |
||
| 1460 | 1460 | or !count($res = explode(' ', $res)) |
| 1461 | 1461 | or $res[1] !== '200' |
| 1462 | 1462 | ) { |
| 1463 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1463 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1464 | 1464 | fclose($f); |
| 1465 | 1465 | |
| 1466 | 1466 | return false; |
@@ -1487,16 +1487,16 @@ discard block |
||
| 1487 | 1487 | $site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : ''; |
| 1488 | 1488 | |
| 1489 | 1489 | $host_port = $host; |
| 1490 | - if ($port != (in_array($scheme , array('tls','ssl')) ? 443 : 80)) { |
|
| 1490 | + if ($port != (in_array($scheme, array('tls', 'ssl')) ? 443 : 80)) { |
|
| 1491 | 1491 | $host_port .= ":$port"; |
| 1492 | 1492 | } |
| 1493 | 1493 | $req = "$method $path $vers\r\n" |
| 1494 | 1494 | . "Host: $host_port\r\n" |
| 1495 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1496 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1495 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1496 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1497 | 1497 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1498 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1499 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1498 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1499 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1500 | 1500 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1501 | 1501 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1502 | 1502 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | if (!defined('IMG_SVG')) { |
| 24 | 24 | // complete IMG_BMP | IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM | IMG_WEBP |
| 25 | - define('IMG_SVG',128); |
|
| 25 | + define('IMG_SVG', 128); |
|
| 26 | 26 | define('IMAGETYPE_SVG', 19); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return bool|string |
| 39 | 39 | * false si on a pas pu charger l'image |
| 40 | 40 | */ |
| 41 | -function svg_charger($fichier, $maxlen=null) { |
|
| 41 | +function svg_charger($fichier, $maxlen = null) { |
|
| 42 | 42 | if (strpos($fichier, "data:image/svg+xml") === 0) { |
| 43 | 43 | $image = explode(";", $fichier, 2); |
| 44 | 44 | $image = end($image); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return $fichier; |
| 58 | 58 | } |
| 59 | 59 | if (!file_exists($fichier)) { |
| 60 | - $fichier = supprimer_timestamp($fichier); |
|
| 60 | + $fichier = supprimer_timestamp($fichier); |
|
| 61 | 61 | if (!file_exists($fichier)) { |
| 62 | 62 | var_dump('fail2'); |
| 63 | 63 | return false; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $image = file_get_contents($fichier); |
| 68 | 68 | } |
| 69 | 69 | else { |
| 70 | - $image = file_get_contents($fichier, false,null,0, $maxlen); |
|
| 70 | + $image = file_get_contents($fichier, false, null, 0, $maxlen); |
|
| 71 | 71 | } |
| 72 | 72 | // est-ce bien une image svg ? |
| 73 | 73 | if (strpos($image, "<svg") !== false) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if (($ps = stripos($debut_fichier, "<svg")) !== false) { |
| 90 | 90 | |
| 91 | 91 | $pe = stripos($debut_fichier, ">", $ps); |
| 92 | - $balise_svg = substr($debut_fichier, $ps, $pe - $ps +1); |
|
| 92 | + $balise_svg = substr($debut_fichier, $ps, $pe - $ps + 1); |
|
| 93 | 93 | |
| 94 | 94 | if (preg_match_all(",([\w\-]+)=,Uims", $balise_svg, $matches)) { |
| 95 | 95 | if (!function_exists('extraire_attribut')) { |
@@ -129,29 +129,29 @@ discard block |
||
| 129 | 129 | * @return bool|float|int |
| 130 | 130 | */ |
| 131 | 131 | function svg_dimension_to_pixels($dimension) { |
| 132 | - if (preg_match(',^(-?\d+)([^\d]*),i', trim($dimension), $m)){ |
|
| 132 | + if (preg_match(',^(-?\d+)([^\d]*),i', trim($dimension), $m)) { |
|
| 133 | 133 | switch (strtolower($m[2])) { |
| 134 | 134 | case '%': |
| 135 | 135 | // on ne sait pas faire :( |
| 136 | 136 | return false; |
| 137 | 137 | break; |
| 138 | 138 | case 'em': |
| 139 | - return intval($m[1])*16; // 16px font-size par defaut |
|
| 139 | + return intval($m[1]) * 16; // 16px font-size par defaut |
|
| 140 | 140 | break; |
| 141 | 141 | case 'ex': |
| 142 | - return intval($m[1])*16; // 16px font-size par defaut |
|
| 142 | + return intval($m[1]) * 16; // 16px font-size par defaut |
|
| 143 | 143 | break; |
| 144 | 144 | case 'pc': |
| 145 | - return intval($m[1])*16; // 1/6 inch = 96px/6 in CSS |
|
| 145 | + return intval($m[1]) * 16; // 1/6 inch = 96px/6 in CSS |
|
| 146 | 146 | break; |
| 147 | 147 | case 'cm': |
| 148 | - return intval(round($m[1]*96/2.54)); // 96px / 2.54cm; |
|
| 148 | + return intval(round($m[1] * 96 / 2.54)); // 96px / 2.54cm; |
|
| 149 | 149 | break; |
| 150 | 150 | case 'mm': |
| 151 | - return intval(round($m[1]*96/25.4)); // 96px / 25.4mm; |
|
| 151 | + return intval(round($m[1] * 96 / 25.4)); // 96px / 25.4mm; |
|
| 152 | 152 | break; |
| 153 | 153 | case 'in': |
| 154 | - return intval($m[1])*96; // 1 inch = 96px in CSS |
|
| 154 | + return intval($m[1]) * 96; // 1 inch = 96px in CSS |
|
| 155 | 155 | break; |
| 156 | 156 | case 'px': |
| 157 | 157 | case 'pt': |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | * inserer au debut (true) ou a la fin (false) |
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | -function svg_insert_shapes($svg, $shapes, $start=true) { |
|
| 192 | +function svg_insert_shapes($svg, $shapes, $start = true) { |
|
| 193 | 193 | |
| 194 | 194 | if ($start === false or $start === 'end') { |
| 195 | - $svg = str_replace("</svg>", $shapes . "</svg>", $svg); |
|
| 195 | + $svg = str_replace("</svg>", $shapes."</svg>", $svg); |
|
| 196 | 196 | } |
| 197 | 197 | else { |
| 198 | 198 | $p = stripos($svg, "<svg"); |
| 199 | 199 | $p = strpos($svg, ">", $p); |
| 200 | - $svg = substr_replace($svg, $shapes, $p+1, 0); |
|
| 200 | + $svg = substr_replace($svg, $shapes, $p + 1, 0); |
|
| 201 | 201 | } |
| 202 | 202 | return $svg; |
| 203 | 203 | } |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | function svg_clip_in_box($svg, $x, $y, $width, $height) { |
| 215 | 215 | $rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />"; |
| 216 | - $id = 'clip-'.substr(md5($rect . strlen($svg)),0,8); |
|
| 216 | + $id = 'clip-'.substr(md5($rect.strlen($svg)), 0, 8); |
|
| 217 | 217 | $clippath = "<clipPath id=\"$id\">$rect</clipPath>"; |
| 218 | 218 | $g = "<g clip-path=\"url(#$id)\">"; |
| 219 | - $svg = svg_insert_shapes($svg, $clippath . $g); |
|
| 219 | + $svg = svg_insert_shapes($svg, $clippath.$g); |
|
| 220 | 220 | $svg = svg_insert_shapes($svg, "</g>", false); |
| 221 | 221 | return $svg; |
| 222 | 222 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | list($balise_svg, $attributs) = $svg_infos; |
| 236 | 236 | if (!isset($attributs['viewBox'])) { |
| 237 | - $attributs['viewBox'] = "0 0 " . $attributs['width'] . " " . $attributs['height']; |
|
| 237 | + $attributs['viewBox'] = "0 0 ".$attributs['width']." ".$attributs['height']; |
|
| 238 | 238 | } |
| 239 | 239 | $attributs['width'] = strval($new_width); |
| 240 | 240 | $attributs['height'] = strval($new_height); |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | * @return string |
| 253 | 253 | */ |
| 254 | 254 | function svg_couleur_to_hexa($couleur) { |
| 255 | - if (strpos($couleur, "rgb(")===0) { |
|
| 255 | + if (strpos($couleur, "rgb(") === 0) { |
|
| 256 | 256 | $c = explode(',', substr($couleur, 4)); |
| 257 | 257 | $couleur = _couleur_dec_to_hex(intval($c[0]), intval($c[1]), intval($c[2])); |
| 258 | 258 | } |
| 259 | 259 | else { |
| 260 | 260 | $couleur = couleur_html_to_hex($couleur); |
| 261 | 261 | } |
| 262 | - $couleur = '#'.ltrim($couleur,'#'); |
|
| 262 | + $couleur = '#'.ltrim($couleur, '#'); |
|
| 263 | 263 | return $couleur; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | * @return array |
| 270 | 270 | */ |
| 271 | 271 | function svg_couleur_to_rgb($couleur) { |
| 272 | - if (strpos($couleur, "rgb(")===0) { |
|
| 272 | + if (strpos($couleur, "rgb(") === 0) { |
|
| 273 | 273 | $c = explode(',', substr($couleur, 4)); |
| 274 | - return ['red' => intval($c[0]),'green' => intval($c[1]),'blue' => intval($c[2])]; |
|
| 274 | + return ['red' => intval($c[0]), 'green' => intval($c[1]), 'blue' => intval($c[2])]; |
|
| 275 | 275 | } |
| 276 | 276 | return _couleur_hex_to_dec($couleur); |
| 277 | 277 | } |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | function svg_force_viewBox_px($img) { |
| 292 | 292 | if ($svg = svg_charger($img) |
| 293 | - and $svg_infos = svg_lire_balise_svg($svg)){ |
|
| 293 | + and $svg_infos = svg_lire_balise_svg($svg)) { |
|
| 294 | 294 | |
| 295 | 295 | list($balise_svg, $attributs) = $svg_infos; |
| 296 | 296 | |
| 297 | 297 | // il nous faut une viewBox |
| 298 | 298 | if (!isset($attributs['viewBox'])) { |
| 299 | - $viewBox = "0 0 " . $attributs['width'] . " " . $attributs['height']; |
|
| 299 | + $viewBox = "0 0 ".$attributs['width']." ".$attributs['height']; |
|
| 300 | 300 | } |
| 301 | 301 | else { |
| 302 | 302 | $viewBox = $attributs['viewBox']; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * @param $new_height |
| 342 | 342 | * @return bool|string |
| 343 | 343 | */ |
| 344 | -function svg_recadrer($img, $new_width, $new_height, $offset_width, $offset_height, $background_color='') { |
|
| 344 | +function svg_recadrer($img, $new_width, $new_height, $offset_width, $offset_height, $background_color = '') { |
|
| 345 | 345 | if ($svg = svg_force_viewBox_px($img) |
| 346 | 346 | and $svg_infos = svg_lire_balise_svg($svg)) { |
| 347 | 347 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $viewport_oy = intval(round($viewport_oy * $yscale)); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if ($viewport_w>$viewBox[2] or $viewport_h>$viewBox[3]) { |
|
| 370 | + if ($viewport_w > $viewBox[2] or $viewport_h > $viewBox[3]) { |
|
| 371 | 371 | $svg = svg_clip_in_box($svg, $viewBox[0], $viewBox[1], $viewBox[2], $viewBox[3]); |
| 372 | 372 | } |
| 373 | 373 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $svg = svg_change_balise_svg($svg, $balise_svg, $attributs); |
| 385 | 385 | |
| 386 | 386 | // ajouter un background |
| 387 | - if ($background_color and $background_color!=='transparent') { |
|
| 387 | + if ($background_color and $background_color !== 'transparent') { |
|
| 388 | 388 | $svg = svg_ajouter_background($svg, $background_color); |
| 389 | 389 | } |
| 390 | 390 | |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | function svg_ajouter_background($img, $background_color) { |
| 404 | 404 | if ($svg = svg_charger($img) |
| 405 | - and $svg_infos = svg_lire_balise_svg($svg)){ |
|
| 405 | + and $svg_infos = svg_lire_balise_svg($svg)) { |
|
| 406 | 406 | |
| 407 | - if ($background_color and $background_color!=='transparent') { |
|
| 407 | + if ($background_color and $background_color !== 'transparent') { |
|
| 408 | 408 | list($balise_svg, $attributs) = $svg_infos; |
| 409 | 409 | |
| 410 | 410 | $background_color = svg_couleur_to_hexa($background_color); |
@@ -431,9 +431,9 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | function svg_ajouter_voile($img, $background_color, $opacity) { |
| 433 | 433 | if ($svg = svg_charger($img) |
| 434 | - and $svg_infos = svg_lire_balise_svg($svg)){ |
|
| 434 | + and $svg_infos = svg_lire_balise_svg($svg)) { |
|
| 435 | 435 | |
| 436 | - if ($background_color and $background_color!=='transparent') { |
|
| 436 | + if ($background_color and $background_color !== 'transparent') { |
|
| 437 | 437 | list($balise_svg, $attributs) = $svg_infos; |
| 438 | 438 | |
| 439 | 439 | $background_color = svg_couleur_to_hexa($background_color); |
@@ -460,10 +460,10 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | function svg_transformer($img, $attributs) { |
| 462 | 462 | if ($svg = svg_charger($img) |
| 463 | - and $svg_infos = svg_lire_balise_svg($svg)){ |
|
| 463 | + and $svg_infos = svg_lire_balise_svg($svg)) { |
|
| 464 | 464 | |
| 465 | 465 | if ($attributs) { |
| 466 | - list($balise_svg, ) = $svg_infos; |
|
| 466 | + list($balise_svg,) = $svg_infos; |
|
| 467 | 467 | $g = "<g"; |
| 468 | 468 | foreach ($attributs as $k=>$v) { |
| 469 | 469 | if (strlen($v)) { |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | function svg_flip($img, $HorV) { |
| 492 | 492 | if ($svg = svg_force_viewBox_px($img) |
| 493 | - and $svg_infos = svg_lire_balise_svg($svg)){ |
|
| 493 | + and $svg_infos = svg_lire_balise_svg($svg)) { |
|
| 494 | 494 | |
| 495 | 495 | list($balise_svg, $atts) = $svg_infos; |
| 496 | 496 | $viewBox = explode(' ', $atts['viewBox']); |
@@ -498,14 +498,14 @@ discard block |
||
| 498 | 498 | if (!in_array($HorV, ['h', 'H'])) { |
| 499 | 499 | $transform = "scale(-1,1)"; |
| 500 | 500 | |
| 501 | - $x = intval($viewBox[0]) + intval($viewBox[2]/2); |
|
| 501 | + $x = intval($viewBox[0]) + intval($viewBox[2] / 2); |
|
| 502 | 502 | $mx = -$x; |
| 503 | 503 | $transform = "translate($x, 0) $transform translate($mx, 0)"; |
| 504 | 504 | } |
| 505 | 505 | else { |
| 506 | 506 | $transform = "scale(1,-1)"; |
| 507 | 507 | |
| 508 | - $y = intval($viewBox[1]) + intval($viewBox[3]/2); |
|
| 508 | + $y = intval($viewBox[1]) + intval($viewBox[3] / 2); |
|
| 509 | 509 | $my = -$y; |
| 510 | 510 | $transform = "translate(0, $y) $transform translate(0, $my)"; |
| 511 | 511 | } |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | function svg_rotate($img, $angle, $center_x, $center_y) { |
| 529 | 529 | if ($svg = svg_force_viewBox_px($img) |
| 530 | - and $svg_infos = svg_lire_balise_svg($svg)){ |
|
| 530 | + and $svg_infos = svg_lire_balise_svg($svg)) { |
|
| 531 | 531 | |
| 532 | 532 | list($balise_svg, $atts) = $svg_infos; |
| 533 | 533 | $viewBox = explode(' ', $atts['viewBox']); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $type = type_du_logo($primary); |
| 64 | 64 | |
| 65 | 65 | // nom du logo |
| 66 | - $nom = $type . $etat . $id_objet; |
|
| 66 | + $nom = $type.$etat.$id_objet; |
|
| 67 | 67 | |
| 68 | 68 | // supprimer le logo eventueel existant |
| 69 | 69 | logo_supprimer($objet, $id_objet, $etat); |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | return $erreur; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $file_tmp = _DIR_LOGOS . $nom . '.tmp'; |
|
| 81 | + $file_tmp = _DIR_LOGOS.$nom.'.tmp'; |
|
| 82 | 82 | |
| 83 | 83 | $ok = false; |
| 84 | 84 | // fichier dans upload/ |
| 85 | 85 | if (is_string($source)) { |
| 86 | 86 | if (file_exists($source)) { |
| 87 | 87 | $ok = @copy($source, $file_tmp); |
| 88 | - } elseif (file_exists($f = determine_upload() . $source)) { |
|
| 88 | + } elseif (file_exists($f = determine_upload().$source)) { |
|
| 89 | 89 | $ok = @copy($f, $file_tmp); |
| 90 | 90 | } |
| 91 | 91 | } elseif (!$erreur = check_upload_error($source['error'], '', true)) { |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | if ($size = @spip_getimagesize($file_tmp) |
| 108 | 108 | and $extension = logo_decoder_type_image($size[2]) |
| 109 | 109 | and in_array($extension, $GLOBALS['formats_logos'])) { |
| 110 | - @rename($file_tmp, $file_tmp . ".$extension"); |
|
| 111 | - $file_tmp = $file_tmp . ".$extension"; |
|
| 110 | + @rename($file_tmp, $file_tmp.".$extension"); |
|
| 111 | + $file_tmp = $file_tmp.".$extension"; |
|
| 112 | 112 | $poids = filesize($file_tmp); |
| 113 | 113 | |
| 114 | 114 | if (defined('_LOGO_MAX_WIDTH') or defined('_LOGO_MAX_HEIGHT')) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (!$erreur) { |
| 176 | - @rename($file_tmp, _DIR_LOGOS . $nom . ".$extension"); |
|
| 176 | + @rename($file_tmp, _DIR_LOGOS.$nom.".$extension"); |
|
| 177 | 177 | } |
| 178 | 178 | } else { |
| 179 | 179 | spip_unlink($file_tmp); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (!isset($options['titre'])) { |
| 66 | 66 | $balise_img = chercher_filtre('balise_img'); |
| 67 | - $img = $balise_img(chemin_image('image-24.png'),'', 'cadre-icone'); |
|
| 67 | + $img = $balise_img(chemin_image('image-24.png'), '', 'cadre-icone'); |
|
| 68 | 68 | $libelles = pipeline('libeller_logo', $GLOBALS['logo_libelles']); |
| 69 | 69 | $libelle = (($id_objet or $objet != 'rubrique') ? $objet : 'racine'); |
| 70 | 70 | if (isset($libelles[$libelle])) { |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | switch ($objet) { |
| 78 | 78 | case 'article': |
| 79 | - $libelle .= ' ' . aider('logoart'); |
|
| 79 | + $libelle .= ' '.aider('logoart'); |
|
| 80 | 80 | break; |
| 81 | 81 | case 'breve': |
| 82 | - $libelle .= ' ' . aider('breveslogo'); |
|
| 82 | + $libelle .= ' '.aider('breveslogo'); |
|
| 83 | 83 | break; |
| 84 | 84 | case 'rubrique': |
| 85 | - $libelle .= ' ' . aider('rublogo'); |
|
| 85 | + $libelle .= ' '.aider('rublogo'); |
|
| 86 | 86 | break; |
| 87 | 87 | default: |
| 88 | 88 | break; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $options['titre'] = $img . $libelle; |
|
| 91 | + $options['titre'] = $img.$libelle; |
|
| 92 | 92 | } |
| 93 | 93 | if (!isset($options['editable'])) { |
| 94 | 94 | include_spip('inc/autoriser'); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | foreach ($etats as $etat) { |
| 114 | 114 | $logo = $chercher_logo($id_objet, $_id_objet, $etat); |
| 115 | 115 | if ($logo) { |
| 116 | - $res['logo_' . $etat] = $logo[0]; |
|
| 116 | + $res['logo_'.$etat] = $logo[0]; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | // pas de logo_on -> pas de formulaire pour le survol |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | strtolower(pathinfo($file['name'], PATHINFO_EXTENSION)), |
| 177 | 177 | $extensions_possibles |
| 178 | 178 | )) { |
| 179 | - $erreurs['logo_' . $etat] = _L('Extension non reconnue'); |
|
| 179 | + $erreurs['logo_'.$etat] = _L('Extension non reconnue'); |
|
| 180 | 180 | } |
| 181 | 181 | } elseif ($file and $file['error'] != 0 and isset($file['msg'])) { |
| 182 | 182 | $erreurs['message_erreur'] = $file['msg']; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | include_spip('inc/documents'); |
| 262 | 262 | $sources = array(); |
| 263 | 263 | foreach (array('on', 'off') as $etat) { |
| 264 | - $logo = 'logo_' . $etat; |
|
| 264 | + $logo = 'logo_'.$etat; |
|
| 265 | 265 | if (isset($_FILES[$logo])) { |
| 266 | 266 | if ($_FILES[$logo]['error'] == 0) { |
| 267 | 267 | $sources[$etat] = $_FILES[$logo]; |