Manual:$wgExtensionFunctions

From MediaWiki.org

Jump to: navigation, search
Extensions: $wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
Introduced in version: 1.3.0
Removed in version: still in use
Allowed Values:
Default Value: array()

Other settings: Alphabetical | By Function


[edit] Details

$wgExtensionFunctions is an array of names of functions without parameters for the setup of extensions. It is defined in DefaultSettings.php without assigning any values. Typically each extension has one setup function associated with it. The array element concerned is typically defined in the extension file itself, with a statement of the form

$wgExtensionFunctions[] = "setup_function_name";

In Setup.php for each array element

call_user_func( setup_function_name );

is applied, i.e., the setup function is called.

Typical content of this setup function is:

global $wgParser;
      $wgParser->setHook( "tagname", "function" );

i.e. a call to function setHook in Parser.php, specifying the function defining the HTML to which a text between XML-style tags has to be converted.

In the case of a parser function:

global $wgParser;
      $wgParser->setFunctionHook( "magic_word_id", "PHP_function_name" );

i.e. a call to function setFunctionHook in Parser.php, associating the magic_word_id of the parser function with the name of the PHP function defining it.

In the latter case we also have to add an element to array $wgHooks["LanguageGetMagic"], to associate magic words (function names that can be used in the wikitext) with magic_word_id.

[edit] See also

Personal tools