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 ) {
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() ) {
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()
200 $real = $user->getRealName();
201 if ( $real ===
'' ) {
202 $real = $user->getName();
205 $real = $user->getName();
208 $page = $user->isAnon()
209 ? SpecialPage::getTitleFor(
'Contributions', $user->getName() )
210 : $user->getUserPage();
212 return MediaWikiServices::getInstance()
213 ->getLinkRenderer()->makeLink(
$page, $real );
223 if ( $user->isAnon() ) {
224 return $this->
msg(
'anonuser' )->rawParams(
$link )->parse();
229 return $this->
msg(
'siteuser' )->rawParams(
$link )->params( $user->
getName() )->escaped();
239 return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
241 $this->
msg(
'others' )->
text(),
243 [
'action' =>
'credits' ]
$page
Page on which we're performing the action.
getTitle()
Shortcut to get the Title object from the page.
msg( $key)
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.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
getRealName()
Get the user's real name.
isAnon()
Get whether the user is anonymous.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template to be included in the link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
if(!isset( $args[0])) $lang