@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes |
53 | - $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/] |
|
53 | + $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function(array $match): string { // ^[/] |
|
54 | 54 | if (!isset($this->svgFileArr[$match['src']])) { // check usage |
55 | 55 | return $match[0]; |
56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | }, $dom['body']); |
61 | 61 | |
62 | 62 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes |
63 | - $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/] |
|
63 | + $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/] |
|
64 | 64 | if (!isset($this->svgFileArr[$match['data']])) { // check usage |
65 | 65 | return $match[0]; |
66 | 66 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // }, $svg); |
112 | 112 | |
113 | 113 | // https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes |
114 | - $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function (array $match) use (&$attr): string { |
|
114 | + $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function(array $match) use (&$attr): string { |
|
115 | 115 | if (false === preg_match_all('/(?!\s)(?<attr>[\w\-]+)="\s*(?<value>[^"]+)\s*"/', $match[1], $matches)) { |
116 | 116 | return $match[0]; |
117 | 117 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | $svg = preg_replace_callback( |
167 | 167 | '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)#[^"]+"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
168 | - function (array $match): string { |
|
168 | + function(array $match): string { |
|
169 | 169 | if (!isset($this->svgFileArr[$match['href']])) { // check usage |
170 | 170 | return $match[0]; |
171 | 171 | } |