37 private $linkRenderer;
54 parent::__construct( $page, $context );
55 $this->linkRenderer = $linkRenderer;
56 $this->userFactory = $userFactory;
64 return $this->
msg(
'creditspage' )->escaped();
74 'mediawiki.action.styles',
78 $s = $this->
msg(
'nocredits' )->parse();
83 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ],
$s );
97 $s = $this->getAuthor();
98 if ( $cnt > 1 || $cnt < 0 ) {
111 private function getAuthor() {
112 $page = $this->getWikiPage();
113 $user = $this->userFactory->newFromName( $page->
getUserText(), UserRigorOptions::RIGOR_NONE );
117 $lang = $this->getLanguage();
125 return $this->
msg(
'lastmodifiedatby', $d,
$t )->rawParams(
127 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
137 $hiddenPrefs = $this->context->getConfig()->get( MainConfigNames::HiddenPrefs );
138 return !in_array(
'realname', $hiddenPrefs );
150 $others_link =
false;
152 # Hmm... too many to fit!
156 return $this->
msg(
'othercontribs' )->rawParams(
165 # Sift for real versus user names
169 if ( $user->isRegistered() ) {
170 $link = $this->
link( $user );
172 $real_names[] = $link;
174 $user_names[] = $link;
177 $anon_ips[] = $this->
link( $user );
187 if ( count( $real_names ) ) {
188 $real =
$lang->listToText( $real_names );
193 # "ThisSite user(s) A, B and C"
194 if ( count( $user_names ) ) {
195 $user = $this->
msg(
'siteusers' )->rawParams(
$lang->listToText( $user_names ) )->params(
196 count( $user_names ) )->escaped();
201 if ( count( $anon_ips ) ) {
202 $anon = $this->
msg(
'anonusers' )->rawParams(
$lang->listToText( $anon_ips ) )->params(
203 count( $anon_ips ) )->escaped();
208 # This is the big list, all mooshed together. We sift for blank strings
210 foreach ( [ $real, $user, $anon, $others_link ] as
$s ) {
211 if (
$s !==
false ) {
216 $count = count( $fullList );
218 # "Based on work by ..."
220 ? $this->
msg(
'othercontribs' )->rawParams(
221 $lang->listToText( $fullList ) )->params( $count )->escaped()
233 if ( $real ===
'' ) {
249 $link = $this->
link( $user );
251 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
255 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
264 return $this->linkRenderer->makeKnownLink(
266 $this->
msg(
'others' )->text(),
268 [
'action' =>
'credits' ]
getWikiPage()
Get a WikiPage object.
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)
othersLink()
Get a link to action=credits of $article page.
getDescription()
Returns the description that goes below the <h1> element.
link(User $user)
Get a link to $user's user page.
onView()
This is largely cadged from PageHistory::history.
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)
A class containing constants representing the names of configuration variables.
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