Translations of this page?:

Event Reference List

Explanatory Notes

Events are listed in alphabetical order by name using the following format:

Name The string used for the event name, use this string to register for the event. Refer naming structure for details on how names are constructed and what the different parts indicate.
Data A brief description of the data is attached to the events data property. For more details, especially for complex formats like objects and arrays, refer to the source code itself.
Action The default action being signalled by the event. Not all events have a default action, if they do it can be prevented using the event's ->preventDefault() method.
Preventable Whether or not the default action of the event is preventable. Events without a default action are considered to be “not preventable”.
Notes Any additional information/explanation that may be helpful to understanding the event

Naming Structure

Event names follow a standard structure:

<location>_<event_data>_<action>
  • <location> — short name or hint which identifies the part of DokuWiki which generates the event.
  • <event_data> — short name or hint which identifies the data being passed by the event
  • <action_or_state> — if the event has a default action, this will indicate what that action is, if there is no default action, this will indicate the state or other reason for firing the event.

e.g. parser_handler_done

  • the event is triggered in the parser scripts,
  • the handler object is the event data,
  • there is no action, the state of parser, in its handler step, is done, ie. the handler has completed its processing.

action_headers_send

  • the event is triggered in actions.php,
  • the event data is an array of headers,
  • the default action is to send the headers.

List of Events

ACTION_ACT_PREPROCESS

Name ACTION_ACT_PREPROCESS
Data $ACT (the do variable in the query string - uncleansed)
Action Dokuwiki's own processing of the $ACT value
Preventable yes
Signalled By act_dispatch()1) before it begins to process the $ACT variable
Notes [1] Also refer TPL_ACT_UNKNOWN event.

ACTION_HEADERS_SEND

Name ACTION_HEADERS_SEND
Data an array of header strings.
Action output all the headers in order using the header() function.
Preventable yes
Signalled by action_dispatch()2) after preparing the headers and before loading the template
Notes [1] There is one dokuwiki header 'Content-Type: text/html; charset=utf-8'
[2] Handlers of this event can add/modify/delete the headers in the event data. The event data must remain an array, even if emptied.

AJAX_CALL_UNKNOWN

Name AJAX_CALL_UNKNOWN
Data the AJAX call name in $_POST['call']
Action Sends an ”AJAX call <call> unknown!” message.
Preventable yes
Signalled Signaled from lib/exe/ajax.php if the AJAX call is not recognized.
Notes Remember to use preventDefault() (and possibly stopPropagation()) when handling an unknown AJAX event. This keeps other handlers from corrupting your returned data. Also use a unique AJAX call name to avoid collisions.

DOKUWIKI_DONE

Name DOKUWIKI_DONE
Data None
Action None
Preventable no
Signalled After all processing has been completed as the last thing doku.php does before exiting. It is possible that under certain circumstances dokuwiki will exit without returning to doku.php and this event may not then be signalled.
Notes

DOKUWIKI_STARTED

Name DOKUWIKI_STARTED
Data None
Action None
Preventable no
Signalled The event is signalled after Dokuwiki has completed its initialization phase and before it closes the session3). Most Dokuwiki globals will have been created and populated, the global $_SESSION var will still be in existence.
Notes [1] Even after $_SESSION has been closed a plugin can reopen the session to access session data - as long as headers have not already been sent. For an example of this refer to lib/plugins/config/admin.php.

FEED_ITEM_ADD

Name FEED_ITEM_ADD
Data
$data['item'] - The Feed Item object prepared for insertion in the feed
$data['opt'] - associative array of feed options
$data['ditem'] - the raw item data as it was given to the rss_BuildItems function
$data['rss'] - the full feed creator object
Action Adds the feed item to the RSS/Atom feed
Preventable yes
Signalled by rss_BuildItems()4) when the feed is build
Notes You can use this to manipulate feed items before they are added to the feed. Eg. you could add advertising banners or add additional links in the description

HTML_CONFLICTFORM_OUTPUT

Name HTML_CONFLICTFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the conflict form printing routine
Preventable no
Signalled by html_form()5) when called via html_conflict()
Notes Use this to inject additional form elements6) into the form.

HTML_DRAFTFORM_OUTPUT

Name HTML_DRAFTFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the draft form printing routine
Preventable no
Signalled by html_form()7) when called via html_draft()
Notes Use this to inject additional form elements8) into the form.

HTML_EDITFORM_OUTPUT

replaces former HTML_EDITFORM_INJECTION event

Name HTML_EDITFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the edit form printing routine
Preventable no
Signalled by html_form()9) when called via html_edit()
Notes Use this to inject additional form elements10) into the form.

HTML_LOGINFORM_OUTPUT

replaces former HTML_LOGINFORM_INJECTION event

Name HTML_LOGINFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the login form printing routine
Preventable no
Signalled by html_form()11) when called via html_login()
Notes Use this to inject additional form elements12) into the form.

