aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.css4
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.php10
-rw-r--r--plugins/archiveorg/archiveorg.html2
-rw-r--r--plugins/demo_plugin/demo_plugin.php26
-rw-r--r--plugins/isso/isso.php4
-rw-r--r--plugins/markdown/README.md38
-rw-r--r--plugins/markdown/markdown.meta5
-rw-r--r--plugins/markdown/markdown.php27
-rw-r--r--plugins/playvideos/playvideos.php8
-rw-r--r--plugins/qrcode/qrcode.html2
-rw-r--r--plugins/readityourself/readityourself.html2
-rw-r--r--plugins/wallabag/wallabag.html2
12 files changed, 89 insertions, 41 deletions
diff --git a/plugins/addlink_toolbar/addlink_toolbar.css b/plugins/addlink_toolbar/addlink_toolbar.css
deleted file mode 100644
index b6a612f0..00000000
--- a/plugins/addlink_toolbar/addlink_toolbar.css
+++ /dev/null
@@ -1,4 +0,0 @@
1#addlink_toolbar {
2 display: inline;
3 margin: 0 0 0 25px;
4} \ No newline at end of file
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php
index c96a891e..bf8a198a 100644
--- a/plugins/addlink_toolbar/addlink_toolbar.php
+++ b/plugins/addlink_toolbar/addlink_toolbar.php
@@ -16,10 +16,12 @@ function hook_addlink_toolbar_render_header($data)
16{ 16{
17 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { 17 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) {
18 $form = array( 18 $form = array(
19 'method' => 'GET', 19 'attr' => array(
20 'action' => '', 20 'method' => 'GET',
21 'name' => 'addform', 21 'action' => '',
22 'class' => 'addform', 22 'name' => 'addform',
23 'class' => 'addform',
24 ),
23 'inputs' => array( 25 'inputs' => array(
24 array( 26 array(
25 'type' => 'text', 27 'type' => 'text',
diff --git a/plugins/archiveorg/archiveorg.html b/plugins/archiveorg/archiveorg.html
index 576bd46e..0781fe35 100644
--- a/plugins/archiveorg/archiveorg.html
+++ b/plugins/archiveorg/archiveorg.html
@@ -1 +1 @@
<span><a href="https://web.archive.org/web/%s"><img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="View on archive.org" /></a></span> <span><a href="https://web.archive.org/web/%s"><img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="View on archive.org" alt="archive.org" /></a></span>
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index 15482fe0..8fdbf663 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -56,9 +56,11 @@ function hook_demo_plugin_render_header($data)
56 * and a mandatory `html` key, which contains its value. 56 * and a mandatory `html` key, which contains its value.
57 */ 57 */
58 $button = array( 58 $button = array(
59 'href' => '#', 59 'attr' => array (
60 'class' => 'mybutton', 60 'href' => '#',
61 'title' => 'hover me', 61 'class' => 'mybutton',
62 'title' => 'hover me',
63 ),
62 'html' => 'DEMO buttons toolbar', 64 'html' => 'DEMO buttons toolbar',
63 ); 65 );
64 $data['buttons_toolbar'][] = $button; 66 $data['buttons_toolbar'][] = $button;
@@ -87,9 +89,11 @@ function hook_demo_plugin_render_header($data)
87 * </form> 89 * </form>
88 */ 90 */
89 $form = array( 91 $form = array(
90 'method' => 'GET', 92 'attr' => array(
91 'action' => '?', 93 'method' => 'GET',
92 'class' => 'addform', 94 'action' => '?',
95 'class' => 'addform',
96 ),
93 'inputs' => array( 97 'inputs' => array(
94 array( 98 array(
95 'type' => 'text', 99 'type' => 'text',
@@ -102,7 +106,9 @@ function hook_demo_plugin_render_header($data)
102 } 106 }
103 // Another button always displayed 107 // Another button always displayed
104 $button = array( 108 $button = array(
105 'href' => '#', 109 'attr' => array(
110 'href' => '#',
111 ),
106 'html' => 'Demo', 112 'html' => 'Demo',
107 ); 113 );
108 $data['buttons_toolbar'][] = $button; 114 $data['buttons_toolbar'][] = $button;
@@ -197,8 +203,10 @@ function hook_demo_plugin_render_linklist($data)
197 * It's also recommended to add key 'on' or 'off' for theme rendering. 203 * It's also recommended to add key 'on' or 'off' for theme rendering.
198 */ 204 */
199 $action = array( 205 $action = array(
200 'href' => '?up', 206 'attr' => array(
201 'title' => 'Uppercase!', 207 'href' => '?up',
208 'title' => 'Uppercase!',
209 ),
202 'html' => '←', 210 'html' => '←',
203 ); 211 );
204 212
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
index ffb7cfac..ce16645f 100644
--- a/plugins/isso/isso.php
+++ b/plugins/isso/isso.php
@@ -41,9 +41,9 @@ function hook_isso_render_linklist($data, $conf)
41 // Only display comments for permalinks. 41 // Only display comments for permalinks.
42 if (count($data['links']) == 1 && empty($data['search_tags']) && empty($data['search_term'])) { 42 if (count($data['links']) == 1 && empty($data['search_tags']) && empty($data['search_term'])) {
43 $link = reset($data['links']); 43 $link = reset($data['links']);
44 $isso_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html'); 44 $issoHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html');
45 45
46 $isso = sprintf($isso_html, $issoUrl, $issoUrl, $link['linkdate'], $link['linkdate']); 46 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']);
47 $data['plugin_end_zone'][] = $isso; 47 $data['plugin_end_zone'][] = $isso;
48 48
49 // Hackish way to include this CSS file only when necessary. 49 // Hackish way to include this CSS file only when necessary.
diff --git a/plugins/markdown/README.md b/plugins/markdown/README.md
index 4f021871..aafcf066 100644
--- a/plugins/markdown/README.md
+++ b/plugins/markdown/README.md
@@ -20,26 +20,52 @@ The directory structure should look like:
20 |--- markdown.css 20 |--- markdown.css
21 |--- markdown.meta 21 |--- markdown.meta
22 |--- markdown.php 22 |--- markdown.php
23 |--- Parsedown.php
24 |--- README.md 23 |--- README.md
25``` 24```
26 25
27To enable the plugin, just check it in the plugin administration page. 26To enable the plugin, just check it in the plugin administration page.
28 27
29You can also add `markdown` to your list of enabled plugins in `data/config.php` 28You can also add `markdown` to your list of enabled plugins in `data/config.json.php`
30(`ENABLED_PLUGINS` array). 29(`general.enabled_plugins` list).
31 30
32This should look like: 31This should look like:
33 32
34``` 33```
35$GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode', 'any_other_plugin', 'markdown') 34"general": {
35 "enabled_plugins": [
36 "markdown",
37 [...]
38 ],
39}
36``` 40```
37 41
42Parsedown parsing library is imported using Composer. If you installed Shaarli using `git`,
43or the `master` branch, run
44
45 composer update --no-dev --prefer-dist
46
38### No Markdown tag 47### No Markdown tag
39 48
40If the tag `.nomarkdown` is set for a shaare, it won't be converted to Markdown syntax. 49If the tag `nomarkdown` is set for a shaare, it won't be converted to Markdown syntax.
41 50
42> Note: it's a private tag (leading dot), so it won't be displayed to visitors. 51> Note: this is a special tag, so it won't be displayed in link list.
52
53### HTML rendering
54
55Markdown support HTML tags. For example:
56
57 > <strong>strong</strong><strike>strike</strike>
58
59Will render as:
60
61> <strong>strong</strong><strike>strike</strike>
62
63If you want to shaare HTML code, it is necessary to use inline code or code blocks.
64
65**If your shaared descriptions containing HTML tags before enabling the markdown plugin,
66enabling it might break your page.**
67
68> Note: HTML tags such as script, iframe, etc. are disabled for security reasons.
43 69
44### Known issue 70### Known issue
45 71
diff --git a/plugins/markdown/markdown.meta b/plugins/markdown/markdown.meta
index e3904ed8..8df2ed0b 100644
--- a/plugins/markdown/markdown.meta
+++ b/plugins/markdown/markdown.meta
@@ -1 +1,4 @@
1description="Render shaare description with Markdown syntax." 1description="Render shaare description with Markdown syntax.<br><strong>Warning</strong>:
2If your shaared descriptions containing HTML tags before enabling the markdown plugin,
3enabling it might break your page.
4See the <a href=\"https://github.com/shaarli/Shaarli/tree/master/plugins/markdown#html-rendering\">README</a>."
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php
index a764b6fa..0cf6e6e2 100644
--- a/plugins/markdown/markdown.php
+++ b/plugins/markdown/markdown.php
@@ -22,7 +22,7 @@ function hook_markdown_render_linklist($data)
22{ 22{
23 foreach ($data['links'] as &$value) { 23 foreach ($data['links'] as &$value) {
24 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { 24 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
25 $value['taglist'] = stripNoMarkdownTag($value['taglist']); 25 $value = stripNoMarkdownTag($value);
26 continue; 26 continue;
27 } 27 }
28 $value['description'] = process_markdown($value['description']); 28 $value['description'] = process_markdown($value['description']);
@@ -41,7 +41,7 @@ function hook_markdown_render_feed($data)
41{ 41{
42 foreach ($data['links'] as &$value) { 42 foreach ($data['links'] as &$value) {
43 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { 43 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
44 $value['tags'] = stripNoMarkdownTag($value['tags']); 44 $value = stripNoMarkdownTag($value);
45 continue; 45 continue;
46 } 46 }
47 $value['description'] = process_markdown($value['description']); 47 $value['description'] = process_markdown($value['description']);
@@ -63,6 +63,7 @@ function hook_markdown_render_daily($data)
63 foreach ($data['cols'] as &$value) { 63 foreach ($data['cols'] as &$value) {
64 foreach ($value as &$value2) { 64 foreach ($value as &$value2) {
65 if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) { 65 if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) {
66 $value2 = stripNoMarkdownTag($value2);
66 continue; 67 continue;
67 } 68 }
68 $value2['formatedDescription'] = process_markdown($value2['formatedDescription']); 69 $value2['formatedDescription'] = process_markdown($value2['formatedDescription']);
@@ -81,20 +82,30 @@ function hook_markdown_render_daily($data)
81 */ 82 */
82function noMarkdownTag($tags) 83function noMarkdownTag($tags)
83{ 84{
84 return strpos($tags, NO_MD_TAG) !== false; 85 return preg_match('/(^|\s)'. NO_MD_TAG .'(\s|$)/', $tags);
85} 86}
86 87
87/** 88/**
88 * Remove the no-markdown meta tag so it won't be displayed. 89 * Remove the no-markdown meta tag so it won't be displayed.
89 * 90 *
90 * @param string $tags Tag list. 91 * @param array $link Link data.
91 * 92 *
92 * @return string tag list without no markdown tag. 93 * @return array Updated link without no markdown tag.
93 */ 94 */
94function stripNoMarkdownTag($tags) 95function stripNoMarkdownTag($link)
95{ 96{
96 unset($tags[array_search(NO_MD_TAG, $tags)]); 97 if (! empty($link['taglist'])) {
97 return array_values($tags); 98 $offset = array_search(NO_MD_TAG, $link['taglist']);
99 if ($offset !== false) {
100 unset($link['taglist'][$offset]);
101 }
102 }
103
104 if (!empty($link['tags'])) {
105 str_replace(NO_MD_TAG, '', $link['tags']);
106 }
107
108 return $link;
98} 109}
99 110
100/** 111/**
diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php
index 2f4b0a31..64484504 100644
--- a/plugins/playvideos/playvideos.php
+++ b/plugins/playvideos/playvideos.php
@@ -17,9 +17,11 @@ function hook_playvideos_render_header($data)
17{ 17{
18 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { 18 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
19 $playvideo = array( 19 $playvideo = array(
20 'href' => '#', 20 'attr' => array(
21 'title' => 'Video player', 21 'href' => '#',
22 'id' => 'playvideos', 22 'title' => 'Video player',
23 'id' => 'playvideos',
24 ),
23 'html' => '► Play Videos' 25 'html' => '► Play Videos'
24 ); 26 );
25 $data['buttons_toolbar'][] = $playvideo; 27 $data['buttons_toolbar'][] = $playvideo;
diff --git a/plugins/qrcode/qrcode.html b/plugins/qrcode/qrcode.html
index cebc5644..dc214ed1 100644
--- a/plugins/qrcode/qrcode.html
+++ b/plugins/qrcode/qrcode.html
@@ -1,5 +1,5 @@
1<div class="linkqrcode"> 1<div class="linkqrcode">
2 <a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d=%s" onclick="showQrCode(this); return false;" class="qrcode" data-permalink="%s"> 2 <a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d=%s" onclick="showQrCode(this); return false;" class="qrcode" data-permalink="%s">
3 <img src="%s/qrcode/qrcode.png" class="linklist-plugin-icon" title="QR-Code"> 3 <img src="%s/qrcode/qrcode.png" class="linklist-plugin-icon" title="QR-Code" alt="QRCode">
4 </a> 4 </a>
5</div> 5</div>
diff --git a/plugins/readityourself/readityourself.html b/plugins/readityourself/readityourself.html
index e8c5f784..5e200715 100644
--- a/plugins/readityourself/readityourself.html
+++ b/plugins/readityourself/readityourself.html
@@ -1 +1 @@
<span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" /></a></span> <span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" alt="readityourself" /></a></span>
diff --git a/plugins/wallabag/wallabag.html b/plugins/wallabag/wallabag.html
index c7b1d044..e861536d 100644
--- a/plugins/wallabag/wallabag.html
+++ b/plugins/wallabag/wallabag.html
@@ -1 +1 @@
<span><a href="%s%s" target="_blank"><img class="linklist-plugin-icon" src="%s/wallabag/wallabag.png" title="Save to wallabag" /></a></span> <span><a href="%s%s" target="_blank"><img class="linklist-plugin-icon" src="%s/wallabag/wallabag.png" title="Save to wallabag" alt="wallabag" /></a></span>