ewiki

writing your own plugin

Using the list of current plugin tasks, you could (hopefully) write your own
extension with ease. It is probably most simple to write a dynamic ["page"]
plugin, so we start with this as example. All you need is a function
definition like:

   function my_page_plugin($id, $data, $action) {
      return("This is the returned page <b>content</b>.");
   }

And then just register it as ["page"] plugin, using your defined function
name (yes, this does NOT need to start with the usual "ewiki_" prefix!). You
also need to tell ewiki about the WikiPageName+ under which your plugin
should be made available:

   $ewiki_plugins["page"]["MyPagePlugin"] = "my_page_plugin";

That's it. But of course your function should do something more useful, than
just returning a hardcoded html string - even if this all, what's necessary
here. The parameters to your ["page"] plugin function you'll often just want
to ignore, and implement your plugin functionality (hard disk formation e.g.)
independently from such things.

It is likewise easy to write an ["action"] plugin; but this type of plugin
should then process some parts of the $data entry and work for nearly any
page (extracting contents or presenting the current page differently). So
this kind of plugin could be used to initialize a download for the current
page or to allow to email it to someone else (beware of the spammers!).
prev << "authentication/permission plugins"
next >> "format_* / rendering plugins"


You cannot modify the INTERNALS file, but anyhow any ideas or suggestion should as usually get filed on BugReports, UserSuggestions or even better the INTERNALS.Discussion.