@@ -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) { |
@@ -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="(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/] |
|
| 53 | + $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?<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 = preg_replace('/^.*?<svg|\s*(<\/svg>)(?!.*\1).*$|xlink:|\s(?:(?:version|xmlns)|(?:[a-z\-]+\:[a-z\-]+))="[^"]*"/s', '', $svg); // cleanup |
| 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 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | $svg = preg_replace_callback( |
| 164 | 164 | '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)#[^"]+"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
| 165 | - function (array $match): string { |
|
| 165 | + function(array $match): string { |
|
| 166 | 166 | if (!isset($this->svgFileArr[$match['href']])) { // check usage |
| 167 | 167 | return $match[0]; |
| 168 | 168 | } |