|
@@ -48,7 +48,7 @@ discard block |
|
|
block discarded – undo |
|
48
|
48
|
} |
|
49
|
49
|
|
|
50
|
50
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes |
|
51
|
|
- $html['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/] |
|
|
51
|
+ $html['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function(array $match): string { // ^[/] |
|
52
|
52
|
if (!isset($this->svgFileArr[$match['src']])) { // check usage |
|
53
|
53
|
return $match[0]; |
|
54
|
54
|
} |
|
@@ -58,7 +58,7 @@ discard block |
|
|
block discarded – undo |
|
58
|
58
|
}, $html['body']); |
|
59
|
59
|
|
|
60
|
60
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes |
|
61
|
|
- $html['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/] |
|
|
61
|
+ $html['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/] |
|
62
|
62
|
if (!isset($this->svgFileArr[$match['data']])) { // check usage |
|
63
|
63
|
return $match[0]; |
|
64
|
64
|
} |
|
@@ -105,7 +105,7 @@ discard block |
|
|
block discarded – undo |
|
105
|
105
|
$svg = preg_replace('/^.*?<svg|\s*(<\/svg>)(?!.*\1).*$|xlink:|\s(?:(?:version|xmlns)|(?:[a-z\-]+\:[a-z\-]+))="[^"]*"/s', '', $svg); // cleanup |
|
106
|
106
|
|
|
107
|
107
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes |
|
108
|
|
- $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function (array $match) use (&$attr): string { |
|
|
108
|
+ $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function(array $match) use (&$attr): string { |
|
109
|
109
|
if (false === preg_match_all('/(?!\s)(?<attr>[\w\-]+)="\s*(?<value>[^"]+)\s*"/', $match[1], $matches)) { |
|
110
|
110
|
return $match[0]; |
|
111
|
111
|
} |
|
@@ -156,7 +156,7 @@ discard block |
|
|
block discarded – undo |
|
156
|
156
|
|
|
157
|
157
|
$svg = preg_replace_callback( |
|
158
|
158
|
'/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)#[^"]+"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
|
159
|
|
- function (array $match): string { |
|
|
159
|
+ function(array $match): string { |
|
160
|
160
|
if (!isset($this->svgFileArr[$match['href']])) { // check usage |
|
161
|
161
|
return $match[0]; |
|
162
|
162
|
} |