57 $this->expiry =
$expiry ?:
null;
105 if ( $format !==
'wiki' && $format !==
'html' ) {
106 throw new MWException(
'UserGroupMembership::getLink() $format parameter should be ' .
107 "'wiki' or 'html'" );
112 $group = $ugm->getGroup();
118 if ( $userName !==
null ) {
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();
194 $msg =
wfMessage(
"grouppage-$group" )->inContentLanguage();
195 if ( $msg->exists() ) {
197 if ( is_object(
$title ) ) {
215 && $ugm->
getGroup() === $this->group
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
static getMain()
Get the RequestContext object associated with the main request.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Represents a "user group membership" – a specific instance of a user belonging to a group.
static getGroupPage( $group)
Gets the title of a page describing a particular user group.
__construct(int $userId=0, ?string $group=null, ?string $expiry=null)
static getLink( $ugm, IContextSource $context, $format, $userName=null)
Gets a link for a user group, possibly including the expiry date if relevant.
int $userId
The ID of the user who belongs to the group.
static getGroupName( $group)
Gets the localized friendly name for a group, if it exists.
static getGroupMemberName( $group, $member)
Gets the localized name for a member of a group, if it exists.
isExpired()
Has the membership expired?
string null $expiry
Timestamp of expiry in TS_MW format, or null if no expiry.
equals(UserGroupMembership $ugm)
Compares two pure value objects.
bool $expired
Expiration flag.
Interface for objects which can provide a MediaWiki context on request.
msg( $key,... $params)
This is the method for getting translated interface messages.