HTML_PAGE_FROMTEMPLATE

Name HTML_PAGE_FROMTEMPLATE
Data
$data[0] - ID of the page to be created
Action load an existing namespace template, replace some variables and return it to the edit box
Preventable yes
Signalled by html_edit()13) when a new page is to be created (loaded into the editor)
Notes The event name will probably change when html_edit() is refactored

HTML_REGISTERFORM_OUTPUT

replaces former HTML_REGISTERFORM_INJECTION event

Name HTML_REGISTERFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the register form printing routine
Preventable no
Signalled by html_form()14) when called via html_register()
Notes Use this to inject additional form elements15) into the form.

HTML_RESENDPWDFORM_OUTPUT

Name HTML_RESENDPWDFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the resend password form printing routine
Preventable no
Signalled by html_form()16) when called via html_resendpwd()
Notes Use this to inject additional form elements17) into the form.

HTML_UPDATEPROFILEFORM_OUTPUT

Name HTML_UPDATEPROFILEFORM_OUTPUT
Data A Doku_Form object containing the form components
Action Triggered by the update profile form printing routine
Preventable no
Signalled by html_form()18) when called via html_updateprofile()
Notes Use this to inject additional form elements19) into the form.

MEDIA_UPLOAD_FINISH

Name MEDIA_UPLOAD_FINISH
Data an array which hold various informations about the uploaded file
Action Triggered when uploading a file
Preventable yes
Signalled by media_upload()20)
Notes Use this to inspect/change/modify uploaded files

MEDIA_SENDFILE

Name MEDIA_SENDFILE
Data
'file'   The filename of the file about to be delivered, can be modified by your plugin
'mime'   The Mime-Type of the file, can be modified by your plugin
'cache'  The wanted cache behavior (-1 = cache forever, 0 = never cache, >0 cache time in seconds), can be modified by your plugin
'orig'   Images only: filename before resizing
'ext'    Extension of the file
'width'  Images only: the wanted width as specified in the request
'height' Images only: the wanted height as specified in the request
Action Triggered when downloading a file
Preventable yes
Signalled in the main code of fetch.php21), wraps around sendFile()
Notes Can be used to intercept or modify downloaded files and images

develonly

IO_NAMESPACE_CREATED

Name IO_NAMESPACE_CREATED
Data
$data[0]    ns: The colon separated namespace path minus the trailing page name. 
$data[1]    ns_type: 'pages' or 'media' namespace tree. 
Action The namespace is created.
Preventable no
Signalled By io_createNamespace()22) after creating namespaces.
Notes Events are called “inside out” so parent namespace created events are called before their children.

IO_NAMESPACE_DELETED

Name IO_NAMESPACE_DELETED
Data
$data[0]    ns: The colon separated namespace path minus the trailing page name.
$data[1]    ns_type: 'pages' or 'media' namespace tree.
Action The namespace is deleted.
Preventable no
Signalled By io_sweepNS()23) after deleting a namespace.
Notes Child namespaces are deleted before their parents.

IO_WIKIPAGE_READ

Name IO_WIKIPAGE_READ
Data
$data[0]    The raw arguments for io_readFile as an array. Do not change.
$data[1]    ns: The colon separated namespace path minus the trailing page name. (false if root ns)
$data[2]    page_name: The wiki page name.
$data[3]    rev: The page revision, false for current wiki pages.
Action Reads in wiki page.
Preventable no
Signalled By io_readWikiPage()24).
Notes The page content may be modified by action plugins between the disk and DokuWiki.

IO_WIKIPAGE_WRITE

Name IO_WIKIPAGE_WRITE
Data
$data[0]    The raw arguments for io_saveFile as an array. Do not change file path.
            $data[0][0] is the file path.
            Note, $data[0][1] is the content to be saved, and may be modified. 
$data[1]    ns: The colon separated namespace path minus the trailing page name. (false if root ns)
$data[2]    page_name: The wiki page name.
$data[3]    rev: The page revision, false for current wiki pages.
Action Writes out wiki page.
Preventable no
Signalled By io_writeWikiPage()25).
Notes The page content may be modified by action plugins between DokuWiki and the disk.
Page creation may be detected by checking if the file already exists and the revision is false.
Page deletion may be detected by checking for empty page content. On update to an existing page this event is called twice, once for the transfer of the old version to the attic (rev will have a value) and once to write the new version of the page into the wiki (rev is false).

MAIL_MESSAGE_SEND

Name MAIL_MESSAGE_SEND
Data mail_send parameters: to, subject, body, from, cc, bcc, headers, params
Action send message using DokuWiki's internal mailing function
Preventable yes
Signalled by calling DokuWiki's mail_send function26)
Notes

Can be used to replace DokuWiki's mail function with another mailing mechanism.

PARSER_CACHE_USE

