@@ -142,6 +142,9 @@ function generateCard(array $stats, array $params = null): string
142
142
// number formatter
143
143
$ numFormatter = new NumberFormatter ($ localeCode , NumberFormatter::DECIMAL );
144
144
145
+ // read border_radius parameter, default to 4.5 if not set
146
+ $ borderRadius = $ params ["border_radius " ] ?? "4.5 " ;
147
+
145
148
// total contributions
146
149
$ totalContributions = $ numFormatter ->format ($ stats ["totalContributions " ]);
147
150
$ firstContribution = formatDate ($ stats ["firstContribution " ], $ dateFormat , $ localeCode );
@@ -179,7 +182,7 @@ function generateCard(array $stats, array $params = null): string
179
182
</style>
180
183
<defs>
181
184
<clipPath id='outer_rectangle'>
182
- <rect width='495' height='195'/>
185
+ <rect width='495' height='195' rx=' { $ borderRadius } ' />
183
186
</clipPath>
184
187
<mask id='mask_out_ring_behind_fire'>
185
188
<rect width='495' height='195' fill='white'/>
@@ -188,8 +191,7 @@ function generateCard(array $stats, array $params = null): string
188
191
</defs>
189
192
<g clip-path='url(#outer_rectangle)'>
190
193
<g style='isolation:isolate'>
191
- <path d='M 4.5 0 L 490.5 0 C 492.984 0 495 2.016 495 4.5 L 495 190.5 C 495 192.984 492.984 195 490.5 195 L 4.5 195 C 2.016 195 0 192.984 0 190.5 L 0 4.5 C 0 2.016 2.016 0 4.5 0 Z'
192
- style='stroke: {$ theme ["border " ]}; fill: {$ theme ["background " ]};stroke-miterlimit:10;rx: 4.5;'/>
194
+ <rect stroke=' {$ theme ["border " ]}' fill=' {$ theme ["background " ]}' rx=' {$ borderRadius }' x='0.5' y='0.5' width='494' height='194'/>
193
195
</g>
194
196
<g style='isolation:isolate'>
195
197
<line x1='330' y1='28' x2='330' y2='170' vector-effect='non-scaling-stroke' stroke-width='1' stroke=' {$ theme ["stroke " ]}' stroke-linejoin='miter' stroke-linecap='square' stroke-miterlimit='3'/>
@@ -301,6 +303,9 @@ function generateErrorCard(string $message, array $params = null): string
301
303
// get requested theme, use $_REQUEST if no params array specified
302
304
$ theme = getRequestedTheme ($ params );
303
305
306
+ // read border_radius parameter, default to 4.5 if not set
307
+ $ borderRadius = $ params ["border_radius " ] ?? "4.5 " ;
308
+
304
309
return "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='isolation:isolate' viewBox='0 0 495 195' width='495px' height='195px'>
305
310
<style>
306
311
a {
@@ -309,13 +314,12 @@ function generateErrorCard(string $message, array $params = null): string
309
314
</style>
310
315
<defs>
311
316
<clipPath id='outer_rectangle'>
312
- <rect width='495' height='195'/>
317
+ <rect width='495' height='195' rx=' { $ borderRadius } ' />
313
318
</clipPath>
314
319
</defs>
315
320
<g clip-path='url(#outer_rectangle)'>
316
321
<g style='isolation:isolate'>
317
- <path d='M 4.5 0 L 490.5 0 C 492.984 0 495 2.016 495 4.5 L 495 190.5 C 495 192.984 492.984 195 490.5 195 L 4.5 195 C 2.016 195 0 192.984 0 190.5 L 0 4.5 C 0 2.016 2.016 0 4.5 0 Z'
318
- style='stroke: {$ theme ["border " ]}; fill: {$ theme ["background " ]};stroke-miterlimit:10;rx: 4.5;'/>
322
+ <rect stroke=' {$ theme ["border " ]}' fill=' {$ theme ["background " ]}' rx=' {$ borderRadius }' x='0.5' y='0.5' width='494' height='194'/>
319
323
</g>
320
324
<g style='isolation:isolate'>
321
325
<!-- Error Label -->
@@ -329,8 +333,8 @@ function generateErrorCard(string $message, array $params = null): string
329
333
<!-- mask for background behind face -->
330
334
<defs>
331
335
<mask id='cut-off-area'>
332
- <rect x='0' y='0' width='500' height='500' fill='white' />
333
- <ellipse cx='247.5' cy='31' rx='13' ry='18'/>
336
+ <rect x='0' y='0' width='500' height='500' fill='white' />
337
+ <ellipse cx='247.5' cy='31' rx='13' ry='18'/>
334
338
</mask>
335
339
</defs>
336
340
<!-- Sad face -->
@@ -362,7 +366,7 @@ function convertSvgToPng(string $svg): string
362
366
$ svg = preg_replace ("/(<style>\X*?<\/style>)/m " , "" , $ svg );
363
367
$ svg = preg_replace ("/(opacity: 0;)/m " , "opacity: 1; " , $ svg );
364
368
$ svg = preg_replace ("/(animation: fadein.*?;)/m " , "opacity: 1; " , $ svg );
365
- $ svg = preg_replace ("/(animation: currentstreak .*?;)/m " , "font-size: 28px; " , $ svg );
369
+ $ svg = preg_replace ("/(animation: currstreak .*?;)/m " , "font-size: 28px; " , $ svg );
366
370
$ svg = preg_replace ("/<a \X*?>(\X*?)<\/a>/m " , '\1 ' , $ svg );
367
371
368
372
// save svg to random file
0 commit comments