<input type='hidden' name='wpEditToken' value=\"{$token}\" />
</form>\n" );
- $wgOut->addHtml( $this->getUnblockLink() );
+ $wgOut->addHtml( $this->getConvenienceLinks() );
$user = User::newFromName( $this->BlockAddress );
if( is_object( $user ) ) {
return implode( ',', $flags );
}
+ /**
+ * Builds unblock and block list links
+ *
+ * @return string
+ */
+ private function getConvenienceLinks() {
+ global $wgUser;
+ $skin = $wgUser->getSkin();
+ $links[] = $this->getUnblockLink( $skin );
+ $links[] = $this->getBlockListLink( $skin );
+ return '<p class="mw-ipb-conveniencelinks">' . implode( ' | ', $links ) . '</p>';
+ }
+
/**
* Build a convenient link to unblock the given username or IP
* address, if available; otherwise link to a blank unblock
* form
*
+ * @param $skin Skin to use
* @return string
*/
- private function getUnblockLink() {
- global $wgUser;
+ private function getUnblockLink( $skin ) {
$list = SpecialPage::getTitleFor( 'Ipblocklist' );
- $skin = $wgUser->getSkin();
if( $this->BlockAddress ) {
$addr = htmlspecialchars( $this->BlockAddress );
- $link = $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock-addr', $addr ),
+ return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock-addr', $addr ),
'action=unblock&ip=' . $this->BlockAddress );
} else {
- $link = $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock' ), 'action=unblock' );
+ return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock' ), 'action=unblock' );
+ }
+ }
+
+ /**
+ * Build a convenience link to the block list
+ *
+ * @param $skin Skin to use
+ * @return string
+ */
+ private function getBlockListLink( $skin ) {
+ $list = SpecialPage::getTitleFor( 'Ipblocklist' );
+ if( $this->BlockAddress ) {
+ $addr = htmlspecialchars( $this->BlockAddress );
+ return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-blocklist-addr', $addr ),
+ 'ip=' . $this->BlockAddress );
+ } else {
+ return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-blocklist' ) );
}
- return '<p class="mw-ipb-unblocklink">' . $link . '</p>';
}
}
<br />See [[{{ns:Special}}:Ipblocklist|IP block list]] to review blocks.',
'ipb-unblock-addr' => 'Unblock $1',
'ipb-unblock' => 'Unblock a username or IP address',
+'ipb-blocklist-addr' => 'View existing blocks for $1',
+'ipb-blocklist' => 'View existing blocks',
'unblockip' => 'Unblock user',
'unblockiptext' => 'Use the form below to restore write access
to a previously blocked IP address or username.',