58 parent::__construct( $article,
$context );
59 $this->linkRenderer = $linkRenderer;
60 $this->userFactory = $userFactory;
68 return $this->
msg(
'creditspage' )->escaped();
78 'mediawiki.action.styles',
82 $s = $this->
msg(
'nocredits' )->parse();
87 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ], $s );
101 $s = $this->getAuthor();
102 if ( $cnt > 1 || $cnt < 0 ) {
115 private function getAuthor() {
117 $user = $this->userFactory->newFromName( $page->getUserText(), UserRigorOptions::RIGOR_NONE );
119 $timestamp = $page->getTimestamp();
122 $d = $lang->date( $page->getTimestamp(),
true );
123 $t = $lang->time( $page->getTimestamp(),
true );
129 return $this->
msg(
'lastmodifiedatby', $d, $t )->rawParams(
131 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
142 return !in_array(
'realname', $hiddenPrefs );
154 $others_link =
false;
156 # Hmm... too many to fit!
160 return $this->
msg(
'othercontribs' )->rawParams(
169 # Sift for real versus user names
173 if ( $user->isRegistered() ) {
174 $link = $this->
link( $user );
176 $real_names[] = $link;
178 $user_names[] = $link;
181 $anon_ips[] = $this->
link( $user );
191 if ( count( $real_names ) ) {
192 $real = $lang->listToText( $real_names );
197 # "ThisSite user(s) A, B and C"
198 if ( count( $user_names ) ) {
199 $user = $this->
msg(
'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
200 count( $user_names ) )->escaped();
205 if ( count( $anon_ips ) ) {
206 $anon = $this->
msg(
'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
207 count( $anon_ips ) )->escaped();
212 # This is the big list, all mooshed together. We sift for blank strings
214 foreach ( [ $real, $user, $anon, $others_link ] as $s ) {
215 if ( $s !==
false ) {
220 $count = count( $fullList );
222 # "Based on work by ..."
224 ? $this->
msg(
'othercontribs' )->rawParams(
225 $lang->listToText( $fullList ) )->params( $count )->escaped()
237 if ( $real ===
'' ) {
244 return Linker::userLink( $user->
getId(), $user->
getName(), $real );
253 $link = $this->
link( $user );
255 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
259 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
268 return $this->linkRenderer->makeKnownLink(
270 $this->
msg(
'others' )->text(),
272 [
'action' =>
'credits' ]
278class_alias( CreditsAction::class,
'CreditsAction' );
A class containing constants representing the names of configuration variables.
const HiddenPrefs
Name constant for the HiddenPrefs setting, for use with Config::get()
Legacy class representing an editable page and handling UI for some page actions.
Interface for objects which can provide a MediaWiki context on request.