|
TWiki Plugins |
|
< < | TWikiPlugins allow you to add new features to TWiki without changing the core program. Using a plug-in approach means that you can: |
> > | Plugin use and development; about the Plugin API. |
| |
|
< < |
- add virtually unlimited features while keeping the main TWiki program compact and efficient;
|
> > | Overview
You can add Plugins to greatly extend TWiki's functionality, without alering the program core. With a plug-in approach, you can:
- add virtually unlimited features while keeping the main TWiki code compact and efficient;
|
|
- heavily customize an installation and still do clean updates to new versions of TWiki;
- rapidly develop new TWiki functions in Perl using the Plugin API.
|
|
< < | Everything to do with TWiki Plugins - including demos, new releases, downloads, and discussion - is available at TWiki.org, in the TWiki.org Plugins web. |
> > | Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki.org Plugins web.
Preinstalled Plugins
TWiki comes with three Plugins as part of the standard installation.
- DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
- EmptyPlug is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.
- InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites:
TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.
|
|
Installing Plugins |
|
- Distribute the files to their proper locations - unzip the zip archive in your TWiki installation directory - if have a standard TWiki installation, this will distribute automatically. Otherwise, place the files according to the directory paths listed on the Plugin top in TWiki:Plugins.
- Check the demo example on the Plugin topic: if it's working, the installation was fine!
|
|
< < | Some Plugins need certain Perl modules to be pre-installed on the host system. Plugins may also use other resources, like graphics, other modules, applications, templates. In these cases, detailed instructions are in the Plugin documentation. |
> > | Special Requests: Some Plugins need certain Perl modules to be preinstalled on the host system. Plugins may also use other resources, like graphics, other modules, applications, templates. In these cases, detailed instructions are in the Plugin documentation. |
| |
|
< < | TWikiPlugin documentation pages are located at TWiki.org, in TWiki:Plugins web. Each Plugin has an doc topic (ex: SomePlugin ) and a separate development page. |
> > | Each Plugin has a standard release page, located in the TWiki:Plugins web at TWiki.org. In addition to the documentation topic (SomePlugin ), there's a separate development page. |
|
- Doc page: Read all available info about the Plugin; download the attached distribution files.
|
|
< < |
- Dev page: Post feature requests, bug reports and general dev comments; topic title ends in
Dev (ex: SomePluginDev ).
|
> > |
- Dev page: Post feature requests, bug reports and general dev comments; topic title ends in
Dev (SomePluginDev ).
|
|
- User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.
|
|
< < | Preinstalled Plugins |
> > | On-Site Pretesting |
| |
|
< < | TWiki comes with three Plugins as part of the standard installation. |
> > | To test new Plugins on your installation before making them public, you may want to use one of these two approaches: |
| |
|
< < |
- DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
|
> > |
- Method 1: Create Production and a Test installation of TWiki.
- Duplicate the
twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg , the twiki/data ; the twiki/templates and twiki/pub directories are shared.
- Test Plugins and other new features in the Test installation until you're satisfied.
- Copy the modified files to the Production installation. You can update a live TWiki installation and users won't even notice.
|
| |
|
< < |
- EmptyPlug is a fully functional Plugin module, minus any active code; it does nothing but serve as a template on demand.
|
> > |
- Method 2: List the Plugin under
Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
|
| |
|
< < |
- InterwikiPlugin is included but can be disabled or removed. Use it for quick linking to frequently linked to remote sites. Ex:
TWiki:Plugins expands to TWiki:Plugins - on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related sites.
|
|
Managing Plugins |
| - SpreadSheetPlugin (any TWiki, $Rev: 18078 (02 Sep 2009) $): Add spreadsheet calculation like
"$SUM( $ABOVE() )" to TWiki tables and other topic text - BreadCrumbsPlugin (v2.01, $Rev: 17469 (12 Dec 2008) $): A flexible way to display breadcrumbs navigation
- CommentPlugin (03 Aug 2008, $Rev: 17791 (02 Sep 2009) $): Allows users to quickly post comments to a page without an edit/preview/save cycle
- EditTablePlugin (4.9.1, $Rev: 18014 (02 Sep 2009) $): Edit TWiki tables using edit fields, date pickers and drop down boxes
- FilterPlugin (1.51, $Rev: 16970 (03 Jul 2008) $): Substitute and extract information from content by using regular expressions
- FlexWebListPlugin (v1.23, $Rev: 16971 (12 Dec 2008) $): Flexible way to display hierarchical weblists
- GluePlugin (2.00, $Rev: 15708 (12 Dec 2008) $): Enable markup to span multiple lines
- HeadlinesPlugin (2.3, $Rev: 18123 (02 Sep 2009) $): Show headline news in TWiki pages based on RSS and ATOM news feeds from external sites
- IfDefinedPlugin (v1.02, $Rev: 16972 (11 Dec 2008) $): Render content conditionally
- InterwikiPlugin (28 Feb 2009, $Rev: 14913 (17 Sep 2007) $): Link
ExternalSite:Page text to external sites based on aliases defined in a rules topic - JQueryPlugin (0.80, $Rev: 17031 (12 Dec 2008) $): jQuery JavaScript library for TWiki
- JQueryTwistyPlugin (1.2, $Rev: 16736 (03 Jul 2008) $): Twisty section JavaScript library to open/close content dynamically
- NatSkinPlugin (3.00-pre20, $Rev: 16978 (12 Dec 2008) $): Theming engine for NatSkin
- PreferencesPlugin (TWiki-4.3, $Rev: 18016 (02 Sep 2009) $): Allows editing of preferences using fields predefined in a form
- RedDotPlugin (1.40, $Rev: 16137 (12 Dec 2008) $): Renders edit-links as little red dots
- RenderListPlugin (2.0, $Rev: 16235 (02 Sep 2009) $): Render bullet lists in a variety of formats
- SlideShowPlugin (02 Aug 2008, $Rev: 17260 (02 Sep 2009) $): Create web based presentations based on topics with headings.
- SmiliesPlugin (Dakar, $Rev: 16049 (02 Sep 2009) $): Render smilies as icons, like for
:-) or for :eek: - TWikiNetSkinPlugin: (disabled)
- TablePlugin (1.036, $Rev: 17769 (02 Sep 2009) $): Control attributes of tables and sorting of table columns
- TinyMCEPlugin (03 Aug 2008, $Rev: 18146 (02 Sep 2009) $): Integration of TinyMCE with WysiwygPlugin
- TwistyPlugin (1.4.12, $Rev: 15653 (19 Nov 2007) $): Twisty section JavaScript library to open/close content dynamically
- WysiwygPlugin (18 Apr 2009, $Rev: 18020 (18 Apr 2009) $): Translator framework for Wysiwyg editors
|
|
< < | TIP! To test new Plugins on your installation before making them public, you may want to use one of these two approaches: |
> > |
The TWiki Plugin API |
| |
|
< < |
- Method 1: Create a Production and a Test installation of TWiki. The
twiki/data , twiki/templates and twiki/pub directories are shared, and the twiki/bin and twiki/lib directories are separate. Do all tests of Plugins and other new features in the Test installation. When everything works, copy the modified files over to the Production installation. This way, you can update a live TWiki installation and users won't even notice.
|
> > | The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001. |
| |
|
< < |
- Method 2: List the Plugin under test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the test web and do the testing there.
|
> > | Available Core Functions |
| |
|
< < |
Creating Plugins |
> > | The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module. |
| |
|
< < | With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki. |
> > | DevALERT: If you use functions not in Func.pm , you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki. |
| |
|
< < | Anatomy of a Plugin |
> > |
- For best performance, enable only the functions you really need. NOTE:
outsidePREHandler and insidePREHandler are particularly expensive.
|
| |
|
< < | A basic TWiki Plugin consists of two elements: |
> > | Predefined Hooks |
| |
|
< < |
- a Perl module, ex:
YourPlugin.pm
- a documentation topic, ex:
YourPlugin.txt
|
> > | In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module. |
| |
|
< < | The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call. |
> > |
- All but the initPlugin are disabled. To enable a call back, remove
DISABLE_ from the function name.
|
| |
|
< < | The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins. |
> > | Plugin Version Detection |
| |
|
< < |
TWiki Plugin API |
> > | To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking. |
| |
|
< < | The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001. |
> > |
- All modules require a
$VERSION='0.000' variable, beginning at 1.000 .
|
| |
|
< < | The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module. |
> > |
- The
initPlugin handler checks all dependencies and returns TRUE if the initialization is OK or FALSE if something went wrong.
- The Plugin initialization code does not register a Plugin that returns FALSE (or that has no
initPlugin handler).
|
| |
|
< < | DevALERT: If you use functions not in Func.pm , you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki. |
> > | |
| |
|
< < | In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module. |
| |
|
< < |
- All but the initPlugin are disabled. To enable a call back, remove
DISABLE_ from the function name.
|
> > |
Creating Plugins |
| |
|
< < |
- For improve performance, enable only the functions you really need. NOTE:
outsidePREHandler and insidePREHandler are particularly expensive.
|
> > | With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki. |
|
The DefaultPlugin Alternative
- DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in TWikiPreferences. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.
|
|
> > | Anatomy of a Plugin
A basic TWiki Plugin consists of two elements:
- a Perl module, ex:
YourPlugin.pm
- a documentation topic, ex:
YourPlugin.txt
The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.
The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins. |
| Creating the Perl Module
Copy file (EmptyPlugin.pm to <name>Plugin.pm EmptyPlugin.pm contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information. |
|
- Attach the distribution zip file to the topic, ex:
YourPlugin.zip .
- Link from the doc page to a new, blank page named after the Plugin, and ending in
Dev , ex: YourPluginDev . This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
|
|
< < | -- MikeMannix - 26 Aug 2001 |
> > | -- AndreaSterbini - 29 May 2001
-- MikeMannix - 01 Sep 2001 |