diff options
author | VirtualTam <virtualtam@flibidi.net> | 2018-10-13 00:22:45 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2018-12-02 22:39:16 +0100 |
commit | a0ab3c3f68ed3bca7d218e6e5847820b82b086ca (patch) | |
tree | 7b1473bd9096853287af2ef533f59e8eca0bed68 /plugins/markdown | |
parent | f211e417bf637b8a83988175c29ee072c69f7642 (diff) | |
download | Shaarli-a0ab3c3f68ed3bca7d218e6e5847820b82b086ca.tar.gz Shaarli-a0ab3c3f68ed3bca7d218e6e5847820b82b086ca.tar.zst Shaarli-a0ab3c3f68ed3bca7d218e6e5847820b82b086ca.zip |
lint: apply phpcbf to plugins/
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'plugins/markdown')
-rw-r--r-- | plugins/markdown/markdown.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 08e64dae..8823af91 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -139,7 +139,6 @@ function hook_markdown_render_includes($data) | |||
139 | || $data['_PAGE_'] == Router::$PAGE_DAILY | 139 | || $data['_PAGE_'] == Router::$PAGE_DAILY |
140 | || $data['_PAGE_'] == Router::$PAGE_EDITLINK | 140 | || $data['_PAGE_'] == Router::$PAGE_EDITLINK |
141 | ) { | 141 | ) { |
142 | |||
143 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/markdown/markdown.css'; | 142 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/markdown/markdown.css'; |
144 | } | 143 | } |
145 | 144 | ||
@@ -195,8 +194,7 @@ function reverse_text2clickable($description) | |||
195 | // Detect and toggle block of code | 194 | // Detect and toggle block of code |
196 | if (!$codeBlockOn) { | 195 | if (!$codeBlockOn) { |
197 | $codeBlockOn = preg_match('/^```/', $descriptionLine) > 0; | 196 | $codeBlockOn = preg_match('/^```/', $descriptionLine) > 0; |
198 | } | 197 | } elseif (preg_match('/^```/', $descriptionLine) > 0) { |
199 | elseif (preg_match('/^```/', $descriptionLine) > 0) { | ||
200 | $codeBlockOn = false; | 198 | $codeBlockOn = false; |
201 | } | 199 | } |
202 | 200 | ||
@@ -302,13 +300,17 @@ function sanitize_html($description) | |||
302 | foreach ($escapeTags as $tag) { | 300 | foreach ($escapeTags as $tag) { |
303 | $description = preg_replace_callback( | 301 | $description = preg_replace_callback( |
304 | '#<\s*'. $tag .'[^>]*>(.*</\s*'. $tag .'[^>]*>)?#is', | 302 | '#<\s*'. $tag .'[^>]*>(.*</\s*'. $tag .'[^>]*>)?#is', |
305 | function ($match) { return escape($match[0]); }, | 303 | function ($match) { |
306 | $description); | 304 | return escape($match[0]); |
305 | }, | ||
306 | $description | ||
307 | ); | ||
307 | } | 308 | } |
308 | $description = preg_replace( | 309 | $description = preg_replace( |
309 | '#(<[^>]+\s)on[a-z]*="?[^ "]*"?#is', | 310 | '#(<[^>]+\s)on[a-z]*="?[^ "]*"?#is', |
310 | '$1', | 311 | '$1', |
311 | $description); | 312 | $description |
313 | ); | ||
312 | return $description; | 314 | return $description; |
313 | } | 315 | } |
314 | 316 | ||
@@ -341,7 +343,7 @@ function process_markdown($description, $escape = true, $allowedProtocols = []) | |||
341 | ->text($processedDescription); | 343 | ->text($processedDescription); |
342 | $processedDescription = sanitize_html($processedDescription); | 344 | $processedDescription = sanitize_html($processedDescription); |
343 | 345 | ||
344 | if(!empty($processedDescription)){ | 346 | if (!empty($processedDescription)) { |
345 | $processedDescription = '<div class="markdown">'. $processedDescription . '</div>'; | 347 | $processedDescription = '<div class="markdown">'. $processedDescription . '</div>'; |
346 | } | 348 | } |
347 | 349 | ||