diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-22 20:25:47 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-09 10:56:24 +0100 |
commit | 53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 (patch) | |
tree | 39cad52645ce00fbf863ff8e482d10dfcbe7f26c /application/formatter/BookmarkMarkdownFormatter.php | |
parent | e09bb93e18a333eff8e6a4156f5b58ba9c7d25cd (diff) | |
download | Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.gz Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.zst Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.zip |
Apply PHP Code Beautifier on source code for linter automatic fixes
Diffstat (limited to 'application/formatter/BookmarkMarkdownFormatter.php')
-rw-r--r-- | application/formatter/BookmarkMarkdownFormatter.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/application/formatter/BookmarkMarkdownFormatter.php b/application/formatter/BookmarkMarkdownFormatter.php index f7714be9..052333ca 100644 --- a/application/formatter/BookmarkMarkdownFormatter.php +++ b/application/formatter/BookmarkMarkdownFormatter.php | |||
@@ -71,7 +71,7 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
71 | $processedDescription = $this->replaceTokens($processedDescription); | 71 | $processedDescription = $this->replaceTokens($processedDescription); |
72 | 72 | ||
73 | if (!empty($processedDescription)) { | 73 | if (!empty($processedDescription)) { |
74 | $processedDescription = '<div class="markdown">'. $processedDescription . '</div>'; | 74 | $processedDescription = '<div class="markdown">' . $processedDescription . '</div>'; |
75 | } | 75 | } |
76 | 76 | ||
77 | return $processedDescription; | 77 | return $processedDescription; |
@@ -110,7 +110,7 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
110 | function ($match) use ($allowedProtocols, $indexUrl) { | 110 | function ($match) use ($allowedProtocols, $indexUrl) { |
111 | $link = startsWith($match[1], '?') || startsWith($match[1], '/') ? $indexUrl : ''; | 111 | $link = startsWith($match[1], '?') || startsWith($match[1], '/') ? $indexUrl : ''; |
112 | $link .= whitelist_protocols($match[1], $allowedProtocols); | 112 | $link .= whitelist_protocols($match[1], $allowedProtocols); |
113 | return ']('. $link.')'; | 113 | return '](' . $link . ')'; |
114 | }, | 114 | }, |
115 | $description | 115 | $description |
116 | ); | 116 | ); |
@@ -137,7 +137,7 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
137 | * \p{Mn} - any non marking space (accents, umlauts, etc) | 137 | * \p{Mn} - any non marking space (accents, umlauts, etc) |
138 | */ | 138 | */ |
139 | $regex = '/(^|\s)#([\p{Pc}\p{N}\p{L}\p{Mn}]+)/mui'; | 139 | $regex = '/(^|\s)#([\p{Pc}\p{N}\p{L}\p{Mn}]+)/mui'; |
140 | $replacement = '$1[#$2]('. $indexUrl .'./add-tag/$2)'; | 140 | $replacement = '$1[#$2](' . $indexUrl . './add-tag/$2)'; |
141 | 141 | ||
142 | $descriptionLines = explode(PHP_EOL, $description); | 142 | $descriptionLines = explode(PHP_EOL, $description); |
143 | $descriptionOut = ''; | 143 | $descriptionOut = ''; |
@@ -178,17 +178,17 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
178 | */ | 178 | */ |
179 | protected function sanitizeHtml($description) | 179 | protected function sanitizeHtml($description) |
180 | { | 180 | { |
181 | $escapeTags = array( | 181 | $escapeTags = [ |
182 | 'script', | 182 | 'script', |
183 | 'style', | 183 | 'style', |
184 | 'link', | 184 | 'link', |
185 | 'iframe', | 185 | 'iframe', |
186 | 'frameset', | 186 | 'frameset', |
187 | 'frame', | 187 | 'frame', |
188 | ); | 188 | ]; |
189 | foreach ($escapeTags as $tag) { | 189 | foreach ($escapeTags as $tag) { |
190 | $description = preg_replace_callback( | 190 | $description = preg_replace_callback( |
191 | '#<\s*'. $tag .'[^>]*>(.*</\s*'. $tag .'[^>]*>)?#is', | 191 | '#<\s*' . $tag . '[^>]*>(.*</\s*' . $tag . '[^>]*>)?#is', |
192 | function ($match) { | 192 | function ($match) { |
193 | return escape($match[0]); | 193 | return escape($match[0]); |
194 | }, | 194 | }, |