$ret = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $text );
// Strip tags and decode.
- $ret = html_entity_decode( strip_tags( $ret ), ENT_QUOTES | ENT_HTML5 );
+ $ret = Sanitizer::stripAllTags( $ret );
return $ret;
}
// customizations, and make a basic attempt to turn markup into text.
$msg = $this->getMessageObject()->inLanguage( 'en' )->useDatabase( false )->text();
$msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
- $msg = html_entity_decode( strip_tags( $msg ), ENT_QUOTES | ENT_HTML5 );
+ $msg = Sanitizer::stripAllTags( $msg );
parent::__construct( $msg, $code, $previous );
}
$text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 <$1>', $text );
- return html_entity_decode( strip_tags( $text ), ENT_QUOTES );
+ return Sanitizer::stripAllTags( $text );
}
/**
* @return Array Tag data
*/
protected function buildChangeTagList() {
- function stripAllHtml( $input ) {
- return trim( html_entity_decode( strip_tags( $input ) ) );
- }
-
$explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
$softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
$tagStats = ChangeTags::tagUsageStatistics();
$result[] = [
'name' => $tagName,
- 'label' => stripAllHtml( ChangeTags::tagDescription( $tagName, $this->getContext() ) ),
- 'description' => $desc ? stripAllHtml( $desc->parse() ) : '',
+ 'label' => Sanitizer::stripAllTags(
+ ChangeTags::tagDescription( $tagName, $this->getContext() )
+ ),
+ 'description' => $desc ? Sanitizer::stripAllTags( $desc->parse() ) : '',
'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ),
'hits' => $hits,
];