-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hashsum.php
44 lines (32 loc) · 1.26 KB
/
Hashsum.php
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
<?php
# Avoids illegal processing, doesn't cost much, but unnecessary on a correct installation
if (!defined('MEDIAWIKI')) { die(-1); }
//self executing anonymous function to prevent global scope assumptions
call_user_func( function() {
# Extension Declaration
$GLOBALS['wgExtensionCredits']['specialpage'][] = array(
'path' => __FILE__,
'name' => 'Hashsum',
'author' => array('toniher'),
'version' => '0.1',
'url' => 'https://www.mediawiki/wiki/User:Toniher',
'descriptionmsg' => 'hashsum-desc'
);
# A var to ease the referencing of files
$dir = dirname(__FILE__) . '/';
# i18n file referencing
$GLOBALS['wgMessagesDirs']['Hashsum'] = $dir . 'i18n';
$GLOBALS['wgExtensionMessagesFiles']['Hashsum'] = $dir . 'Hashsum.i18n.php';
$GLOBALS['wgExtensionMessagesFiles']['HashsumMagic'] = $dir . 'Hashsum.i18n.magic.php';
$GLOBALS['wgAutoloadClasses']['Hashsum'] = $dir . 'Hashsum_body.php';
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'wfRegisterHashsum';
});
/**
* @param $parser Parser
* @return bool
*/
function wfRegisterHashsum( $parser ) {
$parser->setFunctionHook( 'MD5sum', 'Hashsum::MD5sumProcess', Parser::SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'SHA1sum', 'Hashsum::SHA1sumProcess', Parser::SFH_OBJECT_ARGS );
return true;
}