Wiclear

You are here :

English plugin_howto

Friday, 17. February 2006 22:36:43, by David Jobet

 

Contents

Warning : this page has been slighly updated but better information is available in the doxygen documentation. See page Plugin howto.

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 :

 [Name]
 UTF8 conversion tool
 [Author]
 David Jobet
 [Description]
 A tool to convert your wiki to UTF8
 [Icon]
 icon.png

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

As admin plugins, you should put them inside a tools directory .
To register, the plugin simply has to declare its callback functions using the PluginManager. There are 3 different kinds of callback available :

Example : (file tools/trackback/hooks.inc.php)

 global $pluginManager;
 $pluginManager->addContentBoxHandle("trackback_add_ping",       "addPing");
 $pluginManager->addUserActionHandle("trackback_discover",       "onTrackbackDiscover");
 $pluginManager->addUserActionHandle("trackback_do_ping",        "onTrackbackPing");
 $pluginManager->addUserActionHandle("trackback_del",            "onTrackbackDelete");
 $pluginManager->addBrowserTitlePageHandle("trackback_add_ping", "browserAddTrackback");

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.

No trackbacks yet

To make a trackback, use ping url http://wiclear.free.fr/tools/trackback/trackback.php?id=23

If your client support ping url auto discovery, you can also try it using directly this page's url

No comments yet