手册:$wgHooks

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

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎magyar • ‎polski • ‎português do Brasil • ‎čeština • ‎ไทย • ‎中文 • ‎日本語
扩展: $wgHooks
全域钩列表。
引进版本:1.4.0 (r6405)
移除版本:仍在使用
允许的值:参见详情
默认值:[]

细节

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

通过以下操作来添加一个“钩子”:

$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.

参见