Rewritten the way the API handles tokens:
[lhc/web/wiklou.git] / docs / hooks.txt
index abb4cd0..6f76b5c 100644 (file)
@@ -254,6 +254,7 @@ $old: old title
 $nt: new title
 $user: user who is doing the move
 $err: error message
+$reason: the reason for the move (added in 1.13)
 
 'AbortNewAccount': Return false to cancel account creation.
 $user: the User object about to be created (read-only, incomplete)
@@ -280,6 +281,28 @@ $EditPage : the EditPage object
 $text : the new text of the article (has yet to be saved)
 $resultArr : data in this array will be added to the API result
 
+'APIQueryInfoTokens': use this hook to add custom tokens to prop=info.
+Every token has an action, which will be used in the intoken parameter
+and in the output (actiontoken="..."), and a callback function which
+should return the token, or false if the user isn't allowed to obtain
+it. The prototype of the callback function is func($pageid, $title)
+where $pageid is the page ID of the page the token is requested for
+and $title is the associated Title object. In the hook, just add
+your callback to the $tokenFunctions array and return true (returning
+false makes no sense)
+$tokenFunctions: array(action => callback)
+
+'APIQueryRevisionsTokens': use this hook to add custom tokens to prop=revisions.
+Every token has an action, which will be used in the rvtoken parameter
+and in the output (actiontoken="..."), and a callback function which
+should return the token, or false if the user isn't allowed to obtain
+it. The prototype of the callback function is func($pageid, $title, $rev)
+where $pageid is the page ID of the page associated to the revision the
+token is requested for, $title the associated Title object and $rev the
+associated Revision object. In the hook, just add your callback to the
+$tokenFunctions array and return true (returning false makes no sense)
+$tokenFunctions: array(action => callback)
+
 'ArticleAfterFetchContent': after fetching content of an article from the database
 $article: the article (object) being loaded from the database
 $content: the content (string) of the article
@@ -288,6 +311,8 @@ $content: the content (string) of the article
 $article: the article (object) being deleted
 $user: the user (object) deleting the article
 $reason: the reason (string) the article is being deleted
+$error: if the deletion was prohibited, the (raw HTML) error message to display
+  (added in 1.13)
 
 'ArticleDeleteComplete': after an article is deleted
 $article: the article that was deleted
@@ -523,11 +548,13 @@ $editor: Edit form (see includes/EditPage.php)
 $text: Contents of the edit box
 $section: Section being edited
 &$error: Error message to return
+$summary: Edit summary for page
 
 'EditFilterMerged': Post-section-merge edit filter
 $editor: EditPage instance (object)
 $text: content of the edit box
 $error: error message to return
+$summary: Edit summary for page
 
 'EditFormPreloadText': Allows population of the edit form when creating new pages
 &$text: Text to preload with
@@ -693,6 +720,12 @@ $page: ImagePage object
 &$file: File object
 &$displayFile: displayed File object
 
+'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect
+$title: Title object ($wgTitle)
+$request: WebRequest
+$ignoreRedirect: boolean to skip redirect check
+$target: Title/string of redirect target
+
 'InitPreferencesForm': called at the end of PreferencesForm's constructor
 $form: the PreferencesForm
 $request: the web request to initialized from
@@ -728,6 +761,11 @@ $lang: laguage code (string)
 $specialPageAliases: associative array of magic words synonyms
 $lang: laguage code (string)
 
+'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just before the return
+&$url: the image url
+&$alt: the image's alt text
+&$img: the new image HTML (if returning false)
+
 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just before the return
 &$url: the link url
 &$text: the link text
@@ -815,6 +853,7 @@ $article: $wgArticle
 $title:   $wgTitle
 $user:    $wgUser
 $request: $wgRequest
+$this:    The $mediawiki object
 
 'MessagesPreLoad': When loading a message from the database
 $title: title of the message (string)
@@ -831,6 +870,10 @@ $article: the article edited
 $rev: the new revision
 $baseID: the revision ID this was based off, if any
 
+'OpenSearchUrls': Called when constructing the OpenSearch description XML.
+Hooks can alter or append to the array of URLs for search & suggestion formats.
+&$urls: array of associative arrays with Url element attributes
+
 'OutputPageBeforeHTML': a page has been processed by the parser and
 the resulting HTML is about to be displayed.  
 $parserOutput: the parserOutput (object) that corresponds to the page 
@@ -840,6 +883,12 @@ $text: the text that will be displayed, in HTML (string)
 $out: OutputPage instance (object)
 $parserOutput: parserOutput instance being added in $out
 
+'OutputPageMakeCategoryLinks': links are about to be generated for the page's categories.
+  Implementations should return false if they generate the category links, so the default link generation is skipped.
+$out: OutputPage instance (object)
+$categories: associative array, keys are category names, values are category types ("normal" or "hidden")
+$links: array, intended to hold the result. Must be an associative array with category types as keys and arrays of HTML links as values.
+
 'PageHistoryBeforeList': When a history page list is about to be constructed.
 $article: the article that the history is loading for
 
@@ -1099,7 +1148,7 @@ $funct: function called to execute the special page
 'SpecialPage_initList': called when setting up SpecialPage::$mList, use this hook to remove a core special page
 $list: list (array) of core special pages
 
-'SpecialRecentChangesPanel' called when building form options in SpecialRecentChanges
+'SpecialRecentChangesPanel': called when building form options in SpecialRecentChanges
 &$extraOpts: array of added items, to which can be added
 $opts: FormOptions for this request