Merge "Autodiscover parser tests for extensions, deprecate $wgParserTestFiles"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 8 Jul 2017 01:01:15 +0000 (01:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 8 Jul 2017 01:01:15 +0000 (01:01 +0000)
includes/api/ApiErrorFormatter.php
includes/exception/LocalizedException.php
includes/installer/CliInstaller.php
includes/specials/SpecialRecentchanges.php

index 5484a78..7fb1352 100644 (file)
@@ -254,7 +254,7 @@ class ApiErrorFormatter {
                $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;
        }
index cbdb53e..d2cb5d1 100644 (file)
@@ -56,7 +56,7 @@ class LocalizedException extends Exception implements ILocalizedException {
                // 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 );
        }
 
index 661c3ec..af55dbb 100644 (file)
@@ -180,7 +180,7 @@ class CliInstaller extends Installer {
 
                $text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 &lt;$1&gt;', $text );
 
-               return html_entity_decode( strip_tags( $text ), ENT_QUOTES );
+               return Sanitizer::stripAllTags( $text );
        }
 
        /**
index 05bcc4d..4f21586 100644 (file)
@@ -203,10 +203,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
         * @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();
@@ -229,8 +225,10 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
 
                                $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,
                                ];