45 parent::__construct( $article,
$context );
46 $this->linkRenderer = $linkRenderer;
47 $this->userFactory = $userFactory;
57 return $this->
msg(
'creditspage' )->escaped();
67 'mediawiki.action.styles',
71 $s = $this->
msg(
'nocredits' )->parse();
76 return Html::rawElement(
'div', [
'id' =>
'mw-credits' ], $s );
90 $s = $this->getAuthor();
91 if ( $cnt > 1 || $cnt < 0 ) {
104 private function getAuthor() {
106 $user = $this->userFactory->newFromName( $page->getUserText(), UserRigorOptions::RIGOR_NONE );
108 $timestamp = $page->getTimestamp();
111 $d = $lang->date( $page->getTimestamp(),
true );
112 $t = $lang->time( $page->getTimestamp(),
true );
118 return $this->
msg(
'lastmodifiedatby', $d, $t )->rawParams(
120 $this->
userLink( $user ) )->params( $user->getName() )->escaped();
131 return !in_array(
'realname', $hiddenPrefs );
141 $contributors = $this->
getWikiPage()->getContributors();
143 $others_link =
false;
145 # Hmm... too many to fit!
146 if ( $cnt > 0 && $contributors->count() > $cnt ) {
149 return $this->
msg(
'othercontribs' )->rawParams(
150 $others_link )->params( $contributors->count() )->escaped();
158 # Sift for real versus user names
160 foreach ( $contributors as $user ) {
162 if ( $user->isRegistered() ) {
163 $link = $this->
link( $user );
165 $real_names[] = $link;
167 $user_names[] = $link;
170 $anon_ips[] = $this->
link( $user );
180 if ( count( $real_names ) ) {
181 $real = $lang->listToText( $real_names );
186 # "ThisSite user(s) A, B and C"
187 if ( count( $user_names ) ) {
188 $user = $this->
msg(
'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
189 count( $user_names ) )->escaped();
194 if ( count( $anon_ips ) ) {
195 $anon = $this->
msg(
'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
196 count( $anon_ips ) )->escaped();
201 # This is the big list, all mooshed together. We sift for blank strings
203 foreach ( [ $real, $user, $anon, $others_link ] as $s ) {
204 if ( $s !==
false ) {
209 $count = count( $fullList );
211 # "Based on work by ..."
213 ? $this->
msg(
'othercontribs' )->rawParams(
214 $lang->listToText( $fullList ) )->params( $count )->escaped()
226 if ( $real ===
'' ) {
233 return Linker::userLink( $user->
getId(), $user->
getName(), $real );
242 $link = $this->
link( $user );
244 return $this->
msg(
'anonuser' )->rawParams( $link )->parse();
248 return $this->
msg(
'siteuser' )->rawParams( $link )->params( $user->
getName() )->escaped();
257 return $this->linkRenderer->makeKnownLink(
259 $this->
msg(
'others' )->text(),
261 [
'action' =>
'credits' ]
267class_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.