Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
TWiki Plugins | ||||||||
Changed: | ||||||||
< < | Add functionality to TWiki with readily available Plugins; create Plugins based on APIs | |||||||
> > | Add functionality to TWiki with readily available plugins; create plugins based on APIs | |||||||
On this page:
Overview | ||||||||
Changed: | ||||||||
< < | You can add Plugins to extend TWiki functionality, without altering the core code. A plug-in approach lets you: | |||||||
> > | You can add plugins to extend TWiki functionality, without altering the core code. A plug-in approach lets you: | |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Changed: | ||||||||
< < | Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki:Plugins![]() | |||||||
> > | Everything to do with TWiki plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki:Plugins![]() | |||||||
Changed: | ||||||||
< < | TWiki Plugins are developed and contributed by interested members of the community. Plugins are provided on an 'as is' basis; they are not a part of TWiki, but are independently developed and maintained. | |||||||
> > | TWiki plugins are developed and contributed by interested members of the community. Plugins are provided on an 'as is' basis; they are not a part of TWiki, but are independently developed and maintained. | |||||||
Relevant links on TWiki.org:
| ||||||||
Line: 30 to 30 | ||||||||
Installing Plugins | ||||||||
Changed: | ||||||||
< < | Each TWiki Plugin comes with its own documentation: step-by-step installation instructions, a detailed description of any special requirements, version details, and a working example for testing. Many Plugins have an install script that automates these steps for you. | |||||||
> > | Each TWiki plugin comes with its own documentation: step-by-step installation instructions, a detailed description of any special requirements, version details, and a working example for testing. Many plugins have an install script that automates these steps for you. | |||||||
Changed: | ||||||||
< < | Special Requirements: Some Plugins need certain Perl modules to be preinstalled on the host system. Plugins may also use other resources, like graphics, other modules, applications, and templates. You should be able to find detailed instructions in the Plugin's documentation. | |||||||
> > | Special Requirements: Some plugins need certain Perl modules to be preinstalled on the host system. Plugins may also use other resources, like graphics, other modules, applications, and templates. You should be able to find detailed instructions in the plugin's documentation. | |||||||
Changed: | ||||||||
< < | Each Plugin has a standard release topic, located in the TWiki:Plugins![]() | |||||||
> > | Each plugin has a standard release topic, located in the TWiki:Plugins![]() | |||||||
On-Site Pretesting | ||||||||
Changed: | ||||||||
< < | The recommended approach to testing new Plugins before making them public is to create a second local TWiki installation, and test the Plugin there. You can allow selected users access to the test area. Once you are satisfied that it won't compromise your main installation, you can install it there as well. | |||||||
> > | The recommended approach to testing new plugins before making them public is to create a second local TWiki installation, and test the plugin there. You can allow selected users access to the test area. Once you are satisfied that it won't compromise your main installation, you can install it there as well. | |||||||
Changed: | ||||||||
< < | InstalledPlugins shows which Plugins are: 1) installed, 2) loading properly, and 3) what TWiki:Codev.PluginHandlers![]() %FAILEDPLUGINS% variable can be used to debug failures. You may also want to check your webserver error log and the various TWiki log files. | |||||||
> > | InstalledPlugins shows which plugins are: 1) installed, 2) loading properly, and 3) what TWiki:Codev.PluginHandlers![]() %FAILEDPLUGINS% variable can be used to debug failures. You may also want to check your webserver error log and the various TWiki log files. | |||||||
Some Notes on Plugin Performance | ||||||||
Changed: | ||||||||
< < | The performance of the system depends to some extent on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). You can only really tell the performance impact by installing the Plugin and by measuring the performance with and without the new Plugin. Use the TWiki:Plugins.PluginBenchmarkAddOn![]() ab utility. Example on Unix:time wget -qO /dev/null /bin/view/TWiki/AbcPlugin | |||||||
> > | The performance of the system depends to some extent on the number of plugins installed and on the plugin implementation. Some plugins impose no measurable performance decrease, some do. For example, a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). You can only really tell the performance impact by installing the plugin and by measuring the performance with and without the new plugin. Use the TWiki:Plugins.PluginBenchmarkAddOn![]() ab utility. Example on Unix:time wget -qO /dev/null /bin/view/TWiki/AbcPlugin | |||||||
Changed: | ||||||||
< < | ![]() | |||||||
> > | ![]() | |||||||
Define DISABLEDPLUGINS to be a comma-separated list of names of plugins to disable. Define it in Main.TWikiPreferences to disable those plugins everywhere, in the WebPreferences topic to disable them in an individual web, or in a topic to disable them in that topic. For example,
| ||||||||
Line: 57 to 57 | ||||||||
Managing Installed Plugins | ||||||||
Changed: | ||||||||
< < | Some Plugins require additional settings or offer extra options that you have to select. Also, you may want to make a Plugin available only in certain webs, or temporarily disable it. And may want to list all available Plugins in certain topics. You can handle all of these management tasks with simple procedures: | |||||||
> > | Some plugins require additional settings or offer extra options that you have to select. Also, you may want to make a plugin available only in certain webs, or temporarily disable it. And may want to list all available plugins in certain topics. You can handle all of these management tasks with simple procedures: | |||||||
Enabling Plugins | ||||||||
Changed: | ||||||||
< < | Plugins can be enabled and disabled with the configure script. An installed Plugin needs to be enabled before it can be used. | |||||||
> > | Plugins can be enabled and disabled with the configure script. An installed plugin needs to be enabled before it can be used. | |||||||
Plugin Evaluation Order | ||||||||
Changed: | ||||||||
< < | By default, TWiki executes Plugins in alphabetical order on Plugin name. It is possible to change the order, for example to evaluate database variables before the spreadsheet CALCs. This can be done with {PluginsOrder} in the Plugins section of configure. | |||||||
> > | By default, TWiki executes plugins in alphabetical order on plugin name. It is possible to change the order, for example to evaluate database variables before the spreadsheet CALCs. This can be done with {PluginsOrder} in the plugins section of configure. | |||||||
Plugin-Specific Settings | ||||||||
Changed: | ||||||||
< < | Plugins are usually configured by variables accessible though the configure interface, but in some cases (usually older plugins) TWiki preferences are used. If a TWiki variable is defined in a Plugin topic e.g:
%<pluginname>_<var>% . For example, %RUBBERPLUGIN_SETTING% shows the value of SETTING in the RubberPlugin topic. | |||||||
> > | Some plugins are configured with plugin preferences variables, newer plugins with configure variables.
Configure variables are accessible though the configure interface.
Plugin preferences variables are defined in the plugin topic and can be overloaded. The SHORTDESCRIPTION preferences variable is always present, it is needed for the TWiki:Plugins![]()
%<pluginname>_<var>% , such as %TABLEPLUGIN_SHORTDESCRIPTION% . They can also be redefined with the %<pluginname>_<var>% setting at a lower level in the Main.TWikiPreferences or at the web level. For an easier upgrade it is recommended to customize plugin preferences variables in Main.TWikiPreferences only. | |||||||
Listing Active Plugins | ||||||||
Changed: | ||||||||
< < | Plugin status variables let you list all active Plugins wherever needed. | |||||||
> > | Plugin status variables let you list all active plugins wherever needed. | |||||||
Changed: | ||||||||
< < | This site is running TWiki version TWiki-6.0.2, Sun, 29 Nov 2015, build 29687, Plugin API version | |||||||
> > | This site is running TWiki version TWiki-6.0.2, Sun, 29 Nov 2015, build 29687, plugin API version | |||||||
6.02
| ||||||||
Changed: | ||||||||
< < | On this TWiki site, the enabled Plugins are: SpreadSheetPlugin, BackupRestorePlugin, ColorPickerPlugin, CommentPlugin, DatePickerPlugin, EditTablePlugin, HeadlinesPlugin, HttpsRedirectPlugin, InterwikiPlugin, JQueryPlugin, LaTeXToMathMLPlugin, LatexModePlugin, PreferencesPlugin, SetGetPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin, TagMePlugin, TinyMCEPlugin, TwistyPlugin, WatchlistPlugin, WysiwygPlugin. | |||||||
> > | On this TWiki site, the enabled plugins are: SpreadSheetPlugin, BackupRestorePlugin, ColorPickerPlugin, CommentPlugin, DatePickerPlugin, EditTablePlugin, HeadlinesPlugin, HttpsRedirectPlugin, InterwikiPlugin, JQueryPlugin, LaTeXToMathMLPlugin, LatexModePlugin, PreferencesPlugin, SetGetPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin, TagMePlugin, TinyMCEPlugin, TwistyPlugin, WatchlistPlugin, WysiwygPlugin. | |||||||
| ||||||||
Line: 94 to 100 | ||||||||
The TWiki Plugin API | ||||||||
Changed: | ||||||||
< < | The Application Programming Interface (API) for TWiki Plugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. | |||||||
> > | The Application Programming Interface (API) for TWiki plugins provides the specifications for hooking into the core TWiki code from your external Perl plugin module. | |||||||
Available Core Functions | ||||||||
Changed: | ||||||||
< < | The TWikiFuncDotPm module (lib/TWiki/Func.pm ) describes all the interfaces available to Plugins. Plugins should only use the interfaces described in this module. | |||||||
> > | The TWikiFuncDotPm module (lib/TWiki/Func.pm ) describes all the interfaces available to plugins. Plugins should only use the interfaces described in this module. | |||||||
Changed: | ||||||||
< < | ![]() 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. | |||||||
> > | ![]() 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. | |||||||
Predefined Hooks | ||||||||
Changed: | ||||||||
< < | In addition to TWiki core functions, Plugins can use predefined hooks, or callbacks, as described in the lib/TWiki/Plugins/EmptyPlugin.pm module. | |||||||
> > | In addition to TWiki core functions, plugins can use predefined hooks, or callbacks, as described in the lib/TWiki/Plugins/EmptyPlugin.pm module. | |||||||
| ||||||||
Line: 113 to 119 | ||||||||
Hints on Writing Fast Plugins | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Line: 124 to 130 | ||||||||
Version Detection | ||||||||
Changed: | ||||||||
< < | To eliminate the incompatibility problems that are bound to arise from active open Plugin development, a Plugin versioning system is provided for automatic compatibility checking. | |||||||
> > | To eliminate the incompatibility problems that are bound to arise from active open plugin development, a plugin versioning system is provided for automatic compatibility checking. | |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Security | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Creating Plugins | ||||||||
Changed: | ||||||||
< < | 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. | |||||||
> > | 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 provides the programming interface for TWiki. | |||||||
Anatomy of a Plugin | ||||||||
Changed: | ||||||||
< < | A (very) basic TWiki Plugin consists of two files: | |||||||
> > | A (very) basic TWiki plugin consists of two files: | |||||||
| ||||||||
Changed: | ||||||||
< < | The Perl module can be a block of code that talks to 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 Perl module can be a block of code that talks to 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. | |||||||
In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the MyFirstPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/MyFirstPlugin/ directory. | ||||||||
Changed: | ||||||||
< < | 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. | |||||||
> > | 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. | |||||||
Changed: | ||||||||
< < | The TWiki::Plugins.BuildContrib module provides a lot of support for plugins development, including a plugin creator, automatic publishing support, and automatic installation script writer. If you plan on writing more than one plugin, you probably need it. | |||||||
> > | The TWiki:Plugins.BuildContrib![]() | |||||||
Creating the Perl ModuleCopy filelib/TWiki/Plugins/EmptyPlugin.pm to <name>Plugin.pm . The EmptyPlugin.pm module contains mostly empty functions, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information. | ||||||||
Changed: | ||||||||
< < | If your Plugin uses its own modules and objects, you must include the name of the Plugin in the package name. For example, write Package MyFirstPlugin::Attrs; instead of just Package Attrs; . Then call it using: | |||||||
> > | If your plugin uses its own modules and objects, you must include the name of the plugin in the package name. For example, write Package MyFirstPlugin::Attrs; instead of just Package Attrs; . Then call it using: | |||||||
use TWiki::Plugins::MyFirstPlugin::Attrs; $var = MyFirstPlugin::Attrs->new(); | ||||||||
Line: 175 to 182 | ||||||||
Writing the Documentation Topic | ||||||||
Changed: | ||||||||
< < | The Plugin documentation topic contains usage instructions and version details. It serves the Plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic: | |||||||
> > | The plugin documentation topic contains usage instructions and version details. It serves the plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic: | |||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
OUTLINE: Doc Topic Contents | ||||||||
Changed: | ||||||||
< < | Check the Plugins web on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered: | |||||||
> > | Check the plugins web on TWiki.org for the latest plugin doc topic template. Here's a quick overview of what's covered: | |||||||
Syntax Rules: <Describe any special text formatting that will be rendered.>" | ||||||||
Changed: | ||||||||
< < | Example: <Include an example of the Plugin in action. Possibly include a static HTML version of the example to compare if the installation was a success!>" | |||||||
> > | Example: <Include an example of the plugin in action. Possibly include a static HTML version of the example to compare if the installation was a success!>" | |||||||
Changed: | ||||||||
< < | Plugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>" | |||||||
> > | Plugin Settings: <Description and settings for custom plugin %VARIABLES%, and those required by TWiki.>" | |||||||
| ||||||||
Line: 211 to 218 | ||||||||
Packaging for Distribution | ||||||||
Changed: | ||||||||
< < | The TWiki:Plugins.BuildContrib![]() | |||||||
> > | The TWiki:Plugins.BuildContrib![]() | |||||||
Changed: | ||||||||
< < | If you don't want (or can't) use the BuildContrib, then a minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin , ex: MyFirstPlugin.pm , and a documentation page with the same name(MyFirstPlugin.txt ). | |||||||
> > | If you don't want (or can't) use the BuildContrib, then a minimum plugin release consists of a Perl module with a WikiName that ends in Plugin , ex: MyFirstPlugin.pm , and a documentation page with the same name(MyFirstPlugin.txt ). | |||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Line: 227 to 234 | ||||||||
Measuring and Improving the Plugin Performance | ||||||||
Changed: | ||||||||
< < | A high quality Plugin performs well. You can use the TWiki:Plugins.PluginBenchmarkAddOn![]() ![]() | |||||||
> > | A high quality plugin performs well. You can use the TWiki:Plugins.PluginBenchmarkAddOn![]() ![]() | |||||||
See also Hints on Writing Fast Plugins.
Publishing for Public Use | ||||||||
Changed: | ||||||||
< < | You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins![]() ![]() | |||||||
> > | You can release your tested, packaged plugin to the TWiki community through the TWiki:Plugins![]() ![]() | |||||||
Changed: | ||||||||
< < | Publish your Plugin by following these steps:
| |||||||
> > | Publish your plugin by following these steps:
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Changed: | ||||||||
< < | ![]() | |||||||
> > | ![]() | |||||||
Changed: | ||||||||
< < | Thank you very much for sharing your Plugin with the TWiki community ![]() | |||||||
> > | Thank you very much for sharing your plugin with the TWiki community ![]() | |||||||
Recommended Storage of Plugin Specific Data | ||||||||
Changed: | ||||||||
< < | Plugins sometimes need to store data. This can be Plugin internal data such as cache data, or data generated for browser consumption such as images. Plugins should store data using TWikiFuncDotPm functions that support saving and loading of topics and attachments. | |||||||
> > | Plugins sometimes need to store data. This can be plugin internal data such as cache data, or data generated for browser consumption such as images. Plugins should store data using TWikiFuncDotPm functions that support saving and loading of topics and attachments. | |||||||
Plugin Internal Data | ||||||||
Changed: | ||||||||
< < | You can create a Plugin "work area" using the TWiki::Func::getWorkArea() function, which gives you a persistent directory where you can store data files. By default they will not be web accessible. The directory is guaranteed to exist, and to be writable by the webserver user. For convenience, TWiki::Func::storeFile() and TWiki::Func::readFile() are provided to persistently store and retrieve simple data in this area. | |||||||
> > | You can create a plugin "work area" using the TWiki::Func::getWorkArea() function, which gives you a persistent directory where you can store data files. By default they will not be web accessible. The directory is guaranteed to exist, and to be writable by the webserver user. For convenience, TWiki::Func::storeFile() and TWiki::Func::readFile() are provided to persistently store and retrieve simple data in this area. | |||||||
Web Accessible Data | ||||||||
Line: 263 to 270 | ||||||||
Recommendation for file name:
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Changed: | ||||||||
< < | Web specific data can be stored in the Plugin's attachment area, which is web accessible. Use the TWiki::Func::saveAttachment() function to store the data. | |||||||
> > | Web specific data can be stored in the plugin's attachment area, which is web accessible. Use the TWiki::Func::saveAttachment() function to store the data. | |||||||
Changed: | ||||||||
< < | Recommendation for file names in Plugin attachment area: | |||||||
> > | Recommendation for file names in plugin attachment area: | |||||||
| ||||||||
Line: 337 to 344 | ||||||||
Config.spec files are also used for other (non-plugin) extensions. in this case they are stored under the Contrib directory instead of the Plugins directory. | ||||||||
Added: | ||||||||
> > | TWiki:TWiki/SpecifyingConfigurationItemsForExtensions![]() | |||||||
Maintaining PluginsDiscussions and Feedback on Plugins | ||||||||
Changed: | ||||||||
< < | Each published Plugin has a Plugin development topic on TWiki.org. Plugin development topics are named after your Plugin and end in Dev , such as MyFirstPluginDev . The Plugin development topic is a great resource to discuss feature enhancements and to get feedback from the TWiki community. | |||||||
> > | Each published plugin has a plugin development topic on TWiki.org. Plugin development topics are named after your plugin and end in Dev , such as MyFirstPluginDev . The plugin development topic is a great resource to discuss feature enhancements and to get feedback from the TWiki community. | |||||||
Maintaining Compatibility with Earlier TWiki Versions | ||||||||
Changed: | ||||||||
< < | The Plugin interface (TWikiFuncDotPm functions and handlers) evolve over time. TWiki 4.0 introduced new API functions to address the needs of Plugin authors. It also deprecated some functions. Some Plugins written for earlier TWiki releases using unofficial TWiki internal functions no longer work on the TWiki 4.0 codebase. All this means that some Plugins need to be updated to work on the TWiki 4.0 codebase. | |||||||
> > | The plugin interface (TWikiFuncDotPm functions and plugin handlers) evolve over time. TWiki introduces new API functions to address the needs of plugin authors. Plugins using unofficial TWiki internal functions may no longer work on a TWiki upgrade. | |||||||
Changed: | ||||||||
< < | Organizations typically do not upgrade to the latest TWiki for many months. However, many administrators still would like to install the latest versions of a Plugin on their older TWiki installation. This need is fulfilled if Plugins are maintained in a compatible manner. | |||||||
> > | Organizations typically do not upgrade to the latest TWiki for many months. However, many administrators still would like to install the latest versions of a plugin on their older TWiki installation. This need is fulfilled if plugins are maintained in a compatible manner. | |||||||
Changed: | ||||||||
< < | ![]() ![]() | |||||||
> > | ![]() ![]() if( $TWiki::Plugins::VERSION >= 1.1 ) { @webs = TWiki::Func::getListOfWebs( 'user,public' ); } else { @webs = TWiki::Func::getPublicWebList( ); } | |||||||
Handling deprecated functions | ||||||||
Line: 372 to 390 | ||||||||
Related Topics: DeveloperDocumentationCategory, AdminDocumentationCategory, TWiki:TWiki.TWikiPluginsSupplement![]() | ||||||||
Added: | ||||||||
> > | -- Contributors: TWiki:Main.PeterThoeny![]() ![]() ![]() ![]() ![]() ![]() |