@@ -191,7 +191,7 @@ |
||
| 191 | 191 | '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', |
| 192 | 192 | $html, |
| 193 | 193 | -1, |
| 194 | - \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY |
|
| 194 | + \PREG_SPLIT_DELIM_CAPTURE|\PREG_SPLIT_NO_EMPTY |
|
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | 197 | if (false === $htmlArrayTemp) { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes |
| 102 | - $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/] |
|
| 102 | + $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function(array $match): string { // ^[/] |
|
| 103 | 103 | if (!isset($this->svgFileArr[$match['src']])) { // check usage |
| 104 | 104 | return $match[0]; |
| 105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | }, $dom['body']); |
| 110 | 110 | |
| 111 | 111 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes |
| 112 | - $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/] |
|
| 112 | + $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/] |
|
| 113 | 113 | if (!isset($this->svgFileArr[$match['data']])) { // check usage |
| 114 | 114 | return $match[0]; |
| 115 | 115 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // }, $svg); |
| 163 | 163 | |
| 164 | 164 | // https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes |
| 165 | - $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function (array $match) use (&$attr): string { |
|
| 165 | + $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function(array $match) use (&$attr): string { |
|
| 166 | 166 | if (false === preg_match_all('/(?!\s)(?<attr>[a-z\-]+)="\s*(?<value>[^"]+)\s*"/i', $match[1], $matches)) { |
| 167 | 167 | return $match[0]; |
| 168 | 168 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | $svg = preg_replace_callback( |
| 226 | 226 | '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)(?:#[^"]*?)?"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
| 227 | - function (array $match): string { |
|
| 227 | + function(array $match): string { |
|
| 228 | 228 | if (!isset($this->svgFileArr[$match['href']])) { // check usage |
| 229 | 229 | return $match[0]; |
| 230 | 230 | } |