38 return $this->
msg(
'creditspage' )->escaped();
47 if ( $this->page->getID() == 0 ) {
48 $s = $this->
msg(
'nocredits' )->parse();
53 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ],
$s );
68 if ( $cnt > 1 || $cnt < 0 ) {
82 $user = User::newFromName(
$page->getUserText(),
false );
84 $timestamp =
$page->getTimestamp();
87 $d =
$lang->date(
$page->getTimestamp(),
true );
94 return $this->
msg(
'lastmodifiedatby', $d,
$t )->rawParams(
95 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
105 $hiddenPrefs = $this->context->getConfig()->get(
'HiddenPrefs' );
106 return !in_array(
'realname', $hiddenPrefs );
118 $others_link =
false;
120 # Hmm... too many to fit!
124 return $this->
msg(
'othercontribs' )->rawParams(
133 # Sift for real versus user names
137 if ( $user->isLoggedIn() ) {
138 $link = $this->
link( $user );
140 $real_names[] = $link;
142 $user_names[] = $link;
145 $anon_ips[] = $this->
link( $user );
155 if ( count( $real_names ) ) {
156 $real =
$lang->listToText( $real_names );
161 # "ThisSite user(s) A, B and C"
162 if ( count( $user_names ) ) {
163 $user = $this->
msg(
'siteusers' )->rawParams(
$lang->listToText( $user_names ) )->params(
164 count( $user_names ) )->escaped();
169 if ( count( $anon_ips ) ) {
170 $anon = $this->
msg(
'anonusers' )->rawParams(
$lang->listToText( $anon_ips ) )->params(
171 count( $anon_ips ) )->escaped();
176 # This is the big list, all mooshed together. We sift for blank strings
178 foreach ( [ $real, $user, $anon, $others_link ] as
$s ) {
179 if (
$s !==
false ) {
180 array_push( $fulllist,
$s );
184 $count = count( $fulllist );
186 # "Based on work by ..."
188 ? $this->
msg(
'othercontribs' )->rawParams(
189 $lang->listToText( $fulllist ) )->params( $count )->escaped()
201 if ( $real ===
'' ) {
209 ? SpecialPage::getTitleFor(
'Contributions', $user->
getName() )
212 return MediaWikiServices::getInstance()
213 ->getLinkRenderer()->makeLink(
$page, $real );
222 $link = $this->
link( $user );
224 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
228 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
237 return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
239 $this->
msg(
'others' )->text(),
241 [
'action' =>
'credits' ]
$page
Page on which we're performing the action.
getTitle()
Shortcut to get the Title object from the page.
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.
getAuthor(Page $page)
Get the last author with the last modification time.
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> tag.
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.
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.
getUserPage()
Get this user's personal page title.
isAnon()
Get whether the user is anonymous.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
if(!isset( $args[0])) $lang