wfDeprecated( __METHOD__, '1.25' );
$title = urldecode( $title );
- $title = str_replace( '_', ' ', $title );
+ $title = strtr( $title, '_', ' ' );
return self::getLinkAttributesInternal( $title, $class );
}
# fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
if ( strpos( $match[1], '%' ) !== false ) {
- $match[1] = str_replace(
- array( '<', '>' ),
- array( '<', '>' ),
- rawurldecode( $match[1] )
+ $match[1] = strtr(
+ rawurldecode( $match[1] ),
+ array( '<' => '<', '>' => '>' )
);
}
* Currently unused.
*
* @param array $tree Return value of ParserOutput::getSections()
+ * @param string|Language|bool $lang Language for the toc title, defaults to user language
* @return string HTML fragment
*/
- public static function generateTOC( $tree ) {
+ public static function generateTOC( $tree, $lang = false ) {
$toc = '';
$lastLevel = 0;
foreach ( $tree as $section ) {
$lastLevel = $section['toclevel'];
}
$toc .= self::tocLineEnd();
- return self::tocList( $toc );
+ return self::tocList( $toc, $lang );
}
/**