105 if ( $format !==
'wiki' && $format !==
'html' ) {
106 throw new MWException(
'UserGroupMembership::getLink() $format parameter should be ' .
107 "'wiki' or 'html'" );
111 $expiry = $ugm->getExpiry();
112 $group = $ugm->getGroup();
118 if ( $userName !==
null ) {
119 $groupName = self::getGroupMemberName( $group, $userName );
121 $groupName = self::getGroupName( $group );
125 $linkTitle = self::getGroupPage( $group );
126 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
127 if ( $format ===
'wiki' ) {
129 $linkPage = $linkTitle->getFullText();
130 $groupLink =
"[[$linkPage|$groupName]]";
132 $groupLink = $groupName;
136 $groupLink = $linkRenderer->makeLink( $linkTitle, $groupName );
138 $groupLink = htmlspecialchars( $groupName );
146 $expiryDT = $uiLanguage->userTimeAndDate( $expiry, $uiUser );
147 $expiryD = $uiLanguage->userDate( $expiry, $uiUser );
148 $expiryT = $uiLanguage->userTime( $expiry, $uiUser );
150 if ( $format ===
'wiki' ) {
151 return $context->
msg(
'group-membership-link-with-expiry' )
152 ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->text();
155 return $context->
msg(
'group-membership-link-with-expiry' )
156 ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->escaped();