MediaWiki  1.34.0
NukeHooks.php
Go to the documentation of this file.
1 <?php
2 
3 class NukeHooks {
4 
13  public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks,
14  SpecialPage $sp
15  ) {
16  $username = $userPageTitle->getText();
17  if ( $sp->getUser()->isAllowed( 'nuke' ) && !IP::isValidRange( $username ) ) {
18  $toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
19  SpecialPage::getTitleFor( 'Nuke' ),
20  $sp->msg( 'nuke-linkoncontribs' )->text(),
21  [ 'title' => $sp->msg( 'nuke-linkoncontribs-text', $username )->text() ],
22  [ 'target' => $username ]
23  );
24  }
25  }
26 }
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:792
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:83
IP\isValidRange
static isValidRange( $ipRange)
Validate an IP range (valid address with a valid CIDR prefix).
Definition: IP.php:125
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:729
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:37
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:904
NukeHooks
Definition: NukeHooks.php:3
NukeHooks\nukeContributionsLinks
static nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks, SpecialPage $sp)
Shows link to Special:Nuke on Special:Contributions/username if applicable.
Definition: NukeHooks.php:13