58 parent::__construct( $article,
$context );
59 $this->linkRenderer = $linkRenderer;
60 $this->userFactory = $userFactory;
70 return $this->
msg(
'creditspage' )->escaped();
80 'mediawiki.action.styles',
84 $s = $this->
msg(
'nocredits' )->parse();
89 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ], $s );
103 $s = $this->getAuthor();
104 if ( $cnt > 1 || $cnt < 0 ) {
117 private function getAuthor() {
119 $user = $this->userFactory->newFromName( $page->getUserText(), UserRigorOptions::RIGOR_NONE );
121 $timestamp = $page->getTimestamp();
124 $d = $lang->date( $page->getTimestamp(),
true );
125 $t = $lang->time( $page->getTimestamp(),
true );
131 return $this->
msg(
'lastmodifiedatby', $d, $t )->rawParams(
133 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
144 return !in_array(
'realname', $hiddenPrefs );
154 $contributors = $this->
getWikiPage()->getContributors();
156 $others_link =
false;
158 # Hmm... too many to fit!
159 if ( $cnt > 0 && $contributors->count() > $cnt ) {
162 return $this->
msg(
'othercontribs' )->rawParams(
163 $others_link )->params( $contributors->count() )->escaped();
171 # Sift for real versus user names
173 foreach ( $contributors as $user ) {
175 if ( $user->isRegistered() ) {
176 $link = $this->
link( $user );
178 $real_names[] = $link;
180 $user_names[] = $link;
183 $anon_ips[] = $this->
link( $user );
193 if ( count( $real_names ) ) {
194 $real = $lang->listToText( $real_names );
199 # "ThisSite user(s) A, B and C"
200 if ( count( $user_names ) ) {
201 $user = $this->
msg(
'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
202 count( $user_names ) )->escaped();
207 if ( count( $anon_ips ) ) {
208 $anon = $this->
msg(
'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
209 count( $anon_ips ) )->escaped();
214 # This is the big list, all mooshed together. We sift for blank strings
216 foreach ( [ $real, $user, $anon, $others_link ] as $s ) {
217 if ( $s !==
false ) {
222 $count = count( $fullList );
224 # "Based on work by ..."
226 ? $this->
msg(
'othercontribs' )->rawParams(
227 $lang->listToText( $fullList ) )->params( $count )->escaped()
239 if ( $real ===
'' ) {
246 return Linker::userLink( $user->
getId(), $user->
getName(), $real );
255 $link = $this->
link( $user );
257 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
261 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
270 return $this->linkRenderer->makeKnownLink(
272 $this->
msg(
'others' )->text(),
274 [
'action' =>
'credits' ]
280class_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.