Merge "Make line breaks in <blockquote> behave like <div> (bug 6200)."
[mediawiki.git] / includes / actions / InfoAction.php
blob012a65566e9261626a0833b06a52fb47f1b03515
1 <?php
2 /**
3 * Displays information about a page.
5 * Copyright © 2011 Alexandre Emsenhuber
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 * @file
22 * @ingroup Actions
25 /**
26 * Displays information about a page.
28 * @ingroup Actions
30 class InfoAction extends FormlessAction {
31 /**
32 * Returns the name of the action this object responds to.
34 * @return string lowercase
36 public function getName() {
37 return 'info';
40 /**
41 * Whether this action can still be executed by a blocked user.
43 * @return bool
45 public function requiresUnblock() {
46 return false;
49 /**
50 * Whether this action requires the wiki not to be locked.
52 * @return bool
54 public function requiresWrite() {
55 return false;
58 /**
59 * Clear the info cache for a given Title.
61 * @since 1.22
62 * @param Title $title Title to clear cache for
64 public static function invalidateCache( Title $title ) {
65 global $wgMemc;
66 // Clear page info.
67 $revision = WikiPage::factory( $title )->getRevision();
68 if ( $revision !== null ) {
69 $key = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $revision->getId() );
70 $wgMemc->delete( $key );
74 /**
75 * Shows page information on GET request.
77 * @return string Page information that will be added to the output
79 public function onView() {
80 $content = '';
82 // Validate revision
83 $oldid = $this->page->getOldID();
84 if ( $oldid ) {
85 $revision = $this->page->getRevisionFetched();
87 // Revision is missing
88 if ( $revision === null ) {
89 return $this->msg( 'missing-revision', $oldid )->parse();
92 // Revision is not current
93 if ( !$revision->isCurrent() ) {
94 return $this->msg( 'pageinfo-not-current' )->plain();
98 // Page header
99 if ( !$this->msg( 'pageinfo-header' )->isDisabled() ) {
100 $content .= $this->msg( 'pageinfo-header' )->parse();
103 // Hide "This page is a member of # hidden categories" explanation
104 $content .= Html::element( 'style', array(),
105 '.mw-hiddenCategoriesExplanation { display: none; }' ) . "\n";
107 // Hide "Templates used on this page" explanation
108 $content .= Html::element( 'style', array(),
109 '.mw-templatesUsedExplanation { display: none; }' ) . "\n";
111 // Get page information
112 $pageInfo = $this->pageInfo();
114 // Allow extensions to add additional information
115 wfRunHooks( 'InfoAction', array( $this->getContext(), &$pageInfo ) );
117 // Render page information
118 foreach ( $pageInfo as $header => $infoTable ) {
119 $content .= $this->makeHeader( $this->msg( "pageinfo-${header}" )->escaped() ) . "\n";
120 $table = "\n";
121 foreach ( $infoTable as $infoRow ) {
122 $name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0];
123 $value = ( $infoRow[1] instanceof Message ) ? $infoRow[1]->escaped() : $infoRow[1];
124 $id = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->getKey() : null;
125 $table = $this->addRow( $table, $name, $value, $id ) . "\n";
127 $content = $this->addTable( $content, $table ) . "\n";
130 // Page footer
131 if ( !$this->msg( 'pageinfo-footer' )->isDisabled() ) {
132 $content .= $this->msg( 'pageinfo-footer' )->parse();
135 // Page credits
136 /*if ( $this->page->exists() ) {
137 $content .= Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $this->getContributors() );
140 return $content;
144 * Creates a header that can be added to the output.
146 * @param string $header The header text.
147 * @return string The HTML.
149 protected function makeHeader( $header ) {
150 $spanAttribs = array( 'class' => 'mw-headline', 'id' => Sanitizer::escapeId( $header ) );
151 return Html::rawElement( 'h2', array(), Html::element( 'span', $spanAttribs, $header ) );
155 * Adds a row to a table that will be added to the content.
157 * @param string $table The table that will be added to the content
158 * @param string $name The name of the row
159 * @param string $value The value of the row
160 * @param string $id The ID to use for the 'tr' element
161 * @return string The table with the row added
163 protected function addRow( $table, $name, $value, $id ) {
164 return $table . Html::rawElement( 'tr', $id === null ? array() : array( 'id' => 'mw-' . $id ),
165 Html::rawElement( 'td', array( 'style' => 'vertical-align: top;' ), $name ) .
166 Html::rawElement( 'td', array(), $value )
171 * Adds a table to the content that will be added to the output.
173 * @param string $content The content that will be added to the output
174 * @param string $table The table
175 * @return string The content with the table added
177 protected function addTable( $content, $table ) {
178 return $content . Html::rawElement( 'table', array( 'class' => 'wikitable mw-page-info' ),
179 $table );
183 * Returns page information in an easily-manipulated format. Array keys are used so extensions
184 * may add additional information in arbitrary positions. Array values are arrays with one
185 * element to be rendered as a header, arrays with two elements to be rendered as a table row.
187 * @return array
189 protected function pageInfo() {
190 global $wgContLang, $wgRCMaxAge, $wgMemc,
191 $wgUnwatchedPageThreshold, $wgPageInfoTransclusionLimit;
193 $user = $this->getUser();
194 $lang = $this->getLanguage();
195 $title = $this->getTitle();
196 $id = $title->getArticleID();
198 $memcKey = wfMemcKey( 'infoaction',
199 sha1( $title->getPrefixedText() ), $this->page->getLatest() );
200 $pageCounts = $wgMemc->get( $memcKey );
201 if ( $pageCounts === false ) {
202 // Get page information that would be too "expensive" to retrieve by normal means
203 $pageCounts = self::pageCounts( $title );
205 $wgMemc->set( $memcKey, $pageCounts );
208 // Get page properties
209 $dbr = wfGetDB( DB_SLAVE );
210 $result = $dbr->select(
211 'page_props',
212 array( 'pp_propname', 'pp_value' ),
213 array( 'pp_page' => $id ),
214 __METHOD__
217 $pageProperties = array();
218 foreach ( $result as $row ) {
219 $pageProperties[$row->pp_propname] = $row->pp_value;
222 // Basic information
223 $pageInfo = array();
224 $pageInfo['header-basic'] = array();
226 // Display title
227 $displayTitle = $title->getPrefixedText();
228 if ( !empty( $pageProperties['displaytitle'] ) ) {
229 $displayTitle = $pageProperties['displaytitle'];
232 $pageInfo['header-basic'][] = array(
233 $this->msg( 'pageinfo-display-title' ), $displayTitle
236 // Is it a redirect? If so, where to?
237 if ( $title->isRedirect() ) {
238 $pageInfo['header-basic'][] = array(
239 $this->msg( 'pageinfo-redirectsto' ),
240 Linker::link( $this->page->getRedirectTarget() ) .
241 $this->msg( 'word-separator' )->text() .
242 $this->msg( 'parentheses', Linker::link(
243 $this->page->getRedirectTarget(),
244 $this->msg( 'pageinfo-redirectsto-info' )->escaped(),
245 array(),
246 array( 'action' => 'info' )
247 ) )->text()
251 // Default sort key
252 $sortKey = $title->getCategorySortkey();
253 if ( !empty( $pageProperties['defaultsort'] ) ) {
254 $sortKey = $pageProperties['defaultsort'];
257 $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-default-sort' ), $sortKey );
259 // Page length (in bytes)
260 $pageInfo['header-basic'][] = array(
261 $this->msg( 'pageinfo-length' ), $lang->formatNum( $title->getLength() )
264 // Page ID (number not localised, as it's a database ID)
265 $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-article-id' ), $id );
267 // Language in which the page content is (supposed to be) written
268 $pageLang = $title->getPageLanguage()->getCode();
269 $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-language' ),
270 Language::fetchLanguageName( $pageLang, $lang->getCode() )
271 . ' ' . $this->msg( 'parentheses', $pageLang ) );
273 // Search engine status
274 $pOutput = new ParserOutput();
275 if ( isset( $pageProperties['noindex'] ) ) {
276 $pOutput->setIndexPolicy( 'noindex' );
279 // Use robot policy logic
280 $policy = $this->page->getRobotPolicy( 'view', $pOutput );
281 $pageInfo['header-basic'][] = array(
282 $this->msg( 'pageinfo-robot-policy' ), $this->msg( "pageinfo-robot-${policy['index']}" )
285 if ( isset( $pageCounts['views'] ) ) {
286 // Number of views
287 $pageInfo['header-basic'][] = array(
288 $this->msg( 'pageinfo-views' ), $lang->formatNum( $pageCounts['views'] )
292 if (
293 $user->isAllowed( 'unwatchedpages' ) ||
294 ( $wgUnwatchedPageThreshold !== false &&
295 $pageCounts['watchers'] >= $wgUnwatchedPageThreshold )
297 // Number of page watchers
298 $pageInfo['header-basic'][] = array(
299 $this->msg( 'pageinfo-watchers' ), $lang->formatNum( $pageCounts['watchers'] )
301 } elseif ( $wgUnwatchedPageThreshold !== false ) {
302 $pageInfo['header-basic'][] = array(
303 $this->msg( 'pageinfo-watchers' ),
304 $this->msg( 'pageinfo-few-watchers' )->numParams( $wgUnwatchedPageThreshold )
308 // Redirects to this page
309 $whatLinksHere = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() );
310 $pageInfo['header-basic'][] = array(
311 Linker::link(
312 $whatLinksHere,
313 $this->msg( 'pageinfo-redirects-name' )->escaped(),
314 array(),
315 array( 'hidelinks' => 1, 'hidetrans' => 1 )
317 $this->msg( 'pageinfo-redirects-value' )
318 ->numParams( count( $title->getRedirectsHere() ) )
321 // Is it counted as a content page?
322 if ( $this->page->isCountable() ) {
323 $pageInfo['header-basic'][] = array(
324 $this->msg( 'pageinfo-contentpage' ),
325 $this->msg( 'pageinfo-contentpage-yes' )
329 // Subpages of this page, if subpages are enabled for the current NS
330 if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
331 $prefixIndex = SpecialPage::getTitleFor( 'Prefixindex', $title->getPrefixedText() . '/' );
332 $pageInfo['header-basic'][] = array(
333 Linker::link( $prefixIndex, $this->msg( 'pageinfo-subpages-name' )->escaped() ),
334 $this->msg( 'pageinfo-subpages-value' )
335 ->numParams(
336 $pageCounts['subpages']['total'],
337 $pageCounts['subpages']['redirects'],
338 $pageCounts['subpages']['nonredirects'] )
342 if ( $title->inNamespace( NS_CATEGORY ) ) {
343 $category = Category::newFromTitle( $title );
344 $pageInfo['category-info'] = array(
345 array(
346 $this->msg( 'pageinfo-category-pages' ),
347 $lang->formatNum( $category->getPageCount() )
349 array(
350 $this->msg( 'pageinfo-category-subcats' ),
351 $lang->formatNum( $category->getSubcatCount() )
353 array(
354 $this->msg( 'pageinfo-category-files' ),
355 $lang->formatNum( $category->getFileCount() )
360 // Page protection
361 $pageInfo['header-restrictions'] = array();
363 // Is this page effected by the cascading protection of something which includes it?
364 if ( $title->isCascadeProtected() ) {
365 $cascadingFrom = '';
366 $sources = $title->getCascadeProtectionSources(); // Array deferencing is in PHP 5.4 :(
368 foreach ( $sources[0] as $sourceTitle ) {
369 $cascadingFrom .= Html::rawElement( 'li', array(), Linker::linkKnown( $sourceTitle ) );
372 $cascadingFrom = Html::rawElement( 'ul', array(), $cascadingFrom );
373 $pageInfo['header-restrictions'][] = array(
374 $this->msg( 'pageinfo-protect-cascading-from' ),
375 $cascadingFrom
379 // Is out protection set to cascade to other pages?
380 if ( $title->areRestrictionsCascading() ) {
381 $pageInfo['header-restrictions'][] = array(
382 $this->msg( 'pageinfo-protect-cascading' ),
383 $this->msg( 'pageinfo-protect-cascading-yes' )
387 // Page protection
388 foreach ( $title->getRestrictionTypes() as $restrictionType ) {
389 $protectionLevel = implode( ', ', $title->getRestrictions( $restrictionType ) );
391 if ( $protectionLevel == '' ) {
392 // Allow all users
393 $message = $this->msg( 'protect-default' )->escaped();
394 } else {
395 // Administrators only
396 $message = $this->msg( "protect-level-$protectionLevel" );
397 if ( $message->isDisabled() ) {
398 // Require "$1" permission
399 $message = $this->msg( "protect-fallback", $protectionLevel )->parse();
400 } else {
401 $message = $message->escaped();
405 $pageInfo['header-restrictions'][] = array(
406 $this->msg( "restriction-$restrictionType" ), $message
410 if ( !$this->page->exists() ) {
411 return $pageInfo;
414 // Edit history
415 $pageInfo['header-edits'] = array();
417 $firstRev = $this->page->getOldestRevision();
418 $lastRev = $this->page->getRevision();
419 $batch = new LinkBatch;
421 if ( $firstRev ) {
422 $firstRevUser = $firstRev->getUserText( Revision::FOR_THIS_USER );
423 if ( $firstRevUser !== '' ) {
424 $batch->add( NS_USER, $firstRevUser );
425 $batch->add( NS_USER_TALK, $firstRevUser );
429 if ( $lastRev ) {
430 $lastRevUser = $lastRev->getUserText( Revision::FOR_THIS_USER );
431 if ( $lastRevUser !== '' ) {
432 $batch->add( NS_USER, $lastRevUser );
433 $batch->add( NS_USER_TALK, $lastRevUser );
437 $batch->execute();
439 if ( $firstRev ) {
440 // Page creator
441 $pageInfo['header-edits'][] = array(
442 $this->msg( 'pageinfo-firstuser' ),
443 Linker::revUserTools( $firstRev )
446 // Date of page creation
447 $pageInfo['header-edits'][] = array(
448 $this->msg( 'pageinfo-firsttime' ),
449 Linker::linkKnown(
450 $title,
451 $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ),
452 array(),
453 array( 'oldid' => $firstRev->getId() )
458 if ( $lastRev ) {
459 // Latest editor
460 $pageInfo['header-edits'][] = array(
461 $this->msg( 'pageinfo-lastuser' ),
462 Linker::revUserTools( $lastRev )
465 // Date of latest edit
466 $pageInfo['header-edits'][] = array(
467 $this->msg( 'pageinfo-lasttime' ),
468 Linker::linkKnown(
469 $title,
470 $lang->userTimeAndDate( $this->page->getTimestamp(), $user ),
471 array(),
472 array( 'oldid' => $this->page->getLatest() )
477 // Total number of edits
478 $pageInfo['header-edits'][] = array(
479 $this->msg( 'pageinfo-edits' ), $lang->formatNum( $pageCounts['edits'] )
482 // Total number of distinct authors
483 $pageInfo['header-edits'][] = array(
484 $this->msg( 'pageinfo-authors' ), $lang->formatNum( $pageCounts['authors'] )
487 // Recent number of edits (within past 30 days)
488 $pageInfo['header-edits'][] = array(
489 $this->msg( 'pageinfo-recent-edits', $lang->formatDuration( $wgRCMaxAge ) ),
490 $lang->formatNum( $pageCounts['recent_edits'] )
493 // Recent number of distinct authors
494 $pageInfo['header-edits'][] = array(
495 $this->msg( 'pageinfo-recent-authors' ), $lang->formatNum( $pageCounts['recent_authors'] )
498 // Array of MagicWord objects
499 $magicWords = MagicWord::getDoubleUnderscoreArray();
501 // Array of magic word IDs
502 $wordIDs = $magicWords->names;
504 // Array of IDs => localized magic words
505 $localizedWords = $wgContLang->getMagicWords();
507 $listItems = array();
508 foreach ( $pageProperties as $property => $value ) {
509 if ( in_array( $property, $wordIDs ) ) {
510 $listItems[] = Html::element( 'li', array(), $localizedWords[$property][1] );
514 $localizedList = Html::rawElement( 'ul', array(), implode( '', $listItems ) );
515 $hiddenCategories = $this->page->getHiddenCategories();
517 if (
518 count( $listItems ) > 0 ||
519 count( $hiddenCategories ) > 0 ||
520 $pageCounts['transclusion']['from'] > 0 ||
521 $pageCounts['transclusion']['to'] > 0
523 $options = array( 'LIMIT' => $wgPageInfoTransclusionLimit );
524 $transcludedTemplates = $title->getTemplateLinksFrom( $options );
525 $transcludedTargets = $title->getTemplateLinksTo( $options );
527 // Page properties
528 $pageInfo['header-properties'] = array();
530 // Magic words
531 if ( count( $listItems ) > 0 ) {
532 $pageInfo['header-properties'][] = array(
533 $this->msg( 'pageinfo-magic-words' )->numParams( count( $listItems ) ),
534 $localizedList
538 // Hidden categories
539 if ( count( $hiddenCategories ) > 0 ) {
540 $pageInfo['header-properties'][] = array(
541 $this->msg( 'pageinfo-hidden-categories' )
542 ->numParams( count( $hiddenCategories ) ),
543 Linker::formatHiddenCategories( $hiddenCategories )
547 // Transcluded templates
548 if ( $pageCounts['transclusion']['from'] > 0 ) {
549 if ( $pageCounts['transclusion']['from'] > count( $transcludedTemplates ) ) {
550 $more = $this->msg( 'morenotlisted' )->escaped();
551 } else {
552 $more = null;
555 $pageInfo['header-properties'][] = array(
556 $this->msg( 'pageinfo-templates' )
557 ->numParams( $pageCounts['transclusion']['from'] ),
558 Linker::formatTemplates(
559 $transcludedTemplates,
560 false,
561 false,
562 $more )
566 if ( $pageCounts['transclusion']['to'] > 0 ) {
567 if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) {
568 $more = Linker::link(
569 $whatLinksHere,
570 $this->msg( 'moredotdotdot' )->escaped(),
571 array(),
572 array( 'hidelinks' => 1, 'hideredirs' => 1 )
574 } else {
575 $more = null;
578 $pageInfo['header-properties'][] = array(
579 $this->msg( 'pageinfo-transclusions' )
580 ->numParams( $pageCounts['transclusion']['to'] ),
581 Linker::formatTemplates(
582 $transcludedTargets,
583 false,
584 false,
585 $more )
590 return $pageInfo;
594 * Returns page counts that would be too "expensive" to retrieve by normal means.
596 * @param Title $title Title to get counts for
597 * @return array
599 protected static function pageCounts( Title $title ) {
600 global $wgRCMaxAge, $wgDisableCounters;
602 wfProfileIn( __METHOD__ );
603 $id = $title->getArticleID();
605 $dbr = wfGetDB( DB_SLAVE );
606 $result = array();
608 if ( !$wgDisableCounters ) {
609 // Number of views
610 $views = (int) $dbr->selectField(
611 'page',
612 'page_counter',
613 array( 'page_id' => $id ),
614 __METHOD__
616 $result['views'] = $views;
619 // Number of page watchers
620 $watchers = (int) $dbr->selectField(
621 'watchlist',
622 'COUNT(*)',
623 array(
624 'wl_namespace' => $title->getNamespace(),
625 'wl_title' => $title->getDBkey(),
627 __METHOD__
629 $result['watchers'] = $watchers;
631 // Total number of edits
632 $edits = (int) $dbr->selectField(
633 'revision',
634 'COUNT(rev_page)',
635 array( 'rev_page' => $id ),
636 __METHOD__
638 $result['edits'] = $edits;
640 // Total number of distinct authors
641 $authors = (int) $dbr->selectField(
642 'revision',
643 'COUNT(DISTINCT rev_user_text)',
644 array( 'rev_page' => $id ),
645 __METHOD__
647 $result['authors'] = $authors;
649 // "Recent" threshold defined by $wgRCMaxAge
650 $threshold = $dbr->timestamp( time() - $wgRCMaxAge );
652 // Recent number of edits
653 $edits = (int) $dbr->selectField(
654 'revision',
655 'COUNT(rev_page)',
656 array(
657 'rev_page' => $id,
658 "rev_timestamp >= " . $dbr->addQuotes( $threshold )
660 __METHOD__
662 $result['recent_edits'] = $edits;
664 // Recent number of distinct authors
665 $authors = (int) $dbr->selectField(
666 'revision',
667 'COUNT(DISTINCT rev_user_text)',
668 array(
669 'rev_page' => $id,
670 "rev_timestamp >= " . $dbr->addQuotes( $threshold )
672 __METHOD__
674 $result['recent_authors'] = $authors;
676 // Subpages (if enabled)
677 if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
678 $conds = array( 'page_namespace' => $title->getNamespace() );
679 $conds[] = 'page_title ' . $dbr->buildLike( $title->getDBkey() . '/', $dbr->anyString() );
681 // Subpages of this page (redirects)
682 $conds['page_is_redirect'] = 1;
683 $result['subpages']['redirects'] = (int) $dbr->selectField(
684 'page',
685 'COUNT(page_id)',
686 $conds,
687 __METHOD__ );
689 // Subpages of this page (non-redirects)
690 $conds['page_is_redirect'] = 0;
691 $result['subpages']['nonredirects'] = (int) $dbr->selectField(
692 'page',
693 'COUNT(page_id)',
694 $conds,
695 __METHOD__
698 // Subpages of this page (total)
699 $result['subpages']['total'] = $result['subpages']['redirects']
700 + $result['subpages']['nonredirects'];
703 // Counts for the number of transclusion links (to/from)
704 $result['transclusion']['to'] = (int) $dbr->selectField(
705 'templatelinks',
706 'COUNT(tl_from)',
707 array(
708 'tl_namespace' => $title->getNamespace(),
709 'tl_title' => $title->getDBkey()
711 __METHOD__
714 $result['transclusion']['from'] = (int) $dbr->selectField(
715 'templatelinks',
716 'COUNT(*)',
717 array( 'tl_from' => $title->getArticleID() ),
718 __METHOD__
721 wfProfileOut( __METHOD__ );
722 return $result;
726 * Returns the name that goes in the "<h1>" page title.
728 * @return string
730 protected function getPageTitle() {
731 return $this->msg( 'pageinfo-title', $this->getTitle()->getPrefixedText() )->text();
735 * Get a list of contributors of $article
736 * @return string: html
738 protected function getContributors() {
739 global $wgHiddenPrefs;
741 $contributors = $this->page->getContributors();
742 $real_names = array();
743 $user_names = array();
744 $anon_ips = array();
746 # Sift for real versus user names
747 foreach ( $contributors as $user ) {
748 $page = $user->isAnon()
749 ? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
750 : $user->getUserPage();
752 if ( $user->getID() == 0 ) {
753 $anon_ips[] = Linker::link( $page, htmlspecialchars( $user->getName() ) );
754 } elseif ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
755 $real_names[] = Linker::link( $page, htmlspecialchars( $user->getRealName() ) );
756 } else {
757 $user_names[] = Linker::link( $page, htmlspecialchars( $user->getName() ) );
761 $lang = $this->getLanguage();
763 $real = $lang->listToText( $real_names );
765 # "ThisSite user(s) A, B and C"
766 if ( count( $user_names ) ) {
767 $user = $this->msg( 'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
768 count( $user_names ) )->escaped();
769 } else {
770 $user = false;
773 if ( count( $anon_ips ) ) {
774 $anon = $this->msg( 'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
775 count( $anon_ips ) )->escaped();
776 } else {
777 $anon = false;
780 # This is the big list, all mooshed together. We sift for blank strings
781 $fulllist = array();
782 foreach ( array( $real, $user, $anon ) as $s ) {
783 if ( $s !== '' ) {
784 array_push( $fulllist, $s );
788 $count = count( $fulllist );
789 # "Based on work by ..."
790 return $count
791 ? $this->msg( 'othercontribs' )->rawParams(
792 $lang->listToText( $fulllist ) )->params( $count )->escaped()
793 : '';
797 * Returns the description that goes below the "<h1>" tag.
799 * @return string
801 protected function getDescription() {
802 return '';