diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-07-28 11:07:55 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-07-28 11:07:55 +0200 |
commit | 83faedadff76c5bdca036f39f13943f63b27e164 (patch) | |
tree | 6f44cede16ec6a60f10b9699e211e0818f06d2c8 /plugins | |
parent | 1d9eb22a3df85b67fe6652c0876cd7382c2fb525 (diff) | |
parent | 658988f3aeba7a5a938783249ccf2765251e5597 (diff) | |
download | Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.gz Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.zst Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.zip |
Merge tag 'v0.9.7' into stable
Release v0.9.7
Diffstat (limited to 'plugins')
32 files changed, 447 insertions, 138 deletions
diff --git a/plugins/TODO.md b/plugins/TODO.md deleted file mode 100644 index e3313d67..00000000 --- a/plugins/TODO.md +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | https://github.com/shaarli/Shaarli/issues/181 - Add Disqus or Isso comments box on a permalink page | ||
2 | |||
3 | * http://posativ.org/isso/ | ||
4 | * install debian package https://packages.debian.org/sid/isso | ||
5 | * configure server http://posativ.org/isso/docs/configuration/server/ | ||
6 | * configure client http://posativ.org/isso/docs/configuration/client/ | ||
7 | * http://posativ.org/isso/docs/quickstart/ and add `<script data-isso="//comments.example.tld/" src="//comments.example.tld/js/embed.min.js"></script>` to includes.html template; then add `<section id="isso-thread"></section>` in the linklist template where you want the comments (in the linklist_plugins loop for example) | ||
8 | |||
9 | |||
10 | Problem: by default, Isso thread ID is guessed from the current url (only one thread per page). | ||
11 | if we want multiple threads on a single page (shaarli linklist), we must use : the `data-isso-id` client config, | ||
12 | with data-isso-id being the permalink of an item. | ||
13 | |||
14 | `<section data-isso-id="aH7klxW" id="isso-thread"></section>` | ||
15 | `data-isso-id: Set a custom thread id, defaults to current URI.` | ||
16 | |||
17 | Problem: feature is currently broken https://github.com/posativ/isso/issues/27 | ||
18 | |||
19 | Another option, only display isso threads when current URL is a permalink (`\?(A-Z|a-z|0-9|-){7}`) (only show thread | ||
20 | when displaying only this link), and just display a "comments" button on each linklist item. Optionally show the comment | ||
21 | count on each item using the API (http://posativ.org/isso/docs/extras/api/#get-comment-count). API requests can be done | ||
22 | by raintpl `{function` or client-side with js. The former should be faster if isso and shaarli are on ther same server. | ||
23 | |||
24 | Showing all full isso threads in the linklist would destroy layout | ||
25 | |||
26 | ----------------------------------------------------------- | ||
27 | |||
28 | http://www.git-attitude.fr/2014/11/04/git-rerere/ for the merge | ||
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php index bf8a198a..8c05a231 100644 --- a/plugins/addlink_toolbar/addlink_toolbar.php +++ b/plugins/addlink_toolbar/addlink_toolbar.php | |||
@@ -26,11 +26,11 @@ function hook_addlink_toolbar_render_header($data) | |||
26 | array( | 26 | array( |
27 | 'type' => 'text', | 27 | 'type' => 'text', |
28 | 'name' => 'post', | 28 | 'name' => 'post', |
29 | 'placeholder' => 'URI', | 29 | 'placeholder' => t('URI'), |
30 | ), | 30 | ), |
31 | array( | 31 | array( |
32 | 'type' => 'submit', | 32 | 'type' => 'submit', |
33 | 'value' => 'Add link', | 33 | 'value' => t('Add link'), |
34 | 'class' => 'bigbutton', | 34 | 'class' => 'bigbutton', |
35 | ), | 35 | ), |
36 | ), | 36 | ), |
@@ -42,17 +42,10 @@ function hook_addlink_toolbar_render_header($data) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * When link list is displayed, include markdown CSS. | 45 | * This function is never called, but contains translation calls for GNU gettext extraction. |
46 | * | ||
47 | * @param array $data - includes data. | ||
48 | * | ||
49 | * @return mixed - includes data with markdown CSS file added. | ||
50 | */ | 46 | */ |
51 | function hook_addlink_toolbar_render_includes($data) | 47 | function addlink_toolbar_dummy_translation() |
52 | { | 48 | { |
53 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { | 49 | // meta |
54 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.css'; | 50 | t('Adds the addlink input on the linklist page.'); |
55 | } | ||
56 | |||
57 | return $data; | ||
58 | } | 51 | } |
diff --git a/plugins/archiveorg/archiveorg.html b/plugins/archiveorg/archiveorg.html index 0781fe35..ad501f47 100644 --- a/plugins/archiveorg/archiveorg.html +++ b/plugins/archiveorg/archiveorg.html | |||
@@ -1 +1,5 @@ | |||
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" alt="archive.org" /></a></span> | 1 | <span> |
2 | <a href="https://web.archive.org/web/%s"> | ||
3 | <img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="%s" alt="archive.org" /> | ||
4 | </a> | ||
5 | </span> | ||
diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index 03d13d0e..cda35751 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php | |||
@@ -20,9 +20,18 @@ function hook_archiveorg_render_linklist($data) | |||
20 | if($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { | 20 | if($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { |
21 | continue; | 21 | continue; |
22 | } | 22 | } |
23 | $archive = sprintf($archive_html, $value['url']); | 23 | $archive = sprintf($archive_html, $value['url'], t('View on archive.org')); |
24 | $value['link_plugin'][] = $archive; | 24 | $value['link_plugin'][] = $archive; |
25 | } | 25 | } |
26 | 26 | ||
27 | return $data; | 27 | return $data; |
28 | } | 28 | } |
29 | |||
30 | /** | ||
31 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
32 | */ | ||
33 | function archiveorg_dummy_translation() | ||
34 | { | ||
35 | // meta | ||
36 | t('For each link, add an Archive.org icon.'); | ||
37 | } | ||
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index 8fdbf663..b80a2b6d 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php | |||
@@ -14,6 +14,26 @@ | |||
14 | * and check user status with _LOGGEDIN_. | 14 | * and check user status with _LOGGEDIN_. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | use Shaarli\Config\ConfigManager; | ||
18 | |||
19 | /** | ||
20 | * In the footer hook, there is a working example of a translation extension for Shaarli. | ||
21 | * | ||
22 | * The extension must be attached to a new translation domain (i.e. NOT 'shaarli'). | ||
23 | * Use case: any custom theme or non official plugin can use the translation system. | ||
24 | * | ||
25 | * See the documentation for more information. | ||
26 | */ | ||
27 | const EXT_TRANSLATION_DOMAIN = 'demo'; | ||
28 | |||
29 | /* | ||
30 | * This is not necessary, but it's easier if you don't want Poedit to mix up your translations. | ||
31 | */ | ||
32 | function demo_plugin_t($text, $nText = '', $nb = 1) | ||
33 | { | ||
34 | return t($text, $nText, $nb, EXT_TRANSLATION_DOMAIN); | ||
35 | } | ||
36 | |||
17 | /** | 37 | /** |
18 | * Initialization function. | 38 | * Initialization function. |
19 | * It will be called when the plugin is loaded. | 39 | * It will be called when the plugin is loaded. |
@@ -27,6 +47,12 @@ function demo_plugin_init($conf) | |||
27 | { | 47 | { |
28 | $conf->get('toto', 'nope'); | 48 | $conf->get('toto', 'nope'); |
29 | 49 | ||
50 | if (! $conf->exists('translation.extensions.demo')) { | ||
51 | // Custom translation with the domain 'demo' | ||
52 | $conf->set('translation.extensions.demo', 'plugins/demo_plugin/languages/'); | ||
53 | $conf->write(true); | ||
54 | } | ||
55 | |||
30 | $errors[] = 'This a demo init error.'; | 56 | $errors[] = 'This a demo init error.'; |
31 | return $errors; | 57 | return $errors; |
32 | } | 58 | } |
@@ -160,7 +186,7 @@ function hook_demo_plugin_render_includes($data) | |||
160 | function hook_demo_plugin_render_footer($data) | 186 | function hook_demo_plugin_render_footer($data) |
161 | { | 187 | { |
162 | // footer text | 188 | // footer text |
163 | $data['text'][] = 'Shaarli is now enhanced by the awesome demo_plugin.'; | 189 | $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); |
164 | 190 | ||
165 | // Free elements at the end of the page. | 191 | // Free elements at the end of the page. |
166 | $data['endofpage'][] = '<marquee id="demo_marquee">' . | 192 | $data['endofpage'][] = '<marquee id="demo_marquee">' . |
@@ -433,3 +459,12 @@ function hook_demo_plugin_render_feed($data) | |||
433 | } | 459 | } |
434 | return $data; | 460 | return $data; |
435 | } | 461 | } |
462 | |||
463 | /** | ||
464 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
465 | */ | ||
466 | function demo_dummy_translation() | ||
467 | { | ||
468 | // meta | ||
469 | t('A demo plugin covering all use cases for template designers and plugin developers.'); | ||
470 | } | ||
diff --git a/plugins/demo_plugin/languages/fr/LC_MESSAGES/demo.mo b/plugins/demo_plugin/languages/fr/LC_MESSAGES/demo.mo new file mode 100644 index 00000000..0f80f6ed --- /dev/null +++ b/plugins/demo_plugin/languages/fr/LC_MESSAGES/demo.mo | |||
Binary files differ | |||
diff --git a/plugins/demo_plugin/languages/fr/LC_MESSAGES/demo.po b/plugins/demo_plugin/languages/fr/LC_MESSAGES/demo.po new file mode 100644 index 00000000..921379c0 --- /dev/null +++ b/plugins/demo_plugin/languages/fr/LC_MESSAGES/demo.po | |||
@@ -0,0 +1,21 @@ | |||
1 | msgid "" | ||
2 | msgstr "" | ||
3 | "Project-Id-Version: Demo plugin\n" | ||
4 | "POT-Creation-Date: 2017-08-19 10:45+0200\n" | ||
5 | "PO-Revision-Date: 2017-08-19 11:28+0200\n" | ||
6 | "Last-Translator: \n" | ||
7 | "Language-Team: demo\n" | ||
8 | "Language: fr\n" | ||
9 | "MIME-Version: 1.0\n" | ||
10 | "Content-Type: text/plain; charset=UTF-8\n" | ||
11 | "Content-Transfer-Encoding: 8bit\n" | ||
12 | "X-Generator: Poedit 2.0.2\n" | ||
13 | "X-Poedit-Basepath: ../../..\n" | ||
14 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" | ||
15 | "X-Poedit-KeywordsList: ;demo_plugin_t:1,2;demo_plugin_t\n" | ||
16 | "X-Poedit-SourceCharset: UTF-8\n" | ||
17 | "X-Poedit-SearchPath-0: .\n" | ||
18 | |||
19 | #: demo_plugin.php:173 | ||
20 | msgid "Shaarli is now enhanced by the awesome demo_plugin." | ||
21 | msgstr "Shaarli est maintenant amélioré avec le fantastique demo_plugin." | ||
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index ce16645f..5bc1cce2 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php | |||
@@ -4,10 +4,11 @@ | |||
4 | * Plugin Isso. | 4 | * Plugin Isso. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | use Shaarli\Config\ConfigManager; | ||
8 | |||
7 | /** | 9 | /** |
8 | * Display an error everywhere if the plugin is enabled without configuration. | 10 | * Display an error everywhere if the plugin is enabled without configuration. |
9 | * | 11 | * |
10 | * @param $data array List of links | ||
11 | * @param $conf ConfigManager instance | 12 | * @param $conf ConfigManager instance |
12 | * | 13 | * |
13 | * @return mixed - linklist data with Isso plugin. | 14 | * @return mixed - linklist data with Isso plugin. |
@@ -16,8 +17,8 @@ function isso_init($conf) | |||
16 | { | 17 | { |
17 | $issoUrl = $conf->get('plugins.ISSO_SERVER'); | 18 | $issoUrl = $conf->get('plugins.ISSO_SERVER'); |
18 | if (empty($issoUrl)) { | 19 | if (empty($issoUrl)) { |
19 | $error = 'Isso plugin error: '. | 20 | $error = t('Isso plugin error: '. |
20 | 'Please define the "ISSO_SERVER" setting in the plugin administration page.'; | 21 | 'Please define the "ISSO_SERVER" setting in the plugin administration page.'); |
21 | return array($error); | 22 | return array($error); |
22 | } | 23 | } |
23 | } | 24 | } |
@@ -52,3 +53,13 @@ function hook_isso_render_linklist($data, $conf) | |||
52 | 53 | ||
53 | return $data; | 54 | return $data; |
54 | } | 55 | } |
56 | |||
57 | /** | ||
58 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
59 | */ | ||
60 | function isso_dummy_translation() | ||
61 | { | ||
62 | // meta | ||
63 | t('Let visitor comment your shaares on permalinks with Isso.'); | ||
64 | t('Isso server URL (without \'http://\')'); | ||
65 | } | ||
diff --git a/plugins/markdown/help.html b/plugins/markdown/help.html index 9c4e5ae0..ded3d347 100644 --- a/plugins/markdown/help.html +++ b/plugins/markdown/help.html | |||
@@ -1,5 +1,5 @@ | |||
1 | <div class="md_help"> | 1 | <div class="md_help"> |
2 | Description will be rendered with | 2 | %s |
3 | <a href="http://daringfireball.net/projects/markdown/syntax" title="Markdown syntax documentation"> | 3 | <a href="http://daringfireball.net/projects/markdown/syntax" title="%s"> |
4 | Markdown syntax</a>. | 4 | %s</a>. |
5 | </div> | 5 | </div> |
diff --git a/plugins/markdown/markdown.css b/plugins/markdown/markdown.css index 6789ce84..ce19cd2a 100644 --- a/plugins/markdown/markdown.css +++ b/plugins/markdown/markdown.css | |||
@@ -150,7 +150,7 @@ | |||
150 | box-shadow: 0 -1px 0 #e5e5e5,0 0 1px rgba(0,0,0,0.12),0 1px 1px rgba(0,0,0,0.24); | 150 | box-shadow: 0 -1px 0 #e5e5e5,0 0 1px rgba(0,0,0,0.12),0 1px 1px rgba(0,0,0,0.24); |
151 | } | 151 | } |
152 | 152 | ||
153 | .md_help { | 153 | #pageheader .md_help { |
154 | color: white; | 154 | color: white; |
155 | } | 155 | } |
156 | 156 | ||
diff --git a/plugins/markdown/markdown.meta b/plugins/markdown/markdown.meta index 8df2ed0b..322856ea 100644 --- a/plugins/markdown/markdown.meta +++ b/plugins/markdown/markdown.meta | |||
@@ -1,4 +1,4 @@ | |||
1 | description="Render shaare description with Markdown syntax.<br><strong>Warning</strong>: | 1 | description="Render shaare description with Markdown syntax.<br><strong>Warning</strong>: |
2 | If your shaared descriptions containing HTML tags before enabling the markdown plugin, | 2 | If your shaared descriptions contained HTML tags before enabling the markdown plugin, |
3 | enabling it might break your page. | 3 | enabling it might break your page. |
4 | See the <a href=\"https://github.com/shaarli/Shaarli/tree/master/plugins/markdown#html-rendering\">README</a>." | 4 | See 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 de7c823d..1531549d 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -26,7 +26,11 @@ function hook_markdown_render_linklist($data, $conf) | |||
26 | $value = stripNoMarkdownTag($value); | 26 | $value = stripNoMarkdownTag($value); |
27 | continue; | 27 | continue; |
28 | } | 28 | } |
29 | $value['description'] = process_markdown($value['description'], $conf->get('security.markdown_escape', true)); | 29 | $value['description'] = process_markdown( |
30 | $value['description'], | ||
31 | $conf->get('security.markdown_escape', true), | ||
32 | $conf->get('security.allowed_protocols') | ||
33 | ); | ||
30 | } | 34 | } |
31 | return $data; | 35 | return $data; |
32 | } | 36 | } |
@@ -46,7 +50,11 @@ function hook_markdown_render_feed($data, $conf) | |||
46 | $value = stripNoMarkdownTag($value); | 50 | $value = stripNoMarkdownTag($value); |
47 | continue; | 51 | continue; |
48 | } | 52 | } |
49 | $value['description'] = process_markdown($value['description'], $conf->get('security.markdown_escape', true)); | 53 | $value['description'] = process_markdown( |
54 | $value['description'], | ||
55 | $conf->get('security.markdown_escape', true), | ||
56 | $conf->get('security.allowed_protocols') | ||
57 | ); | ||
50 | } | 58 | } |
51 | 59 | ||
52 | return $data; | 60 | return $data; |
@@ -71,7 +79,8 @@ function hook_markdown_render_daily($data, $conf) | |||
71 | } | 79 | } |
72 | $value2['formatedDescription'] = process_markdown( | 80 | $value2['formatedDescription'] = process_markdown( |
73 | $value2['formatedDescription'], | 81 | $value2['formatedDescription'], |
74 | $conf->get('security.markdown_escape', true) | 82 | $conf->get('security.markdown_escape', true), |
83 | $conf->get('security.allowed_protocols') | ||
75 | ); | 84 | ); |
76 | } | 85 | } |
77 | } | 86 | } |
@@ -145,8 +154,13 @@ function hook_markdown_render_includes($data) | |||
145 | function hook_markdown_render_editlink($data) | 154 | function hook_markdown_render_editlink($data) |
146 | { | 155 | { |
147 | // Load help HTML into a string | 156 | // Load help HTML into a string |
148 | $data['edit_link_plugin'][] = file_get_contents(PluginManager::$PLUGINS_PATH .'/markdown/help.html'); | 157 | $txt = file_get_contents(PluginManager::$PLUGINS_PATH .'/markdown/help.html'); |
149 | 158 | $translations = [ | |
159 | t('Description will be rendered with'), | ||
160 | t('Markdown syntax documentation'), | ||
161 | t('Markdown syntax'), | ||
162 | ]; | ||
163 | $data['edit_link_plugin'][] = vsprintf($txt, $translations); | ||
150 | // Add no markdown 'meta-tag' in tag list if it was never used, for autocompletion. | 164 | // Add no markdown 'meta-tag' in tag list if it was never used, for autocompletion. |
151 | if (! in_array(NO_MD_TAG, $data['tags'])) { | 165 | if (! in_array(NO_MD_TAG, $data['tags'])) { |
152 | $data['tags'][NO_MD_TAG] = 0; | 166 | $data['tags'][NO_MD_TAG] = 0; |
@@ -232,6 +246,25 @@ function reverse_space2nbsp($description) | |||
232 | } | 246 | } |
233 | 247 | ||
234 | /** | 248 | /** |
249 | * Replace not whitelisted protocols with http:// in given description. | ||
250 | * | ||
251 | * @param string $description input description text. | ||
252 | * @param array $allowedProtocols list of allowed protocols. | ||
253 | * | ||
254 | * @return string $description without malicious link. | ||
255 | */ | ||
256 | function filter_protocols($description, $allowedProtocols) | ||
257 | { | ||
258 | return preg_replace_callback( | ||
259 | '#]\((.*?)\)#is', | ||
260 | function ($match) use ($allowedProtocols) { | ||
261 | return ']('. whitelist_protocols($match[1], $allowedProtocols) .')'; | ||
262 | }, | ||
263 | $description | ||
264 | ); | ||
265 | } | ||
266 | |||
267 | /** | ||
235 | * Remove dangerous HTML tags (tags, iframe, etc.). | 268 | * Remove dangerous HTML tags (tags, iframe, etc.). |
236 | * Doesn't affect <code> content (already escaped by Parsedown). | 269 | * Doesn't affect <code> content (already escaped by Parsedown). |
237 | * | 270 | * |
@@ -275,7 +308,7 @@ function sanitize_html($description) | |||
275 | * | 308 | * |
276 | * @return string HTML processed $description. | 309 | * @return string HTML processed $description. |
277 | */ | 310 | */ |
278 | function process_markdown($description, $escape = true) | 311 | function process_markdown($description, $escape = true, $allowedProtocols = []) |
279 | { | 312 | { |
280 | $parsedown = new Parsedown(); | 313 | $parsedown = new Parsedown(); |
281 | 314 | ||
@@ -283,6 +316,7 @@ function process_markdown($description, $escape = true) | |||
283 | $processedDescription = reverse_nl2br($processedDescription); | 316 | $processedDescription = reverse_nl2br($processedDescription); |
284 | $processedDescription = reverse_space2nbsp($processedDescription); | 317 | $processedDescription = reverse_space2nbsp($processedDescription); |
285 | $processedDescription = reverse_text2clickable($processedDescription); | 318 | $processedDescription = reverse_text2clickable($processedDescription); |
319 | $processedDescription = filter_protocols($processedDescription, $allowedProtocols); | ||
286 | $processedDescription = unescape($processedDescription); | 320 | $processedDescription = unescape($processedDescription); |
287 | $processedDescription = $parsedown | 321 | $processedDescription = $parsedown |
288 | ->setMarkupEscaped($escape) | 322 | ->setMarkupEscaped($escape) |
@@ -296,3 +330,15 @@ function process_markdown($description, $escape = true) | |||
296 | 330 | ||
297 | return $processedDescription; | 331 | return $processedDescription; |
298 | } | 332 | } |
333 | |||
334 | /** | ||
335 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
336 | */ | ||
337 | function markdown_dummy_translation() | ||
338 | { | ||
339 | // meta | ||
340 | t('Render shaare description with Markdown syntax.<br><strong>Warning</strong>: | ||
341 | If your shaared descriptions contained HTML tags before enabling the markdown plugin, | ||
342 | enabling it might break your page. | ||
343 | See the <a href="https://github.com/shaarli/Shaarli/tree/master/plugins/markdown#html-rendering">README</a>.'); | ||
344 | } | ||
diff --git a/plugins/piwik/piwik.html b/plugins/piwik/piwik.html new file mode 100644 index 00000000..f4bc358a --- /dev/null +++ b/plugins/piwik/piwik.html | |||
@@ -0,0 +1,43 @@ | |||
1 | <!-- Piwik --> | ||
2 | <script type="text/javascript"> | ||
3 | /** @licstart The following is the entire license notice for the | ||
4 | * JavaScript code in this page. | ||
5 | * | ||
6 | * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> | ||
7 | * (c) 2011-2017 The Shaarli Community, see AUTHORS | ||
8 | * | ||
9 | * This software is provided 'as-is', without any express or implied warranty. | ||
10 | * In no event will the authors be held liable for any damages arising from | ||
11 | * the use of this software. | ||
12 | * | ||
13 | * Permission is granted to anyone to use this software for any purpose, | ||
14 | * including commercial applications, and to alter it and redistribute it | ||
15 | * freely, subject to the following restrictions: | ||
16 | * | ||
17 | * 1. The origin of this software must not be misrepresented; you must not | ||
18 | * claim that you wrote the original software. If you use this software | ||
19 | * in a product, an acknowledgment in the product documentation would | ||
20 | * be appreciated but is not required. | ||
21 | * | ||
22 | * 2. Altered source versions must be plainly marked as such, and must | ||
23 | * not be misrepresented as being the original software. | ||
24 | * | ||
25 | * 3. This notice may not be removed or altered from any source distribution. | ||
26 | * | ||
27 | * @licend The above is the entire license notice | ||
28 | * for the JavaScript code in this page. | ||
29 | */ | ||
30 | |||
31 | var _paq = _paq || []; | ||
32 | _paq.push(['trackPageView']); | ||
33 | _paq.push(['enableLinkTracking']); | ||
34 | (function() { | ||
35 | var u="%s/"; | ||
36 | _paq.push(['setTrackerUrl', u+'piwik.php']); | ||
37 | _paq.push(['setSiteId', '%s']); | ||
38 | var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; | ||
39 | g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); | ||
40 | })(); | ||
41 | </script> | ||
42 | <noscript><p><img src="%s/piwik.php?idsite=%s" style="border:0;" alt="" /></p></noscript> | ||
43 | <!-- End Piwik Code --> \ No newline at end of file | ||
diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php index 7c44909c..ca00c2be 100644 --- a/plugins/piwik/piwik.php +++ b/plugins/piwik/piwik.php | |||
@@ -18,8 +18,8 @@ function piwik_init($conf) | |||
18 | $piwikUrl = $conf->get('plugins.PIWIK_URL'); | 18 | $piwikUrl = $conf->get('plugins.PIWIK_URL'); |
19 | $piwikSiteid = $conf->get('plugins.PIWIK_SITEID'); | 19 | $piwikSiteid = $conf->get('plugins.PIWIK_SITEID'); |
20 | if (empty($piwikUrl) || empty($piwikSiteid)) { | 20 | if (empty($piwikUrl) || empty($piwikSiteid)) { |
21 | $error = 'Piwik plugin error: ' . | 21 | $error = t('Piwik plugin error: ' . |
22 | 'Please define PIWIK_URL and PIWIK_SITEID in the plugin administration page.'; | 22 | 'Please define PIWIK_URL and PIWIK_SITEID in the plugin administration page.'); |
23 | return array($error); | 23 | return array($error); |
24 | } | 24 | } |
25 | } | 25 | } |
@@ -50,22 +50,24 @@ function hook_piwik_render_footer($data, $conf) | |||
50 | } | 50 | } |
51 | 51 | ||
52 | // Free elements at the end of the page. | 52 | // Free elements at the end of the page. |
53 | $data['endofpage'][] = '<!-- Piwik -->' . | 53 | $data['endofpage'][] = sprintf( |
54 | '<script type="text/javascript">' . | 54 | file_get_contents(PluginManager::$PLUGINS_PATH . '/piwik/piwik.html'), |
55 | ' var _paq = _paq || [];' . | 55 | $piwikUrl, |
56 | ' _paq.push([\'trackPageView\']);' . | 56 | $piwikSiteid, |
57 | ' _paq.push([\'enableLinkTracking\']);' . | 57 | $piwikUrl, |
58 | ' (function() {' . | 58 | $piwikSiteid |
59 | ' var u="//' . $piwikUrl . '/";' . | 59 | ); |
60 | ' _paq.push([\'setTrackerUrl\', u+\'piwik.php\']);' . | ||
61 | ' _paq.push([\'setSiteId\', \'' . $piwikSiteid . '\']);' . | ||
62 | ' var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0];' . | ||
63 | ' g.type=\'text/javascript\'; g.async=true; g.defer=true; g.src=u+\'piwik.js\'; s.parentNode.insertBefore(g,s);' . | ||
64 | ' })();' . | ||
65 | '</script>' . | ||
66 | '<noscript><p><img src="//' . $piwikUrl . '/piwik.php?idsite=' . $piwikSiteid . '" style="border:0;" alt="" /></p></noscript>' . | ||
67 | '<!-- End Piwik Code -->'; | ||
68 | 60 | ||
69 | return $data; | 61 | return $data; |
70 | } | 62 | } |
71 | 63 | ||
64 | /** | ||
65 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
66 | */ | ||
67 | function piwik_dummy_translation() | ||
68 | { | ||
69 | // meta | ||
70 | t('A plugin that adds Piwik tracking code to Shaarli pages.'); | ||
71 | t('Piwik URL'); | ||
72 | t('Piwik site ID'); | ||
73 | } | ||
diff --git a/plugins/playvideos/README.md b/plugins/playvideos/README.md index b1698470..ab4be22a 100644 --- a/plugins/playvideos/README.md +++ b/plugins/playvideos/README.md | |||
@@ -8,7 +8,7 @@ This uses code from https://zaius.github.io/youtube_playlist/ and is currently o | |||
8 | 8 | ||
9 | #### Installation and setup | 9 | #### Installation and setup |
10 | 10 | ||
11 | This is a default Shaarli plugin, you just have to enable it. See https://github.com/shaarli/Shaarli/wiki/Shaarli-configuration/ | 11 | This is a default Shaarli plugin, you just have to enable it. See https://shaarli.readthedocs.io/en/master/Shaarli-configuration/ |
12 | 12 | ||
13 | 13 | ||
14 | #### Troubleshooting | 14 | #### Troubleshooting |
diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php index 64484504..c6d6b0cc 100644 --- a/plugins/playvideos/playvideos.php +++ b/plugins/playvideos/playvideos.php | |||
@@ -19,10 +19,10 @@ function hook_playvideos_render_header($data) | |||
19 | $playvideo = array( | 19 | $playvideo = array( |
20 | 'attr' => array( | 20 | 'attr' => array( |
21 | 'href' => '#', | 21 | 'href' => '#', |
22 | 'title' => 'Video player', | 22 | 'title' => t('Video player'), |
23 | 'id' => 'playvideos', | 23 | 'id' => 'playvideos', |
24 | ), | 24 | ), |
25 | 'html' => '► Play Videos' | 25 | 'html' => '► '. t('Play Videos') |
26 | ); | 26 | ); |
27 | $data['buttons_toolbar'][] = $playvideo; | 27 | $data['buttons_toolbar'][] = $playvideo; |
28 | } | 28 | } |
@@ -46,3 +46,12 @@ function hook_playvideos_render_footer($data) | |||
46 | 46 | ||
47 | return $data; | 47 | return $data; |
48 | } | 48 | } |
49 | |||
50 | /** | ||
51 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
52 | */ | ||
53 | function playvideos_dummy_translation() | ||
54 | { | ||
55 | // meta | ||
56 | t('Add a button in the toolbar allowing to watch all videos.'); | ||
57 | } | ||
diff --git a/plugins/playvideos/youtube_playlist.js b/plugins/playvideos/youtube_playlist.js index be8d63af..3b608a5d 100644 --- a/plugins/playvideos/youtube_playlist.js +++ b/plugins/playvideos/youtube_playlist.js | |||
@@ -1,3 +1,31 @@ | |||
1 | /** @licstart The following is the entire license notice for the | ||
2 | * JavaScript code in this page. | ||
3 | * | ||
4 | * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> | ||
5 | * (c) 2011-2017 The Shaarli Community, see AUTHORS | ||
6 | * | ||
7 | * This software is provided 'as-is', without any express or implied warranty. | ||
8 | * In no event will the authors be held liable for any damages arising from | ||
9 | * the use of this software. | ||
10 | * | ||
11 | * Permission is granted to anyone to use this software for any purpose, | ||
12 | * including commercial applications, and to alter it and redistribute it | ||
13 | * freely, subject to the following restrictions: | ||
14 | * | ||
15 | * 1. The origin of this software must not be misrepresented; you must not | ||
16 | * claim that you wrote the original software. If you use this software | ||
17 | * in a product, an acknowledgment in the product documentation would | ||
18 | * be appreciated but is not required. | ||
19 | * | ||
20 | * 2. Altered source versions must be plainly marked as such, and must | ||
21 | * not be misrepresented as being the original software. | ||
22 | * | ||
23 | * 3. This notice may not be removed or altered from any source distribution. | ||
24 | * | ||
25 | * @licend The above is the entire license notice | ||
26 | * for the JavaScript code in this page. | ||
27 | */ | ||
28 | |||
1 | var run_playideos = (function () { | 29 | var run_playideos = (function () { |
2 | var e, n, t, o, r, i = [].indexOf || function (e) { | 30 | var e, n, t, o, r, i = [].indexOf || function (e) { |
3 | for (var n = 0, t = this.length; n < t; n++) { | 31 | for (var n = 0, t = this.length; n < t; n++) { |
diff --git a/plugins/pubsubhubbub/README.md b/plugins/pubsubhubbub/README.md new file mode 100644 index 00000000..3a65492a --- /dev/null +++ b/plugins/pubsubhubbub/README.md | |||
@@ -0,0 +1,20 @@ | |||
1 | # PubSubHubbub plugin | ||
2 | |||
3 | Enable this plugin to notify a Hub everytime you add or edit a link. | ||
4 | |||
5 | This allow hub subcribers to receive update notifications in real time, | ||
6 | which is useful for feed syndication service which supports PubSubHubbub. | ||
7 | |||
8 | ## Public Hub | ||
9 | |||
10 | By default, Shaarli will use [Google's public hub](http://pubsubhubbub.appspot.com/). | ||
11 | |||
12 | [Here](https://github.com/pubsubhubbub/PubSubHubbub/wiki/Hubs) is a list of public hubs. | ||
13 | |||
14 | You can also host your own PubSubHubbub server implementation, such as [phubb](https://github.com/cweiske/phubb). | ||
15 | |||
16 | ## cURL | ||
17 | |||
18 | While there is a fallback function to notify the hub, it's recommended that | ||
19 | you have PHP cURL extension enabled to use this plugin. | ||
20 | |||
diff --git a/plugins/pubsubhubbub/hub.atom.xml b/plugins/pubsubhubbub/hub.atom.xml new file mode 100644 index 00000000..24d93d3e --- /dev/null +++ b/plugins/pubsubhubbub/hub.atom.xml | |||
@@ -0,0 +1 @@ | |||
<link rel="hub" href="%s" /> \ No newline at end of file | |||
diff --git a/plugins/pubsubhubbub/hub.rss.xml b/plugins/pubsubhubbub/hub.rss.xml new file mode 100644 index 00000000..27bf67a6 --- /dev/null +++ b/plugins/pubsubhubbub/hub.rss.xml | |||
@@ -0,0 +1 @@ | |||
<atom:link rel="hub" href="%s" /> \ No newline at end of file | |||
diff --git a/plugins/pubsubhubbub/pubsubhubbub.meta b/plugins/pubsubhubbub/pubsubhubbub.meta new file mode 100644 index 00000000..289f5cdb --- /dev/null +++ b/plugins/pubsubhubbub/pubsubhubbub.meta | |||
@@ -0,0 +1,2 @@ | |||
1 | description="Enable PubSubHubbub feed publishing." | ||
2 | parameters="PUBSUBHUB_URL" | ||
diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php new file mode 100644 index 00000000..184b588b --- /dev/null +++ b/plugins/pubsubhubbub/pubsubhubbub.php | |||
@@ -0,0 +1,111 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * PubSubHubbub plugin. | ||
5 | * | ||
6 | * PubSub is a protocol which fasten up RSS fetching: | ||
7 | * - Every time a new link is posted, Shaarli notify the hub. | ||
8 | * - The hub notify all feed subscribers that a new link has been posted. | ||
9 | * - Subscribers retrieve the new link. | ||
10 | */ | ||
11 | |||
12 | use pubsubhubbub\publisher\Publisher; | ||
13 | use Shaarli\Config\ConfigManager; | ||
14 | |||
15 | /** | ||
16 | * Plugin init function - set the hub to the default appspot one. | ||
17 | * | ||
18 | * @param ConfigManager $conf instance. | ||
19 | */ | ||
20 | function pubsubhubbub_init($conf) | ||
21 | { | ||
22 | $hub = $conf->get('plugins.PUBSUBHUB_URL'); | ||
23 | if (empty($hub)) { | ||
24 | // Default hub. | ||
25 | $conf->set('plugins.PUBSUBHUB_URL', 'https://pubsubhubbub.appspot.com/'); | ||
26 | } | ||
27 | } | ||
28 | |||
29 | |||
30 | /** | ||
31 | * Render feed hook. | ||
32 | * Adds the hub URL in ATOM and RSS feed. | ||
33 | * | ||
34 | * @param array $data Template data. | ||
35 | * @param ConfigManager $conf instance. | ||
36 | * | ||
37 | * @return array updated template data. | ||
38 | */ | ||
39 | function hook_pubsubhubbub_render_feed($data, $conf) | ||
40 | { | ||
41 | $feedType = $data['_PAGE_'] == Router::$PAGE_FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; | ||
42 | $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.'. $feedType .'.xml'); | ||
43 | $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL')); | ||
44 | |||
45 | return $data; | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * Save link hook. | ||
50 | * Publish to the hub when a link is saved. | ||
51 | * | ||
52 | * @param array $data Template data. | ||
53 | * @param ConfigManager $conf instance. | ||
54 | * | ||
55 | * @return array unaltered data. | ||
56 | */ | ||
57 | function hook_pubsubhubbub_save_link($data, $conf) | ||
58 | { | ||
59 | $feeds = array( | ||
60 | index_url($_SERVER) .'?do=atom', | ||
61 | index_url($_SERVER) .'?do=rss', | ||
62 | ); | ||
63 | |||
64 | $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post'; | ||
65 | try { | ||
66 | $p = new Publisher($conf->get('plugins.PUBSUBHUB_URL')); | ||
67 | $p->publish_update($feeds, $httpPost); | ||
68 | } catch (Exception $e) { | ||
69 | error_log(sprintf(t('Could not publish to PubSubHubbub: %s'), $e->getMessage())); | ||
70 | } | ||
71 | |||
72 | return $data; | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * Http function used to post to the hub endpoint without cURL extension. | ||
77 | * | ||
78 | * @param string $url Hub endpoint. | ||
79 | * @param string $postString String to POST. | ||
80 | * | ||
81 | * @return bool | ||
82 | * | ||
83 | * @throws Exception An error occurred. | ||
84 | */ | ||
85 | function nocurl_http_post($url, $postString) { | ||
86 | $params = array('http' => array( | ||
87 | 'method' => 'POST', | ||
88 | 'content' => $postString, | ||
89 | 'user_agent' => 'PubSubHubbub-Publisher-PHP/1.0', | ||
90 | )); | ||
91 | |||
92 | $context = stream_context_create($params); | ||
93 | $fp = @fopen($url, 'rb', false, $context); | ||
94 | if (!$fp) { | ||
95 | throw new Exception(sprintf(t('Could not post to %s'), $url)); | ||
96 | } | ||
97 | $response = @stream_get_contents($fp); | ||
98 | if ($response === false) { | ||
99 | throw new Exception(sprintf(t('Bad response from the hub %s'), $url)); | ||
100 | } | ||
101 | return $response; | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
106 | */ | ||
107 | function pubsubhubbub_dummy_translation() | ||
108 | { | ||
109 | // meta | ||
110 | t('Enable PubSubHubbub feed publishing.'); | ||
111 | } | ||
diff --git a/plugins/qrcode/qrcode.meta b/plugins/qrcode/qrcode.meta index cbf371ea..1812cd21 100644 --- a/plugins/qrcode/qrcode.meta +++ b/plugins/qrcode/qrcode.meta | |||
@@ -1 +1 @@ | |||
description="For each link, add a QRCode icon ." | description="For each link, add a QRCode icon." | ||
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index 8bc610d1..0f96a106 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php | |||
@@ -59,3 +59,12 @@ function hook_qrcode_render_includes($data) | |||
59 | 59 | ||
60 | return $data; | 60 | return $data; |
61 | } | 61 | } |
62 | |||
63 | /** | ||
64 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
65 | */ | ||
66 | function qrcode_dummy_translation() | ||
67 | { | ||
68 | // meta | ||
69 | t('For each link, add a QRCode icon.'); | ||
70 | } | ||
diff --git a/plugins/qrcode/shaarli-qrcode.js b/plugins/qrcode/shaarli-qrcode.js index 615f54c7..fe77c4cd 100644 --- a/plugins/qrcode/shaarli-qrcode.js +++ b/plugins/qrcode/shaarli-qrcode.js | |||
@@ -1,3 +1,31 @@ | |||
1 | /** @licstart The following is the entire license notice for the | ||
2 | * JavaScript code in this page. | ||
3 | * | ||
4 | * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> | ||
5 | * (c) 2011-2017 The Shaarli Community, see AUTHORS | ||
6 | * | ||
7 | * This software is provided 'as-is', without any express or implied warranty. | ||
8 | * In no event will the authors be held liable for any damages arising from | ||
9 | * the use of this software. | ||
10 | * | ||
11 | * Permission is granted to anyone to use this software for any purpose, | ||
12 | * including commercial applications, and to alter it and redistribute it | ||
13 | * freely, subject to the following restrictions: | ||
14 | * | ||
15 | * 1. The origin of this software must not be misrepresented; you must not | ||
16 | * claim that you wrote the original software. If you use this software | ||
17 | * in a product, an acknowledgment in the product documentation would | ||
18 | * be appreciated but is not required. | ||
19 | * | ||
20 | * 2. Altered source versions must be plainly marked as such, and must | ||
21 | * not be misrepresented as being the original software. | ||
22 | * | ||
23 | * 3. This notice may not be removed or altered from any source distribution. | ||
24 | * | ||
25 | * @licend The above is the entire license notice | ||
26 | * for the JavaScript code in this page. | ||
27 | */ | ||
28 | |||
1 | // Show the QR-Code of a permalink (when the QR-Code icon is clicked). | 29 | // Show the QR-Code of a permalink (when the QR-Code icon is clicked). |
2 | function showQrCode(caller,loading) | 30 | function showQrCode(caller,loading) |
3 | { | 31 | { |
diff --git a/plugins/readityourself/book-open.png b/plugins/readityourself/book-open.png deleted file mode 100644 index 36513d7b..00000000 --- a/plugins/readityourself/book-open.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/plugins/readityourself/readityourself.html b/plugins/readityourself/readityourself.html deleted file mode 100644 index 5e200715..00000000 --- a/plugins/readityourself/readityourself.html +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | <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/readityourself/readityourself.meta b/plugins/readityourself/readityourself.meta deleted file mode 100644 index bd611dd0..00000000 --- a/plugins/readityourself/readityourself.meta +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | description="For each link, add a ReadItYourself icon to save the shaared URL." | ||
2 | parameters=READITYOUSELF_URL; \ No newline at end of file | ||
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php deleted file mode 100644 index 961c5bda..00000000 --- a/plugins/readityourself/readityourself.php +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Plugin readityourself | ||
5 | */ | ||
6 | |||
7 | // If we're talking about https://github.com/memiks/readityourself | ||
8 | // it seems kinda dead. | ||
9 | // Not tested. | ||
10 | |||
11 | /** | ||
12 | * Init function, return an error if the server is not set. | ||
13 | * | ||
14 | * @param $conf ConfigManager instance. | ||
15 | * | ||
16 | * @return array Eventual error. | ||
17 | */ | ||
18 | function readityourself_init($conf) | ||
19 | { | ||
20 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
21 | if (empty($riyUrl)) { | ||
22 | $error = 'Readityourself plugin error: '. | ||
23 | 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; | ||
24 | return array($error); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * Add readityourself icon to link_plugin when rendering linklist. | ||
30 | * | ||
31 | * @param mixed $data Linklist data. | ||
32 | * @param ConfigManager $conf Configuration Manager instance. | ||
33 | * | ||
34 | * @return mixed - linklist data with readityourself plugin. | ||
35 | */ | ||
36 | function hook_readityourself_render_linklist($data, $conf) | ||
37 | { | ||
38 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
39 | if (empty($riyUrl)) { | ||
40 | return $data; | ||
41 | } | ||
42 | |||
43 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); | ||
44 | |||
45 | foreach ($data['links'] as &$value) { | ||
46 | $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH); | ||
47 | $value['link_plugin'][] = $readityourself; | ||
48 | } | ||
49 | |||
50 | return $data; | ||
51 | } | ||
diff --git a/plugins/wallabag/WallabagInstance.php b/plugins/wallabag/WallabagInstance.php index 72cc2e5e..eb8ab618 100644 --- a/plugins/wallabag/WallabagInstance.php +++ b/plugins/wallabag/WallabagInstance.php | |||
@@ -35,7 +35,7 @@ class WallabagInstance | |||
35 | */ | 35 | */ |
36 | private $apiVersion; | 36 | private $apiVersion; |
37 | 37 | ||
38 | function __construct($instance, $version) | 38 | public function __construct($instance, $version) |
39 | { | 39 | { |
40 | if ($this->isVersionAllowed($version)) { | 40 | if ($this->isVersionAllowed($version)) { |
41 | $this->apiVersion = self::$wallabagVersions[$version]; | 41 | $this->apiVersion = self::$wallabagVersions[$version]; |
diff --git a/plugins/wallabag/wallabag.html b/plugins/wallabag/wallabag.html index e861536d..4c57691d 100644 --- a/plugins/wallabag/wallabag.html +++ b/plugins/wallabag/wallabag.html | |||
@@ -1 +1,5 @@ | |||
1 | <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> | 1 | <span> |
2 | <a href="%s%s" target="_blank"> | ||
3 | <img class="linklist-plugin-icon" src="%s/wallabag/wallabag.png" title="%s" alt="wallabag" /> | ||
4 | </a> | ||
5 | </span> | ||
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 641e4cc2..9dfd079e 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | require_once 'WallabagInstance.php'; | 7 | require_once 'WallabagInstance.php'; |
8 | use Shaarli\Config\ConfigManager; | ||
8 | 9 | ||
9 | /** | 10 | /** |
10 | * Init function, return an error if the server is not set. | 11 | * Init function, return an error if the server is not set. |
@@ -17,8 +18,8 @@ function wallabag_init($conf) | |||
17 | { | 18 | { |
18 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); | 19 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
19 | if (empty($wallabagUrl)) { | 20 | if (empty($wallabagUrl)) { |
20 | $error = 'Wallabag plugin error: '. | 21 | $error = t('Wallabag plugin error: '. |
21 | 'Please define the "WALLABAG_URL" setting in the plugin administration page.'; | 22 | 'Please define the "WALLABAG_URL" setting in the plugin administration page.'); |
22 | return array($error); | 23 | return array($error); |
23 | } | 24 | } |
24 | } | 25 | } |
@@ -43,12 +44,14 @@ function hook_wallabag_render_linklist($data, $conf) | |||
43 | 44 | ||
44 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 45 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
45 | 46 | ||
47 | $linkTitle = t('Save to wallabag'); | ||
46 | foreach ($data['links'] as &$value) { | 48 | foreach ($data['links'] as &$value) { |
47 | $wallabag = sprintf( | 49 | $wallabag = sprintf( |
48 | $wallabagHtml, | 50 | $wallabagHtml, |
49 | $wallabagInstance->getWallabagUrl(), | 51 | $wallabagInstance->getWallabagUrl(), |
50 | urlencode($value['url']), | 52 | urlencode($value['url']), |
51 | PluginManager::$PLUGINS_PATH | 53 | PluginManager::$PLUGINS_PATH, |
54 | $linkTitle | ||
52 | ); | 55 | ); |
53 | $value['link_plugin'][] = $wallabag; | 56 | $value['link_plugin'][] = $wallabag; |
54 | } | 57 | } |
@@ -56,3 +59,14 @@ function hook_wallabag_render_linklist($data, $conf) | |||
56 | return $data; | 59 | return $data; |
57 | } | 60 | } |
58 | 61 | ||
62 | /** | ||
63 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
64 | */ | ||
65 | function wallabag_dummy_translation() | ||
66 | { | ||
67 | // meta | ||
68 | t('For each link, add a QRCode icon.'); | ||
69 | t('Wallabag API URL'); | ||
70 | t('Wallabag API version (1 or 2)'); | ||
71 | } | ||
72 | |||