From 42da0def8e256fcaf25b7e696de0cf89e60463f1 Mon Sep 17 00:00:00 2001 From: Martin Folkers Date: Sun, 9 Aug 2020 15:20:08 +0200 Subject: [PATCH] Changing `setStyle` to `setAttribute` This fixes #1, so no more CSP violation because of `unsafe-inline` --- lib/Donut.php | 2 +- lib/Segment.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Donut.php b/lib/Donut.php index 516d452..588bb33 100644 --- a/lib/Donut.php +++ b/lib/Donut.php @@ -26,7 +26,7 @@ class Donut /** * Current version number of tiny-phpeanuts */ - const VERSION = '0.1.0'; + const VERSION = '0.2.0'; /** diff --git a/lib/Segment.php b/lib/Segment.php index ebea689..2c93dba 100644 --- a/lib/Segment.php +++ b/lib/Segment.php @@ -48,15 +48,15 @@ public function getSVGElement(): \SVG\Nodes\Shapes\SVGCircle $this->size / 2, $this->size / 2, $radius - ))->setStyle('fill', $this->backgroundColor); + ))->setAttribute('fill', $this->backgroundColor); if ($this->backgroundColor === 'transparent') { $circle - ->setStyle('fill-opacity', 0) - ->setStyle('stroke', $this->color) - ->setStyle('stroke-width', (string) $this->thickness) - ->setStyle('stroke-dashoffset', (string) $offset) - ->setStyle('stroke-dasharray', Butler::join([ + ->setAttribute('fill-opacity', 0) + ->setAttribute('stroke', $this->color) + ->setAttribute('stroke-width', (string) $this->thickness) + ->setAttribute('stroke-dashoffset', (string) $offset) + ->setAttribute('stroke-dasharray', Butler::join([ (string) $lengthOnCircle, (string) $circumference - $lengthOnCircle ], ' '))