aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-07-28 11:19:53 +0200
committerArthurHoaro <arthur@hoa.ro>2018-07-28 11:19:53 +0200
commit7982c3ff183aa985177bdaeacda4feb22a739e00 (patch)
tree728e07251072f3a1df63c017c0dce54fa1acb390 /plugins
parent2075321f6569dfa610905991b315aae1956b7f78 (diff)
parented7e1be12d65bdb1b924c7efb6a84fd591192c6c (diff)
downloadShaarli-7982c3ff183aa985177bdaeacda4feb22a739e00.tar.gz
Shaarli-7982c3ff183aa985177bdaeacda4feb22a739e00.tar.zst
Shaarli-7982c3ff183aa985177bdaeacda4feb22a739e00.zip
Merge tag 'v0.10.0' into latest
Release v0.10.0
Diffstat (limited to 'plugins')
-rw-r--r--plugins/demo_plugin/demo_plugin.php12
-rw-r--r--plugins/markdown/markdown.php33
2 files changed, 24 insertions, 21 deletions
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index b80a2b6d..f3a63b6a 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -378,17 +378,13 @@ function hook_demo_plugin_render_daily($data)
378 378
379 379
380 // Manipulate columns data 380 // Manipulate columns data
381 foreach ($data['cols'] as &$value) { 381 foreach ($data['linksToDisplay'] as &$value) {
382 foreach ($value as &$value2) { 382 $value['formatedDescription'] .= ' ಠ_ಠ';
383 $value2['formatedDescription'] .= ' ಠ_ಠ';
384 }
385 } 383 }
386 384
387 // Add plugin content at the end of each link 385 // Add plugin content at the end of each link
388 foreach ($data['cols'] as &$value) { 386 foreach ($data['linksToDisplay'] as &$value) {
389 foreach ($value as &$value2) { 387 $value['link_plugin'][] = 'DEMO';
390 $value2['link_plugin'][] = 'DEMO';
391 }
392 } 388 }
393 389
394 return $data; 390 return $data;
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php
index 1531549d..821bb125 100644
--- a/plugins/markdown/markdown.php
+++ b/plugins/markdown/markdown.php
@@ -6,6 +6,8 @@
6 * Shaare's descriptions are parsed with Markdown. 6 * Shaare's descriptions are parsed with Markdown.
7 */ 7 */
8 8
9use Shaarli\Config\ConfigManager;
10
9/* 11/*
10 * If this tag is used on a shaare, the description won't be processed by Parsedown. 12 * If this tag is used on a shaare, the description won't be processed by Parsedown.
11 */ 13 */
@@ -50,6 +52,7 @@ function hook_markdown_render_feed($data, $conf)
50 $value = stripNoMarkdownTag($value); 52 $value = stripNoMarkdownTag($value);
51 continue; 53 continue;
52 } 54 }
55 $value['description'] = reverse_feed_permalink($value['description']);
53 $value['description'] = process_markdown( 56 $value['description'] = process_markdown(
54 $value['description'], 57 $value['description'],
55 $conf->get('security.markdown_escape', true), 58 $conf->get('security.markdown_escape', true),
@@ -70,19 +73,18 @@ function hook_markdown_render_feed($data, $conf)
70 */ 73 */
71function hook_markdown_render_daily($data, $conf) 74function hook_markdown_render_daily($data, $conf)
72{ 75{
76 //var_dump($data);die;
73 // Manipulate columns data 77 // Manipulate columns data
74 foreach ($data['cols'] as &$value) { 78 foreach ($data['linksToDisplay'] as &$value) {
75 foreach ($value as &$value2) { 79 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
76 if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) { 80 $value = stripNoMarkdownTag($value);
77 $value2 = stripNoMarkdownTag($value2); 81 continue;
78 continue;
79 }
80 $value2['formatedDescription'] = process_markdown(
81 $value2['formatedDescription'],
82 $conf->get('security.markdown_escape', true),
83 $conf->get('security.allowed_protocols')
84 );
85 } 82 }
83 $value['formatedDescription'] = process_markdown(
84 $value['formatedDescription'],
85 $conf->get('security.markdown_escape', true),
86 $conf->get('security.allowed_protocols')
87 );
86 } 88 }
87 89
88 return $data; 90 return $data;
@@ -136,7 +138,7 @@ function hook_markdown_render_includes($data)
136 || $data['_PAGE_'] == Router::$PAGE_DAILY 138 || $data['_PAGE_'] == Router::$PAGE_DAILY
137 || $data['_PAGE_'] == Router::$PAGE_EDITLINK 139 || $data['_PAGE_'] == Router::$PAGE_EDITLINK
138 ) { 140 ) {
139 141
140 $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/markdown/markdown.css'; 142 $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/markdown/markdown.css';
141 } 143 }
142 144
@@ -245,6 +247,11 @@ function reverse_space2nbsp($description)
245 return preg_replace('/(^| )&nbsp;/m', '$1 ', $description); 247 return preg_replace('/(^| )&nbsp;/m', '$1 ', $description);
246} 248}
247 249
250function reverse_feed_permalink($description)
251{
252 return preg_replace('@&#8212; <a href="([^"]+)" title="[^"]+">(\w+)</a>$@im', '&#8212; [$2]($1)', $description);
253}
254
248/** 255/**
249 * Replace not whitelisted protocols with http:// in given description. 256 * Replace not whitelisted protocols with http:// in given description.
250 * 257 *
@@ -289,7 +296,7 @@ function sanitize_html($description)
289 $description); 296 $description);
290 } 297 }
291 $description = preg_replace( 298 $description = preg_replace(
292 '#(<[^>]+)on[a-z]*="?[^ "]*"?#is', 299 '#(<[^>]+\s)on[a-z]*="?[^ "]*"?#is',
293 '$1', 300 '$1',
294 $description); 301 $description);
295 return $description; 302 return $description;