fix id collisions causing truncated shield svgs
This commit is contained in:
parent
8adadb0be1
commit
5801030e31
@ -15,6 +15,12 @@ function mkshield($left_str, $right_str, $color_str) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$retn = file_get_contents('https://img.shields.io/badge/'.$filename);
|
$retn = file_get_contents('https://img.shields.io/badge/'.$filename);
|
||||||
|
|
||||||
|
// We need unique IDs
|
||||||
|
$prefix = substr(sha1($filename), 8).'-';
|
||||||
|
$retn = str_replace('id="', 'id="'.$prefix, $retn);
|
||||||
|
$retn = str_replace('url(#', 'url(#'.$prefix, $retn);
|
||||||
|
|
||||||
file_put_contents($cache_path, $retn);
|
file_put_contents($cache_path, $retn);
|
||||||
return $retn;
|
return $retn;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user