@@ -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) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes |
| 92 | - $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/] |
|
| 92 | + $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function(array $match): string { // ^[/] |
|
| 93 | 93 | if (!isset($this->svgFileArr[$match['src']])) { // check usage |
| 94 | 94 | return $match[0]; |
| 95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | }, $dom['body']); |
| 100 | 100 | |
| 101 | 101 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes |
| 102 | - $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/] |
|
| 102 | + $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/] |
|
| 103 | 103 | if (!isset($this->svgFileArr[$match['data']])) { // check usage |
| 104 | 104 | return $match[0]; |
| 105 | 105 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // }, $svg); |
| 153 | 153 | |
| 154 | 154 | // https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes |
| 155 | - $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function (array $match) use (&$attr): string { |
|
| 155 | + $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function(array $match) use (&$attr): string { |
|
| 156 | 156 | if (false === preg_match_all('/(?!\s)(?<attr>[\w\-]+)="\s*(?<value>[^"]+)\s*"/', $match[1], $matches)) { |
| 157 | 157 | return $match[0]; |
| 158 | 158 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $svg = preg_replace_callback( |
| 208 | 208 | '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)(?:#[^"]*?)?"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
| 209 | - function (array $match): string { |
|
| 209 | + function(array $match): string { |
|
| 210 | 210 | if (!isset($this->svgFileArr[$match['href']])) { // check usage |
| 211 | 211 | return $match[0]; |
| 212 | 212 | } |