Manual:$wgHooks

From MediaWiki.org
Jump to: navigation, search
This page is a translated version of the page Manual:$wgHooks and the translation is 57% complete.

Other languages:
العربية • ‎català • ‎Deutsch • ‎English • ‎español • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎Nederlands • ‎polski • ‎português • ‎português do Brasil • ‎中文
拡張機能: $wgHooks
Global list of hooks.
導入されたバージョン: 1.4.0 (r6405)
除去されたバージョン: 使用中
可能な値: 詳細を参照
既定値: array()
他の設定: アルファベット順 | 機能順

詳細[edit]

Global list of hooks. It is an array of arrays: it specifies for every event an array of functions to be called.

Add a hook by doing:

$wgHooks['event_name'][] = 'function';

または

$wgHooks['event_name'][] = array( 'function', $data );

または

$wgHooks['event_name'][] = array( $object, 'method' );

または

$wgHooks['event_name'][] = $object;

In the last case, the callback is expected to be a method in $object of the same name as the event preceded by "on", e.g. "onUnknownAction"

Hooks are called when events happen, where a hook is a PHP function, and an event is an abstract concept.

関連項目[edit]