summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Nuke/includes/NukeHooks.php
blob: fcf2264f0de74178a8fd0d623394c030b4b09e63 (plain)
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
<?php

class NukeHooks {

	/**
	 * Shows link to Special:Nuke on Special:Contributions/username if applicable
	 *
	 * @param int $userId
	 * @param Title $userPageTitle
	 * @param string[] &$toolLinks
	 * @param SpecialPage $sp
	 */
	public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks,
		SpecialPage $sp
	) {
		$username = $userPageTitle->getText();
		if ( $sp->getUser()->isAllowed( 'nuke' ) && !IP::isValidRange( $username ) ) {
			$toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
				SpecialPage::getTitleFor( 'Nuke' ),
				$sp->msg( 'nuke-linkoncontribs' )->text(),
				[ 'title' => $sp->msg( 'nuke-linkoncontribs-text', $username )->text() ],
				[ 'target' => $username ]
			);
		}
	}
}