blob: 16e8a55b2e87edececd0f4574bbfec09a458c50b (
plain) (
blame)
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
|
<?php
/**
* Class containing hooked functions for a TMWAccount environment
*/
class TMWAccountUIHooks {
/**
* @param $template
* @return bool
*/
public static function addRequestLoginText( &$template ) {
$context = RequestContext::getMain();
# Add a link to GameAccount from UserLogin
if ( !$context->getUser()->isAllowed( 'createaccount' ) ) {
$template->set( 'header', wfMessage( 'gameaccount-loginnotice')->parse());
}
return true;
}
/**
* @param $personal_urls
* @param $title
* @return bool
*/
public static function setRequestLoginLinks( array &$personal_urls, &$title ) {
if ( isset( $personal_urls['anonlogin'] ) ) {
$personal_urls['anonlogin']['text'] = wfMessage( 'nav-login-createaccount' );
} elseif ( isset( $personal_urls['login'] ) ) {
$personal_urls['login']['text'] = wfMessage( 'nav-login-createaccount' );
}
return true;
}
/**
* Add "x email-tmwed open account requests" notice
* @param $notice
* @return bool
*/
public static function tmwAccountsNotice( OutputPage &$out, Skin &$skin ) {
global $wgTMWAccountNotice;
$context = $out->getContext();
if ( !$wgTMWAccountNotice || !$context->getUser()->isAllowed( 'tmwaccount' ) ) {
return true;
}
# Only show on some special pages
$title = $context->getTitle();
if ( !$title->isSpecial( 'Recentchanges' ) && !$title->isSpecial( 'Watchlist' ) ) {
return true;
}
$count = TMWAccount::getOpenEmailTMWedCount( '*' );
if ( $count > 0 ) {
$out->prependHtml( // parsemag for PLURAL
'<div id="mw-tmwaccount-msg" class="plainlinks mw-tmwaccount-bar">' .
$out->parse( wfMessage( 'tmwaccount-newrequests', $count )->text(), false ) .
'</div>'
);
}
return true;
}
}
|