-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExternalLinks.php
54 lines (50 loc) · 2.05 KB
/
ExternalLinks.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
45
46
47
48
49
50
51
52
53
54
<?php
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => 'External Links',
'version' => '1.23',
'author' => array( 'Subfader', '[http://roman-allenstein.de Roman Allenstein]'),
'url' => 'http://www.mediawiki.org/wiki/Extension:ExternalLinks',
'descriptionmsg' => 'el-desc',
);
$wgExtensionMessagesFiles['EL'] = dirname(__FILE__) . '/ExternalLinks.i18n.php';
$rtgIP = dirname( __FILE__ ) . '/';
$wgAutoloadClasses['ExternalLinks'] = $rtgIP . 'SpecialExternalLinks.php';
$wgSpecialPages['ExternalLinks'] = 'ExternalLinks';
$wgSpecialPageGroups['ExternalLinks'] = 'wiki';
/**
* Output the toolbox link
*/
$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efExternalLinksNavigation';
$wgHooks['SkinTemplateToolboxEnd'][] = 'efExternalLinksToolbox';
function efExternalLinksNavigation( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
global $wgTitle, $wgELtoolboxLink, $wgUser, $wgELuserRight, $wgArticlePath;
if ( $wgELtoolboxLink
&& $wgUser->isAllowed( $wgELuserRight )
&& $revid !== 0
//$skintemplate->getTitle() buggy in MW 1.15 and below
#&& $skintemplate->getTitle()->isContentPage()
#&& $skintemplate->getTitle()->exists()
&& $wgTitle->exists()
) {
$nav_urls['ELtoolboxLink'] = array(
'text' => wfMsg( 'el-toolboxLink' ),
//$skintemplate->makeSpecialUrl() doesn't respect beautiful URLs, problem on submitting again
'href' => $skintemplate->makeSpecialUrl( "ExternalLinks", "do=filter&checkResponse=on&storeSession=on&pageID=" . $wgTitle->getArticleID() )
);
}
return true;
}
function efExternalLinksToolbox( &$monobook ) {
if ( isset( $monobook->data['nav_urls']['ELtoolboxLink'] ) )
if ( $monobook->data['nav_urls']['ELtoolboxLink']['href'] == '' ) {
?><li id="t-iscontributors"><?php echo $monobook->msg( 'el-toolboxLink' ); ?></li><?php
} else {
?><li id="t-contributors"><?php
?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['ELtoolboxLink']['href'] ) ?>"><?php
echo $monobook->msg( 'el-toolboxLink' );
?></a><?php
?></li><?php
}
return true;
}