diff options
Diffstat (limited to 'doc/Plugin-System.md')
-rw-r--r-- | doc/Plugin-System.md | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/doc/Plugin-System.md b/doc/Plugin-System.md index 8cba6664..8281e61d 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. |
@@ -399,6 +377,24 @@ Allow to alter the link being saved in the datastore. | |||
399 | 377 | ||
400 | ## Guide for template designer | 378 | ## Guide for template designer |
401 | 379 | ||
380 | ### Plugin administration | ||
381 | |||
382 | Your theme must include a plugin administration page: `pluginsadmin.html`. | ||
383 | |||
384 | > Note: repo's template link needs to be added when the PR is merged. | ||
385 | |||
386 | Use the default one as an example. | ||
387 | |||
388 | Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include `plugin_admin.js`, only if: | ||
389 | |||
390 | * you're using a table. | ||
391 | * you call orderUp() and orderUp() onclick on arrows. | ||
392 | * you add data-line and data-order to your rows. | ||
393 | |||
394 | Otherwise, you can use your own JS as long as this field is send by the form: | ||
395 | |||
396 | <input type="hidden" name="order_{$key}" value="{$counter}"> | ||
397 | |||
402 | ### Placeholder system | 398 | ### Placeholder system |
403 | 399 | ||
404 | In order to make plugins work with every custom themes, you need to add variable placeholder in your templates. | 400 | In order to make plugins work with every custom themes, you need to add variable placeholder in your templates. |
@@ -421,6 +417,16 @@ At the end of the menu: | |||
421 | {$value} | 417 | {$value} |
422 | {/loop} | 418 | {/loop} |
423 | 419 | ||
420 | At the end of file, before clearing floating blocks: | ||
421 | |||
422 | {if="!empty($plugin_errors) && isLoggedIn()"} | ||
423 | <ul class="errors"> | ||
424 | {loop="plugin_errors"} | ||
425 | <li>{$value}</li> | ||
426 | {/loop} | ||
427 | </ul> | ||
428 | {/if} | ||
429 | |||
424 | **includes.html** | 430 | **includes.html** |
425 | 431 | ||
426 | At the end of the file: | 432 | At the end of the file: |