diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-10-12 13:58:35 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-10-12 13:58:35 +0200 |
commit | bc22c9a0acb095970e9494cbe8954f0612e05dc0 (patch) | |
tree | 4e3a94b7469f5b2e3eaf946756235730429bf9d4 /doc/Plugin-System.md | |
parent | 890afc32f744859d11b97eb26ed5c030af9b4145 (diff) | |
parent | ebd67c6e1b40aebdd3a52285ce9ff9412b2a3038 (diff) | |
download | Shaarli-bc22c9a0acb095970e9494cbe8954f0612e05dc0.tar.gz Shaarli-bc22c9a0acb095970e9494cbe8954f0612e05dc0.tar.zst Shaarli-bc22c9a0acb095970e9494cbe8954f0612e05dc0.zip |
Merge tag 'v0.7.0' of github.com:shaarli/Shaarli into stable
Release v0.7.0
Diffstat (limited to 'doc/Plugin-System.md')
-rw-r--r-- | doc/Plugin-System.md | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/doc/Plugin-System.md b/doc/Plugin-System.md index 8cba6664..623627dd 100644 --- a/doc/Plugin-System.md +++ b/doc/Plugin-System.md | |||
@@ -1,44 +1,11 @@ | |||
1 | #Plugin System | 1 | #Plugin System |
2 | > Note: Plugin current status - in developpement (not merged into master). | 2 | > Note: Plugin current status - in development (not merged into master). |
3 | 3 | ||
4 | [**I am a user.** Plugin User Guide.](#plugin-user-guide)[](.html) | 4 | [**I am a developer.** Developer API.](#developer-api)[](.html) |
5 | |||
6 | [**I am a developper.** Developper API.](#developper-api)[](.html) | ||
7 | 5 | ||
8 | [**I am a template designer.** Guide for template designer.](#guide-for-template-designer)[](.html) | 6 | [**I am a template designer.** Guide for template designer.](#guide-for-template-designer)[](.html) |
9 | 7 | ||
10 | ## Plugin User Guide | 8 | ## Developer API |
11 | |||
12 | ### Manage plugins | ||
13 | |||
14 | In `config.php`, change $GLOBALS['config'['ENABLED_PLUGINS'] array:]('ENABLED_PLUGINS']-array:.html) | ||
15 | |||
16 | ```php | ||
17 | $GLOBALS['config'['ENABLED_PLUGINS']]('ENABLED_PLUGINS'].html) | ||
18 | ``` | ||
19 | |||
20 | Full list: | ||
21 | |||
22 | ```php | ||
23 | $GLOBALS['config'['ENABLED_PLUGINS'] = array(]('ENABLED_PLUGINS']-=-array(.html) | ||
24 | 'qrcode', 'archiveorg', 'readityourself', 'playvideos', | ||
25 | 'wallabag', 'markdown', 'addlink_toolbar', | ||
26 | ); | ||
27 | ``` | ||
28 | |||
29 | ### List of plugins | ||
30 | |||
31 | Plugin maintained by the community: | ||
32 | |||
33 | * Archive.org - add a clickable icon to every link to archive.org. | ||
34 | * Addlink in toolbar - add a field to paste new links URL in toolbar. | ||
35 | * Markdown - write and display Shaare in Markdown. | ||
36 | * Play videos - popup to play all videos displayed in linklist. | ||
37 | * QRCode - add a clickable icon generating a QRCode for every link. | ||
38 | * ReadItYourself - add a clickable icon for ReadItYourself. | ||
39 | * Wallabag - add a clickable icon for Wallabag. | ||
40 | |||
41 | ## Developper API | ||
42 | 9 | ||
43 | ### What can I do with plugins? | 10 | ### What can I do with plugins? |
44 | 11 | ||
@@ -123,6 +90,17 @@ foreach ($data['links'] as &$value) {[](.html) | |||
123 | return $data; | 90 | return $data; |
124 | ``` | 91 | ``` |
125 | 92 | ||
93 | ### Metadata | ||
94 | |||
95 | Every plugin needs a `<plugin_name>.meta` file, which is in fact an `.ini` file (`KEY="VALUE"`), to be listed in plugin administration. | ||
96 | |||
97 | Each file contain two keys: | ||
98 | |||
99 | * `description`: plugin description | ||
100 | * `parameters`: user parameter names, separated by a `;`. | ||
101 | |||
102 | > Note: In PHP, `parse_ini_file()` seems to want strings to be between by quotes `"` in the ini file. | ||
103 | |||
126 | ### It's not working! | 104 | ### It's not working! |
127 | 105 | ||
128 | Use `demo_plugin` as a functional example. It covers most of the plugin system features. | 106 | Use `demo_plugin` as a functional example. It covers most of the plugin system features. |
@@ -217,6 +195,7 @@ Items can be displayed in templates by adding an entry in `$data['<placeholder>' | |||
217 | List of placeholders: | 195 | List of placeholders: |
218 | 196 | ||
219 | * `text`: called after the end of the footer text. | 197 | * `text`: called after the end of the footer text. |
198 | * `endofpage`: called at the end of the page. | ||
220 | 199 | ||
221 | ![text_example](http://i.imgur.com/L5S2YEH.png)[](.html) | 200 | ![text_example](http://i.imgur.com/L5S2YEH.png)[](.html) |
222 | 201 | ||
@@ -399,6 +378,24 @@ Allow to alter the link being saved in the datastore. | |||
399 | 378 | ||
400 | ## Guide for template designer | 379 | ## Guide for template designer |
401 | 380 | ||
381 | ### Plugin administration | ||
382 | |||
383 | Your theme must include a plugin administration page: `pluginsadmin.html`. | ||
384 | |||
385 | > Note: repo's template link needs to be added when the PR is merged. | ||
386 | |||
387 | Use the default one as an example. | ||
388 | |||
389 | Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include `plugin_admin.js`, only if: | ||
390 | |||
391 | * you're using a table. | ||
392 | * you call orderUp() and orderUp() onclick on arrows. | ||
393 | * you add data-line and data-order to your rows. | ||
394 | |||
395 | Otherwise, you can use your own JS as long as this field is send by the form: | ||
396 | |||
397 | <input type="hidden" name="order_{$key}" value="{$counter}"> | ||
398 | |||
402 | ### Placeholder system | 399 | ### Placeholder system |
403 | 400 | ||
404 | In order to make plugins work with every custom themes, you need to add variable placeholder in your templates. | 401 | In order to make plugins work with every custom themes, you need to add variable placeholder in your templates. |
@@ -421,6 +418,16 @@ At the end of the menu: | |||
421 | {$value} | 418 | {$value} |
422 | {/loop} | 419 | {/loop} |
423 | 420 | ||
421 | At the end of file, before clearing floating blocks: | ||
422 | |||
423 | {if="!empty($plugin_errors) && isLoggedIn()"} | ||
424 | <ul class="errors"> | ||
425 | {loop="plugin_errors"} | ||
426 | <li>{$value}</li> | ||
427 | {/loop} | ||
428 | </ul> | ||
429 | {/if} | ||
430 | |||
424 | **includes.html** | 431 | **includes.html** |
425 | 432 | ||
426 | At the end of the file: | 433 | At the end of the file: |