Name PARSER_CACHE_USE
Data a cache object27)
Action determine whether or not cached data should be used
Preventable yes
Signalled by cache versions of parser wrapper functions28)
Notes
For handling of above event, key properties of the cache object are:
  - page, if present the wiki page id,
          may not always be present, e.g. when called for locale xhtml files
  - file, source file
  - mode, renderer mode (e.g. 'xhtml') or 'i' for instructions
  - depends, array of dependencies used to determine cache validity

Syntax plugins can use this event to provide their own assistance to DokuWiki's cache validity logic when the syntax extension adds other dependencies to the rendered page.

PARSER_HANDLER_DONE

Name PARSER_HANDLER_DONE
Data the handler object
Action None
Preventable no
Signalled by the handler within its _finalisation() method29), as it finalises the instruction list.
Notes
[1] At the time of signalling the instruction list is complete
    except for two instructions, document_start & document_end.

Syntax plugins could register for this event to finalise processing of their data knowing it is complete, e.g. an alternate footnote plugin.

PARSER_METADATA_RENDER

Name PARSER_METADATA_RENDER
Data page metadata
Action refresh the metadata with the metadata renderer
Preventable yes
Signalled by p_render_metadata30) before instantiating the metadata renderer
Notes
[1] the metadata includes both the ''current'' and ''persistent'' arrays.
[2] Action plugins can use this event to update/refresh metadata they may have set elsewhere.

PARSER_WIKITEXT_PREPROCESS

Name PARSER_WIKITEXT_PREPROCESS
Data the raw wiki text
Action None
Preventable no
Signalled In p_get_instructions()31) immediately before DokuWiki hands the text to the parser for processing allowing the event handler to inspect or modify the data before it is parsed.
Notes

RENDERER_CONTENT_POSTPROCESS

Name RENDERER_CONTENT_POSTPROCESS
Data
data[0]    the format of the renderer output (e.g. xhtml, meta)
data[1]    the output produced by the renderer 
Action None
Preventable no
Signalled In p_render()32) immediately after the renderer completes, allowing the event handler to inspect or modify its output before it is passed back to DokuWiki
Notes

TOOLBAR_DEFINE

Name TOOLBAR_DEFINE
Data an array containing the data of already defined toolbar buttons
Action None
Preventable yes
Signalled In toolbar_JSdefines()33) before and after the standard toolbar is being filled
Notes Useful for adding additional buttons to the toolbar.

TPL_ACT_RENDER

Name TPL_ACT_RENDER
Data $ACT
Action output XHTML for the chosen $ACT [1]
Preventable yes
Signalled by tpl_content()34)
Notes [1] The output corresponds to that produced by tpl_content() and is displayed within <div id=“page” in the default dokuwiki template.
[2] Event handlers can output XHTML before and/or after the main Dokuwiki page output and can prevent the default dokuwiki page generation taking place.
[3] Output buffering is active during this event, the captured output is passed to the event TPL_CONTENT_DISPLAY

Example uses could include:

  • replacements for dokuwiki command handlers like index.
  • appending a discussion section to the page by handling TPL_ACT_RENDER_AFTER

TPL_ACT_UNKNOWN

Name TPL_ACT_UNKNOWN
Data $ACT (based on the do variable in the query string)
Action Display an “unknown action” message
Preventable yes
Signalled By tpl_content()35) if it does not recognise the $ACT value.
Notes [1] also refer ACTION_ACT_PREPROCESS event.
[2] Handlers of this event can output XHTML which will be displayed in the main dokuwiki window - ie. where the wiki page would normally be displayed.

TPL_CONTENT_DISPLAY

Name TPL_CONTENT_DISPLAY
Data the XHTML output produced by tpl_content_core()
Action Send the XHTML output to browser
Preventable yes
Signalled by tpl_content()36) after receiving the output on completion of the TPL_ACT_RENDER event
Notes Event handlers can post process the XHTML output before it is sent to the client browser.

TPL_METAHEADER_OUTPUT

Name TPL_METAHEADER_OUTPUT
Data An array of meta headers
Action Render the array data to XHTML and send it to the browser
Preventable yes
Signalled by tpl_metaheaders()37) after preparing the default meta headers
Notes Eventhandlers can modify the header array and add new ones
1) , 2) inc/actions.php
3) doku.php
4) feed.php
5) , 7) , 9) , 11) , 13) , 14) , 16) , 18) inc/html.php
6) , 8) , 10) , 12) , 15) , 17) , 19) see inc/form.php
20) inc/media.php
21) inc/fetch.php
22) , 23) , 24) , 25) inc/io.php
26) refer inc/mail.php
27) refer inc/cache.php
28) , 30) , 31) , 32) inc/parserutils.php
29) inc/parser/handler.php
33) inc/toolbar.php
34) , 35) , 36) , 37) inc/template.php
 
wiki/events_list.txt · Last modified: 2008/06/28 15:33 by chi
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate