52 parent::__construct( $page, $context );
53 $this->linkRenderer = $linkRenderer;
54 $this->userFactory = $userFactory;
62 return $this->
msg(
'creditspage' )->escaped();
72 'mediawiki.action.styles',
76 $s = $this->
msg(
'nocredits' )->parse();
81 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ],
$s );
96 if ( $cnt > 1 || $cnt < 0 ) {
111 $user = $this->userFactory->newFromName(
$page->
getUserText(), UserFactory::RIGOR_NONE );
123 return $this->
msg(
'lastmodifiedatby', $d,
$t )->rawParams(
124 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
134 $hiddenPrefs = $this->context->getConfig()->get(
'HiddenPrefs' );
135 return !in_array(
'realname', $hiddenPrefs );
147 $others_link =
false;
149 # Hmm... too many to fit!
153 return $this->
msg(
'othercontribs' )->rawParams(
162 # Sift for real versus user names
166 if ( $user->isRegistered() ) {
167 $link = $this->
link( $user );
169 $real_names[] = $link;
171 $user_names[] = $link;
174 $anon_ips[] = $this->
link( $user );
184 if ( count( $real_names ) ) {
185 $real =
$lang->listToText( $real_names );
190 # "ThisSite user(s) A, B and C"
191 if ( count( $user_names ) ) {
192 $user = $this->
msg(
'siteusers' )->rawParams(
$lang->listToText( $user_names ) )->params(
193 count( $user_names ) )->escaped();
198 if ( count( $anon_ips ) ) {
199 $anon = $this->
msg(
'anonusers' )->rawParams(
$lang->listToText( $anon_ips ) )->params(
200 count( $anon_ips ) )->escaped();
205 # This is the big list, all mooshed together. We sift for blank strings
207 foreach ( [ $real, $user, $anon, $others_link ] as
$s ) {
208 if (
$s !==
false ) {
209 array_push( $fulllist,
$s );
213 $count = count( $fulllist );
215 # "Based on work by ..."
217 ? $this->
msg(
'othercontribs' )->rawParams(
218 $lang->listToText( $fulllist ) )->params( $count )->escaped()
230 if ( $real ===
'' ) {
246 $link = $this->
link( $user );
248 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
252 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
261 return $this->linkRenderer->makeKnownLink(
263 $this->
msg(
'others' )->text(),
265 [
'action' =>
'credits' ]
getWikiPage()
Get a WikiPage object.
WikiPage Article ImagePage CategoryPage Page $page
Page on which we're performing the action.
getOutput()
Get the OutputPage being used for this instance.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
getLanguage()
Shortcut to get the user Language being used for this instance.
getCredits( $cnt, $showIfMax=true)
Get a list of contributors.
getName()
Return the name of the action this object responds to.
getContributors( $cnt, $showIfMax)
Get a list of contributors of $article.
__construct(Page $page, IContextSource $context, LinkRenderer $linkRenderer, UserFactory $userFactory)
canShowRealUserName()
Whether we can display the user's real name (not a hidden pref)
getAuthor()
Get the last author with the last modification time.
othersLink()
Get a link to action=credits of $article page.
getDescription()
Returns the description that goes below the <h1> tag.
link(User $user)
Get a link to $user's user page.
onView()
This is largely cadged from PageHistory::history.
LinkRenderer $linkRenderer
userLink(User $user)
Get a link to $user's user page.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getName()
Get the user name, or the IP of an anonymous user.
getRealName()
Get the user's real name.
getId( $wikiId=self::LOCAL)
Get the user's ID.
isAnon()
Get whether the user is anonymous.
getUserText( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null)
Interface for objects which can provide a MediaWiki context on request.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s
if(!isset( $args[0])) $lang