Added HtmlArmor.

Bug:T191546
Change-Id: I16de28f829953eb8d1e028e600ca53f583e64e67
(cherry picked from commit 1f292fb405)
This commit is contained in:
Cindy Cicalese 2018-05-01 21:25:36 +00:00 committed by Cicalese
parent 0ce87f0aa1
commit e2502bffc9

View file

@ -1,6 +1,6 @@
<?php
use MediaWiki\MediaWikiServices;
use \MediaWiki\MediaWikiServices;
class ReplaceTextUtils {
@ -11,8 +11,11 @@ class ReplaceTextUtils {
* @return string HTML for link
*/
public static function link( Title $title, $text = null ) {
if ( method_exists( 'MediaWikiServices', 'getLinkRenderer' ) ) {
if ( method_exists( '\MediaWiki\MediaWikiServices', 'getLinkRenderer' ) ) {
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( class_exists( 'HtmlArmor' ) && !is_null( $text ) ) {
$text = new HtmlArmor( $text );
}
return $linkRenderer->makeLink( $title, $text );
};
return Linker::link( $title, $text );