@@ -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) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes |
| 48 | - $html['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/] |
|
| 48 | + $html['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function(array $match): string { // ^[/] |
|
| 49 | 49 | if (!isset($this->svgFileArr[$match['src']])) { // check usage |
| 50 | 50 | return $match[0]; |
| 51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | }, $html['body']); |
| 56 | 56 | |
| 57 | 57 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes |
| 58 | - $html['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/] |
|
| 58 | + $html['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/] |
|
| 59 | 59 | if (!isset($this->svgFileArr[$match['data']])) { // check usage |
| 60 | 60 | return $match[0]; |
| 61 | 61 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $svg = preg_replace('/.*<svg|<\/svg>.*|xlink:|\s(?:(?:version|xmlns)|(?:[a-z\-]+\:[a-z\-]+))="[^"]*"/s', '', $svg); // cleanup |
| 103 | 103 | |
| 104 | 104 | // https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes |
| 105 | - $svg = preg_replace_callback('/([^>]+)\s*(?=>)/s', function (array $match) use (&$attr): string { |
|
| 105 | + $svg = preg_replace_callback('/([^>]+)\s*(?=>)/s', function(array $match) use (&$attr): string { |
|
| 106 | 106 | if (false === preg_match_all('/\s(?<attr>[\w\-]+)=["\']\s*(?<value>[^"\']+)\s*["\']/', $match[1], $matches)) { |
| 107 | 107 | return $match[0]; |
| 108 | 108 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $svg = preg_replace_callback( |
| 148 | 148 | '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)#[^"]+"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
| 149 | - function (array $match): string { |
|
| 149 | + function(array $match): string { |
|
| 150 | 150 | if (!isset($this->svgFileArr[$match['href']])) { // check usage |
| 151 | 151 | return $match[0]; |
| 152 | 152 | } |