%FAILEDPLUGINS% variable can be used to debug failures. You may also want to check your webserver error log and the various TWiki log files.
ab utility. Example on Unix:time wget -qO /dev/null /cgi-bin/view/TWiki04x02/AbcPlugin
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,
* Set DISABLEDPLUGINS = SpreadSheetPlugin, EditTablePlugin
{PluginsOrder} in the plugins section of configure.
Set SHORTDESCRIPTION = Control attributes of tables and sorting of table columns
%<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.
%ACTIVATEDPLUGINS% %PLUGINDESCRIPTIONS% "$SUM( $ABOVE() )" to TWiki tables and other topic text %GAUGE{}% variables. ExternalSite:Page text to external sites based on aliases defined in a rules topic
for :-) or
for :eek: %FAILEDPLUGINS% | Plugin | Errors |
|---|---|
| SpreadSheetPlugin | none |
| CommentPlugin | none |
| BlackListPlugin | none |
| ChartPlugin | none |
| EditTablePlugin | none |
| GaugePlugin | none |
| InterwikiPlugin | none |
| LocalCityTimePlugin | none |
| PerlDocPlugin | none |
| PreferencesPlugin | none |
| RenderListPlugin | none |
| SlideShowPlugin | none |
| SmiliesPlugin | none |
| TWikiDrawPlugin | none |
| TWikiOrgPlugin | none |
| TablePlugin | none |
| TagMePlugin | none |
| TinyMCEPlugin | none |
| TwistyPlugin | none |
| VarCachePlugin | none |
| WysiwygPlugin | none |
| Handler | Plugins |
|---|---|
| afterCommonTagsHandler | VarCachePlugin |
| afterEditHandler | WysiwygPlugin |
| afterSaveHandler | TagMePlugin |
| beforeAttachmentSaveHandler | BlackListPlugin |
| beforeCommonTagsHandler | EditTablePlugin PreferencesPlugin VarCachePlugin WysiwygPlugin |
| beforeEditHandler | TinyMCEPlugin WysiwygPlugin |
| beforeMergeHandler | WysiwygPlugin |
| beforeSaveHandler | CommentPlugin BlackListPlugin WysiwygPlugin |
| commonTagsHandler | SpreadSheetPlugin CommentPlugin BlackListPlugin ChartPlugin EditTablePlugin GaugePlugin LocalCityTimePlugin PerlDocPlugin SlideShowPlugin SmiliesPlugin TWikiDrawPlugin TWikiOrgPlugin TagMePlugin |
| initPlugin | SpreadSheetPlugin CommentPlugin BlackListPlugin ChartPlugin EditTablePlugin GaugePlugin InterwikiPlugin LocalCityTimePlugin PerlDocPlugin PreferencesPlugin RenderListPlugin SlideShowPlugin SmiliesPlugin TWikiDrawPlugin TWikiOrgPlugin TablePlugin TagMePlugin TinyMCEPlugin TwistyPlugin VarCachePlugin WysiwygPlugin |
| modifyHeaderHandler | WysiwygPlugin |
| postRenderingHandler | BlackListPlugin EditTablePlugin PreferencesPlugin WysiwygPlugin |
| preRenderingHandler | InterwikiPlugin SmiliesPlugin TablePlugin |
| startRenderingHandler | RenderListPlugin WysiwygPlugin This handler is deprecated - please check for updated versions of the plugins that use it! |
lib/TWiki/Func.pm) describes all the interfaces available to plugins. Plugins should only use the interfaces described in this module.
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.
lib/TWiki/Plugins/EmptyPlugin.pm module.
DISABLE_ from the function name.
eval block like this:eval { require IPC::Run } return "<font color=\"red\">SamplePlugin: Can't load required modules ($@)</font>" if $@;
lib/TWiki/Plugins/BathPlugin/.
$NO_PREFS_IN_TOPIC if you possibly can, as that will stop TWiki from reading the plugin topic for every page. Use Config.spec instead.
$VERSION variable. This should be an integer, or a subversion version id.
initPlugin handler should check all dependencies and return 1 if the initialization is OK or 0 if something went wrong. initPlugin handler).
$TWiki::Plugins::VERSION in the TWiki::Plugins module contains the TWiki plugin API version, currently 1.2. %PLUGINVERSION{}% variable to query the plugin API version or the version of installed plugins.
%TWiki::cfg hash than adding it as preferences in the plugin topic. configure describes the steps
MyFirstPlugin.pm
MyFirstPlugin.txt
MyFirstPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/MyFirstPlugin/ directory.
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 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.
lib/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.
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();
MyFirstPlugin, press enter and create the new topic
OUTLINE: Doc Topic Contents
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.>" 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!>" Plugin Settings: <Description and settings for custom plugin %VARIABLES%, and those required by TWiki.>"Plugin Installation Instructions: <Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.>" Plugin Info: <Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.>"
- Plugins Preferences <If user settings are needed, explain... Entering values works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
- Set <EXAMPLE = value added>
Plugin, ex: MyFirstPlugin.pm, and a documentation page with the same name(MyFirstPlugin.txt).
lib/TWiki/Plugins/MyFirstPlugin.pm
data/TWiki/MyFirstPlugin.txt
pub/TWiki/MyFirstPlugin/uparrow.gif [a required graphic]
MyFirstPlugin.zip) and add the entire directory structure from Step 1. The archive should look like this: lib/TWiki/Plugins/MyFirstPlugin.pm
data/TWiki/MyFirstPlugin.txt
pub/TWiki/MyFirstPlugin/uparrow.gif
MyFirstPlugin
MyFirstPlugin.zip
Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for plugins is handled in TWiki:Support.)
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.
TWiki::Func::saveAttachment() function to store the data.
Recommendation for file name: _GaugePlugin_img123.gif
TWiki::Func::saveAttachment() function to store the data.
Recommendation for file names in plugin attachment area: _Main_roundedge-ul.gif
configure configure rather than trying to use TWiki preferences variables. These extensions use Config.spec files to publish their configuration requirements.
Config.spec files are read during TWiki configuration. Once a Config.spec has defined a configuration item, it is available for edit through the standard configure interface. Config.spec files are stored in the 'plugin directory' e.g. lib/TWiki/Plugins/BathPlugin/Config.spec.
Config.spec file Config.spec file for a plugin starts with the plugin announcing what it is:
# ---+ BathPlugin # This plugin senses the level of water in your bath, and ensures the plug # is not removed while the water is still warm.This is followed by one or more configuration items. Each configuration item has a type, a description and a default. For example:
# **SELECT Plastic,Rubber,Metal**
# Select the plug type
$TWiki::cfg{BathPlugin}{PlugType} = 'Plastic';
# **NUMBER**
# Enter the chain length in cm
$TWiki::cfg{BathPlugin}{ChainLength} = '30';
# **BOOLEAN EXPERT**
# Turn this option off to disable the water temperature alarm
$TWiki::cfg{BathPlugin}{TempSensorEnabled} = '1';
The type (e.g. **SELECT** ) tells configure to how to prompt for the value. It also tells configure how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items $TWiki::cfg{BathPlugin}{PlugType}, $TWiki::cfg{BathPlugin}{ChainLength}, and $TWiki::cfg{BathPlugin}{TempSensorEnabled} for use in your plugin. For example,
if( $TWiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) {
die "The bathwater is too hot for comfort";
}
The config.spec file is read by configure, and configure then writes LocalSite.cfg with the values chosen by the local site admin.
A range of types are available for use in Config.spec files:
| BOOLEAN | A true/false value, represented as a checkbox |
| COMMAND length | A shell command |
| LANGUAGE | A language (selected from {LocalesDir} |
| NUMBER | A number |
| OCTAL | An octal number |
| PASSWORD length | A password (input is hidden) |
| PATH length | A file path |
| PERL | A perl structure, consisting of arrays and hashes |
| REGEX length | A perl regular expression |
| SELECT choices | Pick one of a range of choices |
| SELECTCLASS root | Select a perl package (class) |
| STRING length | A string |
| URL length | A url |
| URLPATH length | A relative URL path |
| EXPERT | means this an expert option |
| M | means the setting is mandatory (may not be empty) |
| H | means the option is not visible in configure |
lib/TWiki.spec for many more examples.
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.
TWiki:TWiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings.
Dev, such as MyFirstPluginDev. The plugin development topic is a great resource to discuss feature enhancements and to get feedback from the TWiki community.
if( $TWiki::Plugins::VERSION >= 1.010 ) {
$text = TWiki::Func::readTopicText( $theWeb, $theTopic, '', 1 );
} else {
$text = TWiki::Func::readTopic( $theWeb, $theTopic );
}
TWiki::Plugins version in which the handler was first deprecated. For example, if we need to define the endRenderingHandler for compatibility with TWiki::Plugins versions before 1.1, we would add this to the plugin:
package TWiki::Plugins::SinkPlugin;
use vars qw( %TWikiCompatibility );
$TWikiCompatibility{endRenderingHandler} = 1.1;
If the currently-running TWiki version is 1.1 or later, then the handler will not be called and the warning will not be issued. TWiki with versions of TWiki::Plugins before 1.1 will still call the handler as required.
Related Topics: DeveloperDocumentationCategory, AdminDocumentationCategory, TWiki:TWiki.TWikiPluginsSupplement
-- Contributors: TWiki:Main.PeterThoeny, TWiki:Main.AndreaSterbini, TWiki:Main.MikeMannix, TWiki:Main.CrawfordCurrie, TWiki:Main.ArthurClemens, TWiki:Main.WillNorris
If your plugin uses its own modules and objects, you must include the name of the plugin in the package name. E.G. do not do:We have this problem right now with the ActionTracker and TOC plugins. -- JohnRouillard - 27 Aug 2002 Thanks John, I added a shortened version. -- PeterThoeny - 29 Jan 2003 Shouldn't Codev.StepByStepRenderingOrder be moved to the TWiki web if it's going to be linked to from here? (I'm thinking of when this page is included in a distribution) -- SamHasler - 26 Nov 2003 Correct. It needs to be updated as well to the latest version. For now I changed it into a Interwiki link. I made some more changes to the text, mainly to improve the flow of the text. -- PeterThoeny - 12 Dec 2003 Crawford, I reverted "If you use a subdirectory, then name it the same as the plugin with a leading underscore; for example, _MyPlugin" back to "Do not use subdirectories (rename and delete would fail)". This spec change should be agreed on before in Codev and it needs to be investiated if it does not break existing functionality (like rename) -- PeterThoeny - 28 Mar 2004 Looks like this comment area hasn't been used in awhile. Here goes: Working on a new plugin, we discovered that blanks are converted into tabs, then from tabs back to blanks -- which really threw us off. The only place I found reference to this is in StepByStepRenderingOrder. QUESTIONS:package Attrs; sub new {...}Instead use:Package Myplugin::Attrs; sub new {...}Then call it using:use TWiki::Plugins::Myplugin::Attrs; $var = Myplugin::Attrs->new();rather than:use TWiki::Plugins::Myplugin::Attrs; $var = Attrs->new();If you don't do this it will cause lots of warning messages about the module functions being redefined especially in mod_perl environments, and can cause your plugin to work incorrectly if a later plugin overrides your definitions.
XyzPlugin.pm (and possibly =XyzPlugin subdirectory) in lib/TWiki/Plugins and delete the Plugin topic.
-- PeterThoeny - 27 Sep 2005
According to TWikiPreferences, DISABLEDPLUGINS and ENABLEDPLUGINS are no longer supported, and the way to test plugins is to use the debugenableplugins URL parameter. This document should probably be updated to reflect that. I'm only just trying to write my first plugin, so I don't really feel qualified to rewrite the document at this point.
-- DougClaar - 09 May 2006
I just updated the doc to the TWiki 4 version.
-- PeterThoeny - 13 May 2006
Since not all platforms have .zip support, it would be nice to at least suggest that plugin developers provide both .zip and .tgz versions of their plugins. It would be even nicer if this website provided a means to convert between the two when attaching a plugin as well, to simplify the lives of plugin developers.
-- JamesParker - 22 Sep 2006
.zip and .tgz are attached if the build script is used to upload a plugin. See BuildContrib.
-- PeterThoeny - 23 Sep 2006
Is TWiki:Codev/StepByStepRenderingOrder for T4? I am looking at upgrading a plugin from T3 and T4 and it seems like that the order is no longer accurate.
Specifically, I am seeing the handle called for the Template before the topic, which I can't populate, since I haven't been given the topic text yet.
Does anyone have any current information? Thanks.
-- EricHanson - 09 Oct 2006
The referenced topic is out of date, it applies to BeijingRelease. I suggest to open a Support question.
-- PeterThoeny - 09 Oct 2006
It would be nice if NewPluginTemplate made use of the TopicCreatePlugin to create the Dev and the Appraisal topics at the same time.
If the TopicCreatePlugin was enabled on twiki.org (or just the Plugins web), then I would be happy to do this.
-- AndrewRJones - 05 Jun 2007
Thanks for the offer. I installed and enabled this plugin on TWiki.org, please go ahead.
-- PeterThoeny - 23 Jun 2007
This document mentions several times the topic SpecifyingConfigurationItemsForExtensions for specifying configuration settings for a plugin. Apparently, this topic does not exist, yet. Is there any other place where the structure of a Config.spec file is documented?
-- LutzGehlen - 28 Jan 2008
Ah, I saw now that only the links where not working. I removed the %TWIKIWEB% from all links to SpecifyingConfigurationItemsForExtensions, now the links work. Hope this was indeed improving and not messing up the document.
-- LutzGehlen - 28 Jan 2008
I merged the changes from svn with changes on this topic.
-- PeterThoeny - 20 Apr 2008