}
# Tags
- list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
+ list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
+ $row->ts_tags,
+ 'history',
+ $this->getContext()
+ );
$classes = array_merge( $classes, $newClasses );
if ( $tagSummary !== '' ) {
$s2 .= " $tagSummary";
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
$rc->mAttribs['ts_tags'],
- 'changeslist'
+ 'changeslist',
+ $this->getContext()
);
$classes = array_merge( $classes, $newClasses );
$s .= ' ' . $tagSummary;
* @param string $tags Comma-separated list of tags
* @param string $page A label for the type of action which is being displayed,
* for example: 'history', 'contributions' or 'newpages'
+ * @param IContextSource|null $context
+ * @note Even though it takes null as a valid argument, an IContextSource is preferred
+ * in a new code, as the null value is subject to change in the future
* @return array Array with two items: (html, classes)
* - html: String: HTML for displaying the tags (empty string when param $tags is empty)
* - classes: Array of strings: CSS classes used in the generated html, one class for each tag
*/
- public static function formatSummaryRow( $tags, $page ) {
- global $wgLang;
-
+ public static function formatSummaryRow( $tags, $page, IContextSource $context = null ) {
if ( !$tags ) {
return array( '', array() );
}
+ if ( !$context ) {
+ $context = RequestContext::getMain();
+ }
$classes = array();
return array( '', array() );
}
- $markers = wfMessage( 'tag-list-wrapper' )
+ $markers = $context->msg( 'tag-list-wrapper' )
->numParams( count( $displayTags ) )
- ->rawParams( $wgLang->commaList( $displayTags ) )
+ ->rawParams( $context->getLanguage()->commaList( $displayTags ) )
->parse();
$markers = Xml::tags( 'span', array( 'class' => 'mw-tag-markers' ), $markers );
$attribs = array();
$tags = $this->getTags();
if ( $tags ) {
- list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $tags, 'edittags' );
+ list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
+ $tags,
+ 'edittags',
+ $this->list->getContext()
+ );
$content .= " $tagSummary";
$attribs['class'] = implode( ' ', $classes );
}
$attribs = array();
$tags = $this->getTags();
if ( $tags ) {
- list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $tags, 'edittags' );
+ list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
+ $tags,
+ 'edittags',
+ $this->list->getContext()
+ );
$content .= " $tagSummary";
$attribs['class'] = implode( ' ', $classes );
}
$ldel = $this->revisionDeleteLink( $this->mOldRev );
$oldRevisionHeader = $this->getRevisionHeader( $this->mOldRev, 'complete' );
- $oldChangeTags = ChangeTags::formatSummaryRow( $this->mOldTags, 'diff' );
+ $oldChangeTags = ChangeTags::formatSummaryRow( $this->mOldTags, 'diff', $this->getContext() );
$oldHeader = '<div id="mw-diff-otitle1"><strong>' . $oldRevisionHeader . '</strong></div>' .
'<div id="mw-diff-otitle2">' .
}
$newRevisionHeader = $this->getRevisionHeader( $this->mNewRev, 'complete' ) .
' ' . implode( ' ', $formattedRevisionTools );
- $newChangeTags = ChangeTags::formatSummaryRow( $this->mNewTags, 'diff' );
+ $newChangeTags = ChangeTags::formatSummaryRow( $this->mNewTags, 'diff', $this->getContext() );
$newHeader = '<div id="mw-diff-ntitle1"><strong>' . $newRevisionHeader . '</strong></div>' .
'<div id="mw-diff-ntitle2">' . Linker::revUserTools( $this->mNewRev, !$this->unhide ) .
$del = $this->getShowHideLinks( $row );
// Any tags...
- list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
+ list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow(
+ $row->ts_tags,
+ 'logevent',
+ $this->getContext()
+ );
$classes = array_merge(
array( 'mw-logline-' . $entry->getType() ),
$newClasses
$attribs = array();
$tags = $this->getTags();
if ( $tags ) {
- list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $tags, 'revisiondelete' );
+ list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
+ $tags,
+ 'revisiondelete',
+ $this->list->getContext()
+ );
$content .= " $tagSummary";
$attribs['class'] = implode( ' ', $classes );
}
# Tags, if any.
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
$row->ts_tags,
- 'contributions'
+ 'contributions',
+ $this->getContext()
);
$classes = array_merge( $classes, $newClasses );
$ret .= " $tagSummary";
if ( isset( $result->ts_tags ) ) {
list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow(
$result->ts_tags,
- 'newpages'
+ 'newpages',
+ $this->getContext()
);
$classes = array_merge( $classes, $newClasses );
} else {
array( 'ts_rev_id' => $rev->getId() ),
__METHOD__
);
- $tagSummary = ChangeTags::formatSummaryRow( $tags, 'deleteddiff' );
+ $tagSummary = ChangeTags::formatSummaryRow( $tags, 'deleteddiff', $this->getContext() );
// FIXME This is reimplementing DifferenceEngine#getRevisionHeader
// and partially #showDiffPage, but worse
// Tags
$attribs = array();
- list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'deletedhistory' );
+ list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
+ $row->ts_tags,
+ 'deletedhistory',
+ $this->getContext()
+ );
if ( $classes ) {
$attribs['class'] = implode( ' ', $classes );
}