mantisbt:dynamic_plugin_requirements
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
mantisbt:dynamic_plugin_requirements [2007/10/28 16:14] – Some comments vboctor | mantisbt:dynamic_plugin_requirements [2008/01/03 16:49] – DGtlRift | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Dynamic Plugin Requirements ====== | ||
- | **Author:** John Reese | ||
- | |||
- | **Status:** Feedback / Bugfixing | ||
- | |||
- | ===== Introduction ===== | ||
- | |||
- | This is a proposal for a very lightweight method of including a plugin/hook system for Mantis. | ||
- | |||
- | This feature is meant as a counter point to the [[addson_requirements|Add-Ons Support Requirements]] by offering a much simpler and easier to use plugin system without sacrificing flexibility or power. | ||
- | |||
- | ===== Proposed Approach ===== | ||
- | |||
- | Plugins will be very simple packages, extracted into the Mantis/ | ||
- | |||
- | When a plugin is loaded at runtime, it will register basic information about itself to Mantis, including its name, author, description, | ||
- | |||
- | New content pages will be added by creating scripts in a special directory of the plugin, and links to that page will be created with an API call to simplify the task. Plugin pages will not need to load the Mantis core, but will need to call the html_page_top() or html_page_bottom() functions as necessary. | ||
- | |||
- | ==== Language Files ==== | ||
- | |||
- | To simplify the usage of language files, plugins will simply need to supply a '' | ||
- | |||
- | ==== Database Schema ==== | ||
- | |||
- | There will need to be a simple and unified method for plugins to maintain their database schema, otherwise plugins will get released without proper upgrade paths for users. | ||
- | |||
- | ==== Event Types ==== | ||
- | |||
- | These should be the basic event types, from which all (or most) events can be formed. | ||
- | |||
- | ** Execute event ** | ||
- | * Simplest type of event. | ||
- | * No parameters | ||
- | * No return value | ||
- | * Includes EVENT_PLUGIN_INIT | ||
- | ** Output event ** | ||
- | * Event giving plugins a chance to output content. | ||
- | * Parameters: | ||
- | * separator string to output between plugins | ||
- | * No return value | ||
- | * Includes EVENT_PAGE_TOP and EVENT_PAGE_BOTTOM | ||
- | ** Process event ** | ||
- | * Event allowing a plugin to process an input string and return a modified version to the originator. | ||
- | * Parameters: | ||
- | * Input string | ||
- | * Return value: | ||
- | * Modified input string | ||
- | * Includes EVENT_TEXT_GENERAL for bug links, bugnote links, wiki links, and other markup options. | ||
- | ** Default event ** | ||
- | * Can be used for everything else. | ||
- | * Parameters | ||
- | * Array of key/value pairs as direct parameters to the callback | ||
- | * Return value | ||
- | * Array of key/value pairs directly from the callback | ||
- | |||
- | ===== Database Changes ===== | ||
- | |||
- | * Create table '' | ||
- | * **basename varchar(40)** primary key, the directory name for the plugin | ||
- | * **enabled boolean** index | ||
- | |||
- | ===== Configuration Changes ===== | ||
- | |||
- | * '' | ||
- | * '' | ||
- | |||
- | ===== Sample Event Flows ===== | ||
- | |||
- | |||
- | ==== Plugin Execution ==== | ||
- | |||
- | This flow of action should occur during normal Mantis execution. | ||
- | |||
- | * List of enabled plugins is retrieved from database. | ||
- | * For each enabled plugin: | ||
- | * Include '' | ||
- | * Call '' | ||
- | * Call '' | ||
- | * Send EVENT_PLUGIN_INIT signal | ||
- | * Execute normal page contents with events as necessary | ||
- | |||
- | ==== Event Execution ==== | ||
- | |||
- | This flow of action should occur whenever an event is signaled, assuming plugins are enabled. | ||
- | |||
- | * Prepare parameters from event origin | ||
- | * For each registered callback: | ||
- | * Include '' | ||
- | * Call '' | ||
- | * Alter parameters for next callback if necessary | ||
- | * Output content if necessary | ||
- | * Return callback values to event originator if necessary | ||
- | |||
- | ===== Plugin Hierarchy ===== | ||
- | |||
- | < | ||
- | |||
- | < | ||
- | mantis/ | ||
- | plugins/ | ||
- | < | ||
- | register.php | ||
- | events.php | ||
- | lang/ | ||
- | ... | ||
- | pages/ | ||
- | ... | ||
- | </ | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | ==== Sample Plugin (Super Cow Powers) ==== | ||
- | |||
- | This is a very minimal plugin. | ||
- | |||
- | **Directory Structure** | ||
- | < | ||
- | mantis/ | ||
- | plugins/ | ||
- | supercow/ | ||
- | register.php | ||
- | events.php | ||
- | </ | ||
- | |||
- | **'' | ||
- | < | ||
- | <?php | ||
- | |||
- | /** | ||
- | * Return plugin details to the API. | ||
- | * @return array Plugin details | ||
- | */ | ||
- | function plugin_callback_supercow_info() { | ||
- | return array( | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ); | ||
- | } | ||
- | |||
- | /** | ||
- | * Register callback methods for any events necessary. | ||
- | */ | ||
- | function plugin_callback_supercow_register() { | ||
- | plugin_register( ' | ||
- | } | ||
- | </ | ||
- | |||
- | **'' | ||
- | < | ||
- | <?php | ||
- | |||
- | /** | ||
- | * Handle the EVENT_PLUGIN_INIT callback. | ||
- | */ | ||
- | function plugin_event_callback_supercow_header() { | ||
- | header( ' | ||
- | } | ||
- | </ | ||
- | |||
- | ===== Feedback ===== | ||
- | |||
- | * (vboctor): EVENT_TEXT_GENERAL - You might need to differentiate where this text is going, e.g. normal text (like string_display()), | ||
- | * (vboctor): EVENT_TEXT_GENERAL - I am assuming that you will be pipelining the results of one plug-in into another, right? | ||
- | * (vboctor): EVENT_TEXT_GENERAL - If you look at the current implementation you will notice that the order of applying the display filters affects the final results. | ||
- | * (vboctor): Default event - With the default events, how are you going to handle the return values returned by all these plug-ins? | ||
- | * (vboctor): How is the admin going to enable/ |
mantisbt/dynamic_plugin_requirements.txt · Last modified: 2008/10/29 04:25 by 127.0.0.1