* @return string
*/
function getSubcategorySortChar( $title, $sortkey ) {
- global $wgContLang;
-
if ( $title->getPrefixedText() == $sortkey ) {
$word = $title->getDBkey();
} else {
$firstChar = $this->collation->getFirstLetter( $word );
- return $wgContLang->convert( $firstChar );
+ return MediaWikiServices::getInstance()->getContentLanguage()->convert( $firstChar );
}
/**
* @param bool $isRedirect
*/
function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) {
- global $wgContLang;
if ( $this->showGallery ) {
$flip = $this->flip['file'];
if ( $flip ) {
} else {
$this->imgsNoGallery[] = $this->generateLink( 'image', $title, $isRedirect );
- $this->imgsNoGallery_start_char[] = $wgContLang->convert(
- $this->collation->getFirstLetter( $sortkey ) );
+ $this->imgsNoGallery_start_char[] = MediaWikiServices::getInstance()->
+ getContentLanguage()->convert( $this->collation->getFirstLetter( $sortkey ) );
}
}
* @param bool $isRedirect
*/
function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
- global $wgContLang;
-
$this->articles[] = $this->generateLink( 'page', $title, $isRedirect );
- $this->articles_start_char[] = $wgContLang->convert(
- $this->collation->getFirstLetter( $sortkey ) );
+ $this->articles_start_char[] = MediaWikiServices::getInstance()->
+ getContentLanguage()->convert( $this->collation->getFirstLetter( $sortkey ) );
}
function finaliseCategoryState() {
* @return string
*/
function getPagesSection() {
- $ti = wfEscapeWikiText( $this->title->getText() );
+ $name = $this->getOutput()->getUnprefixedDisplayTitle();
# Don't show articles section if there are none.
$r = '';
if ( $rescnt > 0 ) {
$r = "<div id=\"mw-pages\">\n";
- $r .= '<h2>' . $this->msg( 'category_header', $ti )->parse() . "</h2>\n";
+ $r .= '<h2>' . $this->msg( 'category_header' )->rawParams( $name )->parse() . "</h2>\n";
$r .= $countmsg;
$r .= $this->getSectionPagingLinks( 'page' );
$r .= $this->formatList( $this->articles, $this->articles_start_char );
* @return string
*/
function getImageSection() {
+ $name = $this->getOutput()->getUnprefixedDisplayTitle();
$r = '';
$rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery );
$dbcnt = $this->cat->getFileCount();
if ( $rescnt > 0 ) {
$r .= "<div id=\"mw-category-media\">\n";
$r .= '<h2>' .
- $this->msg(
- 'category-media-header',
- wfEscapeWikiText( $this->title->getText() )
- )->text() .
+ $this->msg( 'category-media-header' )->rawParams( $name )->parse() .
"</h2>\n";
$r .= $countmsg;
$r .= $this->getSectionPagingLinks( 'file' );
foreach ( $colContents as $char => $articles ) {
# Change space to non-breaking space to keep headers aligned
- $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char );
+ $h3char = $char === ' ' ? "\u{00A0}" : htmlspecialchars( $char );
$ret .= '<div class="mw-category-group"><h3>' . $h3char;
$ret .= "</h3>\n";
* @return string HTML
*/
private function pagingLinks( $first, $last, $type = '' ) {
- $prevLink = $this->msg( 'prev-page' )->text();
+ $prevLink = $this->msg( 'prev-page' )->escaped();
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $first != '' ) {
unset( $prevQuery["{$type}from"] );
$prevLink = $linkRenderer->makeKnownLink(
$this->addFragmentToTitle( $this->title, $type ),
- $prevLink,
+ new HtmlArmor( $prevLink ),
[],
$prevQuery
);
}
- $nextLink = $this->msg( 'next-page' )->text();
+ $nextLink = $this->msg( 'next-page' )->escaped();
if ( $last != '' ) {
$lastQuery = $this->query;
unset( $lastQuery["{$type}until"] );
$nextLink = $linkRenderer->makeKnownLink(
$this->addFragmentToTitle( $this->title, $type ),
- $nextLink,
+ new HtmlArmor( $nextLink ),
[],
$lastQuery
);
$totalcnt = $dbcnt;
} elseif ( $rescnt < $this->limit && !$fromOrUntil ) {
// Case 2: not sane, but salvageable. Use the number of results.
- // Since there are fewer than 200, we can also take this opportunity
- // to refresh the incorrect category table entry -- which should be
- // quick due to the small number of entries.
$totalcnt = $rescnt;
- DeferredUpdates::addCallableUpdate( [ $this->cat, 'refreshCounts' ] );
} else {
// Case 3: hopeless. Don't give a total count at all.
// Messages: category-subcat-count-limited, category-article-count-limited,