-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPvXCode.hooks.php
More file actions
63 lines (53 loc) · 1.92 KB
/
PvXCode.hooks.php
File metadata and controls
63 lines (53 loc) · 1.92 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
use MediaWiki\MediaWikiServices;
use MediaWiki\Parser\Parser;
/**
* Curse Inc.
* PvX Code
* Guild Wars Template to PvXCode Handling
*
* @author Cameron Chunn
* @copyright (c) 2015 Curse Inc.
* @license GPL-2.0-or-later
* @package PvXCode
* @link https://gitlab.com/hydrawiki
*
* Purpose of this file:
* Declares how the extension will interpret pvxbig tag
* Loads the gwbbcode.inc.php file for builds and tooltips
*/
class PvXCodeHooks {
/**
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ParserFirstCallInit
* @param \MediaWiki\Parser\Parser &$parser
* @return true
*/
public static function onParserFirstCallInit( Parser &$parser ): bool {
// Calls PvXCode.php within the classes folder
$parser->setHook( 'pvxbig', 'PvXCode::parserRender' );
return true;
}
/**
* Include the third party gwbbcode library on extension regiation.
* @return void
*/
public static function onRegistration(): void {
// Retrieve config settings from localSettings.php -
$config = MediaWikiServices::getInstance()->getMainConfig();
$wgServer = $config->get( 'Server' );
$wgScriptPath = $config->get( 'ScriptPath' );
$wgExtensionAssetsPath = $config->get( 'ExtensionAssetsPath' );
// Local file path for includes
define( 'GWBBCODE_ROOT', __DIR__ . '/gwbbcode' );
// Website URL for the image folder within extension/PvXCode folder,
//e.g. '/extensions/PvXCode/images'/img_skills/83.jpg
define( 'GWBBCODE_IMAGES_FOLDER_URL', $wgExtensionAssetsPath . '/PvXCode/images' );
// Website URL for the page prefix,
// e.g. 'https://gwpvx.gamepedia.com/index.php?title='/Archive:Team_-_Frostmaw_Searing_Spike
define( 'PVX_WIKI_PAGE_URL', $wgServer . $wgScriptPath );
// Website URL for the page prefix on the prefered wiki database
define( 'GW_WIKI_PAGE_URL', 'https://wiki.guildwars.com/wiki' );
// Load main script
require_once GWBBCODE_ROOT . '/gwbbcode.inc.php';
}
}