ewiki

plugin tasks

Here's a short summary of current PlugInterface "tasks" and (recommended)
function interface definitions (the "= function (..." lines). A plugin hook
with [] means there can be multiple, and each one would be tried.

basic
-----

  ["page"]$PageName+   - called for requests to page "$PageName+"
                          (like "SearchPage+", "NewestPages")
                        = function ( $id, $data, $action )

  ["action"]$ACTION+   - called for requests with url "?id=$ACTION/pagename"
                          (core actions are "edit", "links", "info", "view")
                        = function ( $id, &$data, $action )

  ["handler"][]         - called from ewiki_page() on start-up, if it returns
                          a string the page was handled and no further
                          processing takes place, the plugins output is used
                        = function ( $id, &$data, $action )

rendering
---------

  ["render"]0+         - alias for ewiki_format() - our "WikiKernel+"

  ["format_source"][]   - called inside the format function for the wiki
                          source, implement this or the following ones to
                          use complex wiki markup
                        = function ( &$wiki_source )

  ["format_line"][]     - generic call from inside wiki format engine
                          for every line, you may need to use static
                          vars inside your plugin function
                        = function ( &$o, &$line, &$post )

  ["format_tbl"]0+     - called to handle "wiki|table|markup"
                          (the first and last | are already stripped)
                        = function ( &$o, &$line, &$post, $tbl_open=0 )

  ["format_final"][]    - call after wiki source was transformed into html
                          (WikiPageLinks+ were already interpolated too)
                        = function ( &$html )

  ["format_block"][]    - called, with the page fragment extracted using
                          the string patterns of the according
                          $ewiki_config["format_block"] entry
                        = function (&$currbuf, &$in, &$iii, &$s, $btype);

  ["format_para"][]     - called, if the $para (text enclosed in <p></p>)
                          is to be written into the output stream $ooo$in+0+
                        = function (&$para, &$ooo, &$s);

  ["link_url"][]        - called to transform wiki source references
                        = function ( $href, $title )

  ["link_final"][]      - called from ewiki_link_regex_callback to transform
                          the final <a href>
                        = function ( &$str,, $type, $href, $title )

special tasks
-------------

  ["database"]0+       - only 0+ will be called in favour of the ewiki.php
                          internal ewiki_database_mysql()
                        = function ( $action, $args=array() )

  ["image_resize"][]    - all [] registered functions will be invoked
                        = function ( &$content, &$mime, $return=0 )

  ["mime_magic"]0+        - hooks before save_binary/image to fetch the
                          correct mime type for non-image files; nowadays
                          just an always-available get_content_type()
                        = function ( &$content )

  ["binary_get"]0+     - the binary_repository handles large/binary content
                          (to separate it out of the standard sql-database),
                          usually just sending it to stdout
                        = function ( $id, $meta )

page lists
----------

  ["list_pages"]0+     - <li>st generating callback function
                        = function ( $lines )

  ["list_dict"]0+        - special variant of the above one (called just for /
                          from within PageIndex and WordIndex+ listings)
                        = ???

  ["list_transform"][]  - works on the given list of links (text transformations)
                        = function ( &$lines )

  ["make_title"]0+     - allows to chain a replacement function for
                          ewiki_make_title()
                        = function ($title, $class, $action, $go_action, $may_split)

  ["title_transform"]   - changing the currently linked title (called from
                          within _make_title)
                        = function ($id, &$title, &$go_action)

page transform / additions
--------------------------

  ["view_append"][]        - output will be printed below a rendered page
                        = function ( $id, $data, $action )

  ["view_final"][]        - can rework the full html of the rendered page
                        = function ( &$html, $id, $data, $action )

  ["view_append"][]     - add <html> code at the end of the currently
                          viewed page
                        = function ($id, $data, $action)

  ["view_final"][]      - filter hook for final processing of "view/"ed pages
                        = function ($o, $id, $data, $action)

  ["page_final"][]      - filter hook for final processing of any
                          shown page (any action: edit/, view/, info/, ...)
                        = function ($o, $id, $data, $action)

edit/ hooks
-----------

  ["edit_preview"][]    - called if edit pages preview+ button pressed
                        = function ( $data )

  ["edit_form_final"][] - add <html>/<form>s to the edit/ page
                        = function (&$o, $id, &$data, $action)

  ["edit_form_append"][] - insert other <input> fields between <textarea>
                          and <submit> button on the edit/ page
                        = function ($id, &$data, $action)

  ["edit_hook"][]        - chains into before the edit box is printed
                          (to allow security checks, pre-edit-tweaking, ...)
                          any output terminates the current edit/ attemp
                        = function (&$id, &$data, &$hidden_postdata)

  ["edit_save"][]       - immediately called before saving the currently
                          "edit/"ed page into the database, allows last
                          transformations or rejection (unsetting $data)
                        = function (&$data, &$old_data)

  ["edit_patch"]0+     - special hook for the patchsaving plugin
                        = function ($id, &$data)

bloat extensions 
----------------

  ["auth_*"][]                - plugin tasks used with ewiki_auth()
                        = see the plugins/auth/README.auth

  ["mpi"]...+          - markup plugins, see next paragraph

  ["init"][]                - run once, when the main script is included()

  ["page_init"]...+    - init functions, called when ewiki_page()
                          is called the very first time

aliases and variants
--------------------

  ["action_always"]$ACTION+   - are called with precedence over ["page"]
                                 plugins (for example "links" which also
                                 works for registered page plugins)

  ["action_binary"]$ACTION+   - action/admin plugins which do not care, if
                                 the current page actually is binary data


Some other entries have been re-extracted into $ewiki_config, because they
were falsely in $ewiki_plugins. See the paragraph at the start of the README
on the $ewiki_config array.

This list will probably not stay up-to-date, so please grep the ewiki.php
script for all occurrences of 'ewiki_plugins["', and you can of course
invent some new and tell the author how it helped you to implement something
very different.
prev << "plugin tasks"
next >> "mpi 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.