mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-12-18 17:23:11 +00:00
Added HtmlArmor.
Bug:T191546
Change-Id: I16de28f829953eb8d1e028e600ca53f583e64e67
(cherry picked from commit 1f292fb405
)
This commit is contained in:
parent
0ce87f0aa1
commit
e2502bffc9
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue