From 5409ade28c5f0acf99dbadd4d95e6f8efda5d395 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 14 Apr 2016 14:20:23 +0200 Subject: Update docs from Wiki --- doc/Plugin-System.md | 78 ++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 36 deletions(-) (limited to 'doc/Plugin-System.md') 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 @@ #Plugin System -> Note: Plugin current status - in developpement (not merged into master). +> Note: Plugin current status - in development (not merged into master). -[**I am a user.** Plugin User Guide.](#plugin-user-guide)[](.html) - -[**I am a developper.** Developper API.](#developper-api)[](.html) +[**I am a developer.** Developer API.](#developer-api)[](.html) [**I am a template designer.** Guide for template designer.](#guide-for-template-designer)[](.html) -## Plugin User Guide - -### Manage plugins - -In `config.php`, change $GLOBALS['config'['ENABLED_PLUGINS'] array:]('ENABLED_PLUGINS']-array:.html) - -```php -$GLOBALS['config'['ENABLED_PLUGINS']]('ENABLED_PLUGINS'].html) -``` - -Full list: - -```php -$GLOBALS['config'['ENABLED_PLUGINS'] = array(]('ENABLED_PLUGINS']-=-array(.html) - 'qrcode', 'archiveorg', 'readityourself', 'playvideos', - 'wallabag', 'markdown', 'addlink_toolbar', -); -``` - -### List of plugins - -Plugin maintained by the community: - - * Archive.org - add a clickable icon to every link to archive.org. - * Addlink in toolbar - add a field to paste new links URL in toolbar. - * Markdown - write and display Shaare in Markdown. - * Play videos - popup to play all videos displayed in linklist. - * QRCode - add a clickable icon generating a QRCode for every link. - * ReadItYourself - add a clickable icon for ReadItYourself. - * Wallabag - add a clickable icon for Wallabag. - -## Developper API +## Developer API ### What can I do with plugins? @@ -123,6 +90,17 @@ foreach ($data['links'] as &$value) {[](.html) return $data; ``` +### Metadata + +Every plugin needs a `.meta` file, which is in fact an `.ini` file (`KEY="VALUE"`), to be listed in plugin administration. + +Each file contain two keys: + + * `description`: plugin description + * `parameters`: user parameter names, separated by a `;`. + +> Note: In PHP, `parse_ini_file()` seems to want strings to be between by quotes `"` in the ini file. + ### It's not working! 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. ## Guide for template designer +### Plugin administration + +Your theme must include a plugin administration page: `pluginsadmin.html`. + +> Note: repo's template link needs to be added when the PR is merged. + +Use the default one as an example. + +Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include `plugin_admin.js`, only if: + + * you're using a table. + * you call orderUp() and orderUp() onclick on arrows. + * you add data-line and data-order to your rows. + +Otherwise, you can use your own JS as long as this field is send by the form: + + + ### Placeholder system 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: {$value} {/loop} +At the end of file, before clearing floating blocks: + + {if="!empty($plugin_errors) && isLoggedIn()"} + + {/if} + **includes.html** At the end of the file: -- cgit v1.2.3