@@ -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 | |
50 | 50 | if (!isset($this->svgFileArr[$match['src']])) { // check usage |
51 | 51 | return $match[0]; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | }, $html['body']); |
57 | 57 | |
58 | 58 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes |
59 | - $html['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/] |
|
59 | + $html['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/] |
|
60 | 60 | |
61 | 61 | if (!isset($this->svgFileArr[$match['data']])) { // check usage |
62 | 62 | return $match[0]; |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | $svg = preg_replace('/.*<svg|<\/svg>.*|xlink:|\s(?:(?:version|xmlns)|(?:[a-z\-]+\:[a-z\-]+))="[^"]*"/s', '', $svg); // cleanup |
106 | 106 | |
107 | 107 | // https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes |
108 | - $svg = preg_replace_callback('/([^>]+)\s*(?=>)/s', function (array $match) use(&$attr): string { |
|
108 | + $svg = preg_replace_callback('/([^>]+)\s*(?=>)/s', function(array $match) use(&$attr): string { |
|
109 | 109 | |
110 | - if(false === preg_match_all('/\s(?<attr>[\w\-]+)=["\']\s*(?<value>[^"\']+)\s*["\']/', $match[1], $matches)) { |
|
110 | + if (false === preg_match_all('/\s(?<attr>[\w\-]+)=["\']\s*(?<value>[^"\']+)\s*["\']/', $match[1], $matches)) { |
|
111 | 111 | return $match[0]; |
112 | 112 | } |
113 | - foreach($matches['attr'] as $index => $attribute) |
|
113 | + foreach ($matches['attr'] as $index => $attribute) |
|
114 | 114 | { |
115 | - switch($attribute) |
|
115 | + switch ($attribute) |
|
116 | 116 | { |
117 | 117 | case 'id': |
118 | 118 | case 'width': |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $svg = preg_replace_callback( |
152 | 152 | '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)#[^"]+"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s', |
153 | - function (array $match): string { |
|
153 | + function(array $match): string { |
|
154 | 154 | return sprintf('<use%s href="#%s"/>', $match['pre'].$match['post'], $this->convertFilePath($match['href'])); |
155 | 155 | }, |
156 | 156 | '<svg xmlns="http://www.w3.org/2000/svg">' |
@@ -28,7 +28,7 @@ |
||
28 | 28 | if (!($response instanceof NullResponse) |
29 | 29 | && $GLOBALS['TSFE'] instanceof TypoScriptFrontendController |
30 | 30 | && false !== (bool) $GLOBALS['TSFE']->config['config']['svgstore.']['enabled'] |
31 | - && 'text/html' == substr($response->getHeaderLine('Content-Type'),0,9) |
|
31 | + && 'text/html' == substr($response->getHeaderLine('Content-Type'), 0, 9) |
|
32 | 32 | ) { |
33 | 33 | $processedHtml = GeneralUtility::makeInstance(\HTML\Sourceopt\Service\SvgStoreService::class) |
34 | 34 | ->process($response->getBody()->__toString()) |
@@ -39,7 +39,7 @@ |
||
39 | 39 | if (!($response instanceof NullResponse) |
40 | 40 | && $GLOBALS['TSFE'] instanceof TypoScriptFrontendController |
41 | 41 | && false !== (bool) $GLOBALS['TSFE']->config['config']['sourceopt.']['enabled'] |
42 | - && 'text/html' == substr($response->getHeaderLine('Content-Type'),0,9) |
|
42 | + && 'text/html' == substr($response->getHeaderLine('Content-Type'), 0, 9) |
|
43 | 43 | ) { |
44 | 44 | $processedHtml = $this->cleanHtmlService->clean( |
45 | 45 | $response->getBody()->__toString(), |