You are here :


Friday, 3. December 2004 14:06:09, by David Jobet


How to make a plugin

You first have to decide which kind of plugin you want to create.

Admin plugin

Admin plugin are located inside admin/tools.
To create a new plugin, simply

desc.conf file

This file has the same syntax as the lang file located into i18n directories.
You must have 4 different entries :

Example :

 UTF8 conversion tool
 David Jobet
 A tool to convert your wiki to UTF8

index.php file

This is the code that will get called when the plugin is activated. Code it as if you were directly called.
You can of course include wiclear classes if they are not already included.
Take a look at utf8conversion plugin given in the main distribution.

Site wide plugin

There is none available at the moment.
As admin plugins, you should put them inside a tools directory .
To use them, simply include the file inside your template.php or prepend.php file in your theme directory.
To register, the plugin simply has to declare its callback functions inside 2 global maps :

Example : (file content.lib.php)

 $contentBoxHandle["edit"] = "editContent";
 $contentBoxHandle["add"]  = "editContent";
 $userActionHandle["edit"] = "onSubmitContent";
 $userActionHandle["add"]  = "onSubmitContent";

Which means that when wiclear will get an incoming request, it will decode the "mode" _GET variable and use the registered function defined in these two map to handle the request.