Completed
Push — master ( 2db97a...762316 )
by cam
02:04
created
ecrire/inc/svg.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 	if (!file_exists($fichier)) {
58 58
 		include_spip('inc/filtres');
59
-		$fichier  = supprimer_timestamp($fichier);
59
+		$fichier = supprimer_timestamp($fichier);
60 60
 		if (!file_exists($fichier)) {
61 61
 			return false;
62 62
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 function svg_change_balise_svg($svg, $old_balise_svg, $attributs) {
147 147
 	$new_balise_svg = '<svg';
148 148
 	foreach ($attributs as $k => $v) {
149
-		$new_balise_svg .= " $k=\"" . entites_html($v) . '"';
149
+		$new_balise_svg .= " $k=\"".entites_html($v).'"';
150 150
 	}
151 151
 	$new_balise_svg .= '>';
152 152
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 function svg_insert_shapes($svg, $shapes, $start = true) {
165 165
 
166 166
 	if ($start === false || $start === 'end') {
167
-		$svg = str_replace('</svg>', $shapes . '</svg>', $svg);
167
+		$svg = str_replace('</svg>', $shapes.'</svg>', $svg);
168 168
 	}
169 169
 	else {
170 170
 		$p = stripos($svg, '<svg');
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
  */
186 186
 function svg_clip_in_box($svg, $x, $y, $width, $height) {
187 187
 	$rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />";
188
-	$id = 'clip-' . substr(md5($rect . strlen($svg)), 0, 8);
188
+	$id = 'clip-'.substr(md5($rect.strlen($svg)), 0, 8);
189 189
 	$clippath = "<clipPath id=\"$id\">$rect</clipPath>";
190 190
 	$g = "<g clip-path=\"url(#$id)\">";
191
-	$svg = svg_insert_shapes($svg, $clippath . $g);
191
+	$svg = svg_insert_shapes($svg, $clippath.$g);
192 192
 	return svg_insert_shapes($svg, '</g>', false);
193 193
 }
194 194
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	) {
207 207
 		[$balise_svg, $attributs] = $svg_infos;
208 208
 		if (!isset($attributs['viewBox'])) {
209
-			$attributs['viewBox'] = '0 0 ' . $attributs['width'] . ' ' . $attributs['height'];
209
+			$attributs['viewBox'] = '0 0 '.$attributs['width'].' '.$attributs['height'];
210 210
 		}
211 211
 		$attributs['width'] = (string) $new_width;
212 212
 		$attributs['height'] = (string) $new_height;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	else {
230 230
 		$couleur = couleur_html_to_hex($couleur);
231 231
 	}
232
-	return '#' . ltrim($couleur, '#');
232
+	return '#'.ltrim($couleur, '#');
233 233
 }
234 234
 
235 235
 /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 function svg_couleur_to_rgb($couleur) {
241 241
 	if (str_starts_with($couleur, 'rgb(')) {
242 242
 		$c = explode(',', substr($couleur, 4));
243
-		return ['red' => (int) $c[0],'green' => (int) $c[1],'blue' => (int) $c[2]];
243
+		return ['red' => (int) $c[0], 'green' => (int) $c[1], 'blue' => (int) $c[2]];
244 244
 	}
245 245
 	return _couleur_hex_to_dec($couleur);
246 246
 }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			$background_color = svg_couleur_to_hexa($background_color);
455 455
 			if (isset($attributs['viewBox'])) {
456 456
 				$viewBox = explode(' ', $attributs['viewBox']);
457
-				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>";
457
+				$rect = '<rect x="'.$viewBox[0].'" y="'.$viewBox[1].'" width="'.$viewBox[2].'" height="'.$viewBox[3]."\" fill=\"$background_color\"/>";
458 458
 			}
459 459
 			else {
460 460
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 			$background_color = svg_couleur_to_hexa($background_color);
485 485
 			if (isset($attributs['viewBox'])) {
486 486
 				$viewBox = explode(' ', $attributs['viewBox']);
487
-				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>";
487
+				$rect = '<rect x="'.$viewBox[0].'" y="'.$viewBox[1].'" width="'.$viewBox[2].'" height="'.$viewBox[3]."\" fill=\"$background_color\" opacity=\"$opacity\"/>";
488 488
 			}
489 489
 			else {
490 490
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			$g = '<g';
514 514
 			foreach ($attributs as $k => $v) {
515 515
 				if (strlen($v)) {
516
-					$g .= " $k=\"" . attribut_html($v) . '"';
516
+					$g .= " $k=\"".attribut_html($v).'"';
517 517
 				}
518 518
 			}
519 519
 			if (strlen($g) > 2) {
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 	) {
542 542
 		if ($filter_def) {
543 543
 			[$balise_svg, ] = $svg_infos;
544
-			$filter_id = 'filter-' . substr(md5($filter_def . strlen($svg)), 0, 8);
544
+			$filter_id = 'filter-'.substr(md5($filter_def.strlen($svg)), 0, 8);
545 545
 			$filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>";
546 546
 			$g = "<g filter=\"url(#$filter_id)\">";
547
-			$svg = svg_insert_shapes($svg, $filter . $g);
547
+			$svg = svg_insert_shapes($svg, $filter.$g);
548 548
 			$svg = svg_insert_shapes($svg, '</g>', false);
549 549
 		}
550 550
 		return $svg;
Please login to merge, or discard this patch.