-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
25 lines (20 loc) · 782 Bytes
/
bootstrap.php
File metadata and controls
25 lines (20 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
if ( defined( 'MWSTAKE_MEDIAWIKI_COMPONENT_GENERICTAGHANDLER_VERSION' ) ) {
return;
}
use MediaWiki\MediaWikiServices;
use MWStake\MediaWiki\Component\GenericTagHandler\GenericHandler;
define( 'MWSTAKE_MEDIAWIKI_COMPONENT_GENERICTAGHANDLER_VERSION', '1.0.0' );
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = static function ( Parser $parser ): bool {
/** @var \MWStake\MediaWiki\Component\GenericTagHandler\TagFactory */
$factory = MediaWikiServices::getInstance()->getService( 'MWStakeTagFactory' );
$tags = $factory->getAll();
foreach ( $tags as $tag ) {
$genericHandler = new GenericHandler( $tag );
$tagNames = $tag->getTagNames();
foreach ( $tagNames as $tagName ) {
$parser->setHook( $tagName, [ $genericHandler, 'handle' ] );
}
}
return true;
};