-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin system #164
Plugin system #164
Conversation
You can now place raintpl template elements in tpl/plugins/ This allows adding custom HTML elements to the base template. It is possible to inject these elements at the following places on the default template. Where they are loaded depends on their path/filename. * Toolbar buttons (eg. tpl/plugins/coolbutton/coolbutton.toolbar.html) * Link info fields (eg. tpl/plugins/send-to-twitter.html) * Page footer (eg. tpl/plugins/footer-message/footer-message.footer.html) Plugins have to be manually enabled in data/options.php. If you want to enable the 'example1' and 'example2' plugins: $GLOBALS['config']['PLUGINS'] = array('example1', 'example2'); Some cleanup: Move rendering the linklist to a separate function; Create a PageBuilder **every time** we render the page. Credits to @pikzen for the refactoring and plugin loading code.
* add QR code rendering to tpl/plugins/qrcode/* * move required resources (js, image) there and update COPYING * use the minified qr.js * enable the 'qrcode' plugin by default in index.php 'PLUGINS' config array to preserve old functionality.
to enable it, add 'archiveorg' to the 'PLUGINS' config array in data/options.php
Plays all Youtube videos linked from the page in an overlay HTML5 player, one after another (playlist).
Files should be named tpl/plugins/*/*.includes.html
…r later reading wallabag is a self hostable application for saving web pages. It saves the content you select so that you can read it when you have time. https://www.wallabag.org/ There are two ways to use wallabag: you can install it on your web server or you can create a free account at Framabag. Framabag is a Framasoft service. Configuration of base wallabag URL is done through the WALLABAG_URL global variable in data/options.php. Example $GLOBALS['config']['WALLABAG_URL'] = "https://demo.wallabag.org/" Fixes sebsauvage#167 Temporarily define the default WALLABAG_URL value in index.php. It should be loaded from a file in the plugin directory (tpl/*/*.config.php)
…e" version of the links content Fixes sebsauvage#66 This plugin adds, for each link, a button to display a more readable version using an external readityourself service - self-hostable web application, similar to the Pocket proprietary service: https://github.com/memiks/readityourself The base readityourself url is configurable through the READITYOURSELF_URL config variable in data/options.php
Would it not make more sense that plugins are at the same level as the template folder ? it might be better to do : /tpl/templates/ or /tpl/ |
I'll look into this, but I don't think you can include template elements from outside the |
Isso comments
Blocked by #163 |
I retrieved @nodiscc plugin system proposed in #164 and changed it to create PHP plugin system. It relies on hooks triggered by certain actions (only template rendering for now). **It's only a proposition, let me know what you think of it**. * I think that an 'only template' plugin system might be too restrictive, and doesn't allow a lot of extension. * I raised concerns in #44 and don't blend too well with user made templates. * @nodiscc lacks of time to finish this. * I'd like to see 0.9beta release one day. :) PluginManager class includes enabled plugin PHP files at loading and register their hook function. When we want to trigger a hook, 'PluginManager::executeHooks()' is called, eventually with rendering data. It will call every plugin function registered under the standardized name: hook_<plugin_name>_<hook_name> Rendering data can be altered and/or completed. This is exactly what @nodiscc did. Templates contain plugin display at specific location, which are populated by the plugin functions. Here is what's has been done: * hook_render_linklist: when linklist is rendered, all links data passed to plugins. It allows plugins to alter link rendering (such as Markdown parsing). They can also add a linklist icon for every link (QRCode, etc.) * hook_render_header: every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (toolbar). * hook_render_footer: : every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (JS file). * hook_render_includes: : every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (CSS file). We can easily add hooks to whatever is pertinent (link add, picwal rendering, etc.). * Strong documentation, especially for plugin developers. * Unit tests for PluginManger and Router. * Test this heavily. Later: * finish Markdown plugin. * Add a plugin page in administration.
I retrieved @nodiscc plugin system proposed in shaarli#164 and changed it to create PHP plugin system. It relies on hooks triggered by certain actions (only template rendering for now). **It's only a proposition, let me know what you think of it**. * I think that an 'only template' plugin system might be too restrictive, and doesn't allow a lot of extension. * I raised concerns in shaarli#44 and don't blend too well with user made templates. * @nodiscc lacks of time to finish this. * I'd like to see 0.9beta release one day. :) PluginManager class includes enabled plugin PHP files at loading and register their hook function. When we want to trigger a hook, 'PluginManager::executeHooks()' is called, eventually with rendering data. It will call every plugin function registered under the standardized name: hook_<plugin_name>_<hook_name> Rendering data can be altered and/or completed. This is exactly what @nodiscc did. Templates contain plugin display at specific location, which are populated by the plugin functions. Here is what's has been done: * hook_render_linklist: when linklist is rendered, all links data passed to plugins. It allows plugins to alter link rendering (such as Markdown parsing). They can also add a linklist icon for every link (QRCode, etc.) * hook_render_header: every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (toolbar). * hook_render_footer: : every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (JS file). * hook_render_includes: : every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (CSS file). We can easily add hooks to whatever is pertinent (link add, picwal rendering, etc.). * Strong documentation, especially for plugin developers. * Unit tests for PluginManger and Router. * Test this heavily. Later: * finish Markdown plugin. * Add a plugin page in administration.
I retrieved @nodiscc plugin system proposed in shaarli#164 and changed it to create PHP plugin system. It relies on hooks triggered by certain actions (only template rendering for now). **It's only a proposition, let me know what you think of it**. * I think that an 'only template' plugin system might be too restrictive, and doesn't allow a lot of extension. * I raised concerns in shaarli#44 and don't blend too well with user made templates. * @nodiscc lacks of time to finish this. * I'd like to see 0.9beta release one day. :) PluginManager class includes enabled plugin PHP files at loading and register their hook function. When we want to trigger a hook, 'PluginManager::executeHooks()' is called, eventually with rendering data. It will call every plugin function registered under the standardized name: hook_<plugin_name>_<hook_name> Rendering data can be altered and/or completed. This is exactly what @nodiscc did. Templates contain plugin display at specific location, which are populated by the plugin functions. Here is what's has been done: * hook_render_linklist: when linklist is rendered, all links data passed to plugins. It allows plugins to alter link rendering (such as Markdown parsing). They can also add a linklist icon for every link (QRCode, etc.) * hook_render_header: every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (toolbar). * hook_render_footer: : every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (JS file). * hook_render_includes: : every page builder triggers this hook. Plugins can add specific data to header if the current page is concerned (CSS file). We can easily add hooks to whatever is pertinent (link add, picwal rendering, etc.). * Strong documentation, especially for plugin developers. * Unit tests for PluginManger and Router. * Test this heavily. Later: * finish Markdown plugin. * Add a plugin page in administration.
Obsoleted by #275 |
See commit messages for detailed and up-to date info
You can now place raintpl template elements in tpl/plugins/
This allows adding custom HTML elements to the base template.
It is possible to inject these elements at the following places on the
default template. Where they are loaded depends on their path/filename.
Plugins have to be manually enabled in data/options.php. If you want to enable
the 'example1' and 'example2' plugins: