wfDeprecated( __METHOD__, '1.25' );
$title = urldecode( $title );
- $title = str_replace( '_', ' ', $title );
+ $title = strtr( $title, '_', ' ' );
return self::getLinkAttributesInternal( $title, $class );
}
$href = self::getUploadUrl( $title, $query );
- return '<a href="' . htmlspecialchars( $href ) . '" class="new" title="' .
+ // @todo FIXME: If we don't to escape apostrophes (single quotes) here (using ENT_QUOTES),
+ // then double apostrophes will be parsed as italics somewhere later in the parser,
+ // and break everything horribly
+ return '<a href="' . htmlspecialchars( $href, ENT_QUOTES ) . '" class="new" title="' .
htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' .
$encLabel . '</a>';
}
# 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( '<' => '<', '>' => '>' )
);
}
}
/**
- * Generate a table of contents from a section tree
- * Currently unused.
+ * Generate a table of contents from a section tree.
*
* @param array $tree Return value of ParserOutput::getSections()
* @param string|Language|bool $lang Language for the toc title, defaults to user language