@@ -524,8 +524,7 @@ discard block |
||
| 524 | 524 | process_image_svg_identite($ret); |
| 525 | 525 | $ret['creer'] = false; |
| 526 | 526 | } |
| 527 | - } |
|
| 528 | - else { |
|
| 527 | + } else { |
|
| 529 | 528 | if (!function_exists($ret['fonction_imagecreatefrom'])) { |
| 530 | 529 | return false; |
| 531 | 530 | } |
@@ -628,8 +627,7 @@ discard block |
||
| 628 | 627 | |
| 629 | 628 | if (isset($info['mime'])) { |
| 630 | 629 | $mime = $info['mime']; |
| 631 | - } |
|
| 632 | - else { |
|
| 630 | + } else { |
|
| 633 | 631 | $mime = image_type_to_mime_type($info[2]); |
| 634 | 632 | } |
| 635 | 633 | |
@@ -1408,9 +1406,7 @@ discard block |
||
| 1408 | 1406 | if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) { |
| 1409 | 1407 | $vignette = $destination . '.' . $format; |
| 1410 | 1408 | @copy($image, $vignette); |
| 1411 | - } |
|
| 1412 | - |
|
| 1413 | - elseif ($valeurs['format_source'] === 'svg') { |
|
| 1409 | + } elseif ($valeurs['format_source'] === 'svg') { |
|
| 1414 | 1410 | if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) { |
| 1415 | 1411 | $format_sortie = 'svg'; |
| 1416 | 1412 | $vignette = $destination . '.' . $format_sortie; |
@@ -1846,8 +1842,7 @@ discard block |
||
| 1846 | 1842 | $date = test_espace_prive() ? ('?' . $date) : ''; |
| 1847 | 1843 | |
| 1848 | 1844 | return _image_ecrire_tag($image, ['src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight]); |
| 1849 | - } |
|
| 1850 | - else { |
|
| 1845 | + } else { |
|
| 1851 | 1846 | # BMP, tiff ... les redacteurs osent tout! |
| 1852 | 1847 | return $img; |
| 1853 | 1848 | } |
@@ -193,11 +193,9 @@ |
||
| 193 | 193 | |
| 194 | 194 | if ($statut and test_espace_prive()) { |
| 195 | 195 | $corps = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil')); |
| 196 | - } |
|
| 197 | - elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 196 | + } elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 198 | 197 | $corps = bouton_action(_T('public:lien_connecter'), generer_url_public('login')); |
| 199 | - } |
|
| 200 | - else { |
|
| 198 | + } else { |
|
| 201 | 199 | $corps = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site']); |
| 202 | 200 | } |
| 203 | 201 | $corps = "<div class='boutons'>$corps</div>"; |
@@ -173,8 +173,7 @@ |
||
| 173 | 173 | // sinon on ecrit directement sur stdout |
| 174 | 174 | if ($options['envoyer'] and $options['envoyer'] !== 'attachment') { |
| 175 | 175 | $fichier = 'php://output'; |
| 176 | - } |
|
| 177 | - else { |
|
| 176 | + } else { |
|
| 178 | 177 | $fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename; |
| 179 | 178 | } |
| 180 | 179 | |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | if (is_null($maxlen)) { |
| 65 | 65 | $image = file_get_contents($fichier); |
| 66 | - } |
|
| 67 | - else { |
|
| 66 | + } else { |
|
| 68 | 67 | $image = file_get_contents($fichier, false, null, 0, $maxlen); |
| 69 | 68 | } |
| 70 | 69 | // est-ce bien une image svg ? |
@@ -190,8 +189,7 @@ discard block |
||
| 190 | 189 | |
| 191 | 190 | if ($start === false or $start === 'end') { |
| 192 | 191 | $svg = str_replace('</svg>', $shapes . '</svg>', $svg); |
| 193 | - } |
|
| 194 | - else { |
|
| 192 | + } else { |
|
| 195 | 193 | $p = stripos($svg, '<svg'); |
| 196 | 194 | $p = strpos($svg, '>', $p); |
| 197 | 195 | $svg = substr_replace($svg, $shapes, $p + 1, 0); |
@@ -253,8 +251,7 @@ discard block |
||
| 253 | 251 | if (strpos($couleur, 'rgb(') === 0) { |
| 254 | 252 | $c = explode(',', substr($couleur, 4)); |
| 255 | 253 | $couleur = _couleur_dec_to_hex(intval($c[0]), intval($c[1]), intval($c[2])); |
| 256 | - } |
|
| 257 | - else { |
|
| 254 | + } else { |
|
| 258 | 255 | $couleur = couleur_html_to_hex($couleur); |
| 259 | 256 | } |
| 260 | 257 | $couleur = '#' . ltrim($couleur, '#'); |
@@ -305,17 +302,14 @@ discard block |
||
| 305 | 302 | and $w = svg_dimension_to_pixels($attributs['width']) |
| 306 | 303 | ) { |
| 307 | 304 | $width = $w; |
| 308 | - } |
|
| 309 | - else { |
|
| 305 | + } else { |
|
| 310 | 306 | // si on recupere la taille de la viewbox mais si la viewbox est petite on met un multiplicateur pour la taille finale |
| 311 | 307 | $width = $viewBox[2]; |
| 312 | 308 | if ($width < 1) { |
| 313 | 309 | $coeff = max($coeff, 1000); |
| 314 | - } |
|
| 315 | - elseif ($width < 10) { |
|
| 310 | + } elseif ($width < 10) { |
|
| 316 | 311 | $coeff = max($coeff, 100); |
| 317 | - } |
|
| 318 | - elseif ($width < 100) { |
|
| 312 | + } elseif ($width < 100) { |
|
| 319 | 313 | $coeff = max($coeff, 10); |
| 320 | 314 | } |
| 321 | 315 | } |
@@ -324,16 +318,13 @@ discard block |
||
| 324 | 318 | and $h = svg_dimension_to_pixels($attributs['height']) |
| 325 | 319 | ) { |
| 326 | 320 | $height = $h; |
| 327 | - } |
|
| 328 | - else { |
|
| 321 | + } else { |
|
| 329 | 322 | $height = $viewBox[3]; |
| 330 | 323 | if ($height < 1) { |
| 331 | 324 | $coeff = max($coeff, 1000); |
| 332 | - } |
|
| 333 | - elseif ($height < 10) { |
|
| 325 | + } elseif ($height < 10) { |
|
| 334 | 326 | $coeff = max($coeff, 100); |
| 335 | - } |
|
| 336 | - elseif ($height < 100) { |
|
| 327 | + } elseif ($height < 100) { |
|
| 337 | 328 | $coeff = max($coeff, 10); |
| 338 | 329 | } |
| 339 | 330 | } |
@@ -475,8 +466,7 @@ discard block |
||
| 475 | 466 | if (isset($attributs['viewBox'])) { |
| 476 | 467 | $viewBox = explode(' ', $attributs['viewBox']); |
| 477 | 468 | $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>"; |
| 478 | - } |
|
| 479 | - else { |
|
| 469 | + } else { |
|
| 480 | 470 | $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>"; |
| 481 | 471 | } |
| 482 | 472 | $svg = svg_insert_shapes($svg, $rect); |
@@ -505,8 +495,7 @@ discard block |
||
| 505 | 495 | if (isset($attributs['viewBox'])) { |
| 506 | 496 | $viewBox = explode(' ', $attributs['viewBox']); |
| 507 | 497 | $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>"; |
| 508 | - } |
|
| 509 | - else { |
|
| 498 | + } else { |
|
| 510 | 499 | $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>"; |
| 511 | 500 | } |
| 512 | 501 | $svg = svg_insert_shapes($svg, $rect, false); |
@@ -627,8 +616,7 @@ discard block |
||
| 627 | 616 | $x = intval($viewBox[0]) + intval($viewBox[2] / 2); |
| 628 | 617 | $mx = -$x; |
| 629 | 618 | $transform = "translate($x, 0) $transform translate($mx, 0)"; |
| 630 | - } |
|
| 631 | - else { |
|
| 619 | + } else { |
|
| 632 | 620 | $transform = 'scale(1,-1)'; |
| 633 | 621 | |
| 634 | 622 | $y = intval($viewBox[1]) + intval($viewBox[3] / 2); |
@@ -689,8 +677,7 @@ discard block |
||
| 689 | 677 | $c = array_shift($colors); |
| 690 | 678 | if (strlen($c) == 4) { |
| 691 | 679 | $short[] = $c; |
| 692 | - } |
|
| 693 | - else { |
|
| 680 | + } else { |
|
| 694 | 681 | $long[] = $c; |
| 695 | 682 | } |
| 696 | 683 | } |
@@ -341,8 +341,7 @@ |
||
| 341 | 341 | ) { |
| 342 | 342 | if ($use_copy) { |
| 343 | 343 | @copy($fichier_tmp, $fichier); |
| 344 | - } |
|
| 345 | - else { |
|
| 344 | + } else { |
|
| 346 | 345 | @rename($fichier_tmp, $fichier); |
| 347 | 346 | } |
| 348 | 347 | // eviter que PHP ne reserve le vieux timestamp |
@@ -631,8 +631,7 @@ discard block |
||
| 631 | 631 | if (!$srcHeight) { |
| 632 | 632 | $hauteur_img[$src] = $srcHeight = $srcsize[1]; |
| 633 | 633 | } |
| 634 | - } |
|
| 635 | - elseif (strpos($src, '<svg') !== false) { |
|
| 634 | + } elseif (strpos($src, '<svg') !== false) { |
|
| 636 | 635 | include_spip('inc/svg'); |
| 637 | 636 | if ($attrs = svg_lire_attributs($src)) { |
| 638 | 637 | list($width, $height, $viewbox) = svg_getimagesize_from_attr($attrs); |
@@ -2125,8 +2124,7 @@ discard block |
||
| 2125 | 2124 | and !$is_class_presente |
| 2126 | 2125 | ) { |
| 2127 | 2126 | $class_new = rtrim($class_new) . ' ' . $c; |
| 2128 | - } |
|
| 2129 | - elseif ( |
|
| 2127 | + } elseif ( |
|
| 2130 | 2128 | in_array($operation, ['supprimer', 'commuter']) |
| 2131 | 2129 | and $is_class_presente |
| 2132 | 2130 | ) { |
@@ -2138,8 +2136,7 @@ discard block |
||
| 2138 | 2136 | if ($class_new !== $class_courante) { |
| 2139 | 2137 | if (strlen($class_new)) { |
| 2140 | 2138 | $balise = inserer_attribut($balise, 'class', $class_new); |
| 2141 | - } |
|
| 2142 | - elseif ($class_courante) { |
|
| 2139 | + } elseif ($class_courante) { |
|
| 2143 | 2140 | $balise = vider_attribut($balise, 'class'); |
| 2144 | 2141 | } |
| 2145 | 2142 | } |
@@ -3440,8 +3437,7 @@ discard block |
||
| 3440 | 3437 | ) { |
| 3441 | 3438 | if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) { |
| 3442 | 3439 | $img_file = $variante_svg_size; |
| 3443 | - } |
|
| 3444 | - else { |
|
| 3440 | + } else { |
|
| 3445 | 3441 | $img_file = $variante_svg_generique; |
| 3446 | 3442 | } |
| 3447 | 3443 | } |
@@ -3473,8 +3469,7 @@ discard block |
||
| 3473 | 3469 | } |
| 3474 | 3470 | if (!isset($options['chemin_image']) or $options['chemin_image'] == true) { |
| 3475 | 3471 | $img_file = chemin_image($img); |
| 3476 | - } |
|
| 3477 | - else { |
|
| 3472 | + } else { |
|
| 3478 | 3473 | if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true) { |
| 3479 | 3474 | $img_file = http_img_variante_svg_si_possible($img_file); |
| 3480 | 3475 | } |
@@ -3504,11 +3499,9 @@ discard block |
||
| 3504 | 3499 | } |
| 3505 | 3500 | if ($alt === false) { |
| 3506 | 3501 | $alt = ''; |
| 3507 | - } |
|
| 3508 | - elseif ($alt or $alt === '') { |
|
| 3502 | + } elseif ($alt or $alt === '') { |
|
| 3509 | 3503 | $alt = " alt='" . attribut_html($alt) . "'"; |
| 3510 | - } |
|
| 3511 | - else { |
|
| 3504 | + } else { |
|
| 3512 | 3505 | $alt = " alt='" . attribut_html($title) . "'"; |
| 3513 | 3506 | } |
| 3514 | 3507 | return "<img src='$img_file'$alt" |
@@ -3635,13 +3628,11 @@ discard block |
||
| 3635 | 3628 | if (!is_null($class)) { |
| 3636 | 3629 | if (strlen($class)) { |
| 3637 | 3630 | $img = inserer_attribut($img, 'class', $class); |
| 3638 | - } |
|
| 3639 | - else { |
|
| 3631 | + } else { |
|
| 3640 | 3632 | $img = vider_attribut($img, 'class'); |
| 3641 | 3633 | } |
| 3642 | 3634 | } |
| 3643 | - } |
|
| 3644 | - else { |
|
| 3635 | + } else { |
|
| 3645 | 3636 | $img = http_img_pack( |
| 3646 | 3637 | $img, |
| 3647 | 3638 | $alt, |
@@ -3726,8 +3717,7 @@ discard block |
||
| 3726 | 3717 | if (!is_null($class)) { |
| 3727 | 3718 | if (strlen($class)) { |
| 3728 | 3719 | $balise_svg = inserer_attribut($balise_svg, 'class', $class); |
| 3729 | - } |
|
| 3730 | - else { |
|
| 3720 | + } else { |
|
| 3731 | 3721 | $balise_svg = vider_attribut($balise_svg, 'class'); |
| 3732 | 3722 | } |
| 3733 | 3723 | } |
@@ -3739,8 +3729,7 @@ discard block |
||
| 3739 | 3729 | $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id); |
| 3740 | 3730 | $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n"; |
| 3741 | 3731 | $balise_svg .= $title; |
| 3742 | - } |
|
| 3743 | - else { |
|
| 3732 | + } else { |
|
| 3744 | 3733 | $balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true'); |
| 3745 | 3734 | } |
| 3746 | 3735 | |
@@ -5117,8 +5106,7 @@ discard block |
||
| 5117 | 5106 | // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine |
| 5118 | 5107 | if (isset($options['hash_on_content']) and $options['hash_on_content']) { |
| 5119 | 5108 | $hash = md5($contexte_implicite['host'] . '::' . $cache); |
| 5120 | - } |
|
| 5121 | - else { |
|
| 5109 | + } else { |
|
| 5122 | 5110 | unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js |
| 5123 | 5111 | ksort($contexte); |
| 5124 | 5112 | $hash = md5($fond . json_encode($contexte_implicite) . json_encode($contexte) . $connect); |
@@ -205,8 +205,7 @@ |
||
| 205 | 205 | // Marie Toto <[email protected]> => @toto.com |
| 206 | 206 | if (preg_match('/@[^\s>]+/', $from, $domain)) { |
| 207 | 207 | $domain = $domain[0]; |
| 208 | - } |
|
| 209 | - else { |
|
| 208 | + } else { |
|
| 210 | 209 | $domain = '@unknown-' . md5($from) . '.org'; |
| 211 | 210 | } |
| 212 | 211 | $uniq = rand() . '_' . md5($to . $texte) . $domain; |
@@ -335,8 +335,7 @@ |
||
| 335 | 335 | if (!autoriser('modifier', $type, intval($id))) { |
| 336 | 336 | $valeurs['editable'] = ''; |
| 337 | 337 | } |
| 338 | - } |
|
| 339 | - else { |
|
| 338 | + } else { |
|
| 340 | 339 | if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) { |
| 341 | 340 | $valeurs['editable'] = ''; |
| 342 | 341 | } |
@@ -238,8 +238,7 @@ discard block |
||
| 238 | 238 | if ($id === '*') { |
| 239 | 239 | unset($GLOBALS['autoriser_exception'][$faire][$type]); |
| 240 | 240 | unset($autorisation[$faire][$type]); |
| 241 | - } |
|
| 242 | - else { |
|
| 241 | + } else { |
|
| 243 | 242 | unset($GLOBALS['autoriser_exception'][$faire][$type][$id]); |
| 244 | 243 | unset($autorisation[$faire][$type][$id]); |
| 245 | 244 | } |
@@ -598,8 +597,7 @@ discard block |
||
| 598 | 597 | function autoriser_rubrique_creer_dist($faire, $type, $id, $qui, $opt) { |
| 599 | 598 | if (!empty($opt['id_parent'])) { |
| 600 | 599 | return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui); |
| 601 | - } |
|
| 602 | - else { |
|
| 600 | + } else { |
|
| 603 | 601 | return autoriser('defaut', null, null, $qui, $opt); |
| 604 | 602 | } |
| 605 | 603 | } |
@@ -745,8 +743,7 @@ discard block |
||
| 745 | 743 | if (!empty($opt['id_parent'])) { |
| 746 | 744 | // creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi |
| 747 | 745 | return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui); |
| 748 | - } |
|
| 749 | - else { |
|
| 746 | + } else { |
|
| 750 | 747 | return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], ['0minirezo', '1comite'])); |
| 751 | 748 | } |
| 752 | 749 | } |