36 parent::__construct( $article, $context );
46 return $this->
msg(
'creditspage' )->escaped();
56 'mediawiki.action.styles',
60 $s = $this->
msg(
'nocredits' )->parse();
65 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ], $s );
79 $s = $this->getAuthor();
80 if ( $cnt > 1 || $cnt < 0 ) {
93 private function getAuthor() {
95 $user = $this->userFactory->newFromName( $page->getUserText(), UserRigorOptions::RIGOR_NONE );
97 $timestamp = $page->getTimestamp();
100 $d = $lang->date( $page->getTimestamp(),
true );
101 $t = $lang->time( $page->getTimestamp(),
true );
107 return $this->
msg(
'lastmodifiedatby', $d, $t )->rawParams(
109 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
120 return !in_array(
'realname', $hiddenPrefs );
130 $contributors = $this->
getWikiPage()->getContributors();
132 $others_link =
false;
134 # Hmm... too many to fit!
135 if ( $cnt > 0 && $contributors->count() > $cnt ) {
138 return $this->
msg(
'othercontribs' )->rawParams(
139 $others_link )->params( $contributors->count() )->escaped();
147 # Sift for real versus user names
149 foreach ( $contributors as $user ) {
151 if ( $user->isRegistered() ) {
152 $link = $this->
link( $user );
154 $real_names[] = $link;
156 $user_names[] = $link;
159 $anon_ips[] = $this->
link( $user );
169 if ( count( $real_names ) ) {
170 $real = $lang->listToText( $real_names );
175 # "ThisSite user(s) A, B and C"
176 if ( count( $user_names ) ) {
177 $user = $this->
msg(
'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
178 count( $user_names ) )->escaped();
183 if ( count( $anon_ips ) ) {
184 $anon = $this->
msg(
'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
185 count( $anon_ips ) )->escaped();
190 # This is the big list, all mooshed together. We sift for blank strings
192 foreach ( [ $real, $user, $anon, $others_link ] as $s ) {
193 if ( $s !==
false ) {
198 $count = count( $fullList );
200 # "Based on work by ..."
202 ? $this->
msg(
'othercontribs' )->rawParams(
203 $lang->listToText( $fullList ) )->params( $count )->escaped()
215 if ( $real ===
'' ) {
222 return Linker::userLink( $user->
getId(), $user->
getName(), $real );
231 $link = $this->
link( $user );
233 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
237 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
246 return $this->linkRenderer->makeKnownLink(
248 $this->
msg(
'others' )->text(),
250 [
'action' =>
'credits' ]
256class_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.