Merge "Add attributes parameter to ShowSearchHitTitle"
[lhc/web/wiklou.git] / includes / page / ImagePage.php
index d37700b..639cbd0 100644 (file)
@@ -254,15 +254,16 @@ class ImagePage extends Article {
                $r .= "<table id=\"mw_metadata\" class=\"mw_metadata\">\n";
                foreach ( $metadata as $type => $stuff ) {
                        foreach ( $stuff as $v ) {
-                               # @todo FIXME: Why is this using escapeId for a class?!
-                               $class = Sanitizer::escapeId( $v['id'] );
+                               $class = str_replace( ' ', '_', $v['id'] );
                                if ( $type == 'collapsed' ) {
                                        // Handled by mediawiki.action.view.metadata module.
                                        $class .= ' collapsable';
                                }
-                               $r .= "<tr class=\"$class\">\n";
-                               $r .= "<th>{$v['name']}</th>\n";
-                               $r .= "<td>{$v['value']}</td>\n</tr>";
+                               $r .= Html::rawElement( 'tr',
+                                       [ 'class' => $class ],
+                                       Html::rawElement( 'th', [], $v['name'] )
+                                               . Html::rawElement( 'td', [], $v['value'] )
+                               );
                        }
                }
                $r .= "</table>\n</div>\n";
@@ -620,8 +621,8 @@ EOT
        /**
         * Make the text under the image to say what size preview
         *
-        * @param $params array parameters for thumbnail
-        * @param $sizeLinkBigImagePreview HTML for the current size
+        * @param array $params parameters for thumbnail
+        * @param string $sizeLinkBigImagePreview HTML for the current size
         * @return string HTML output
         */
        private function getThumbPrevText( $params, $sizeLinkBigImagePreview ) {
@@ -962,7 +963,7 @@ EOT
                                $fromSrc = $this->getContext()->msg(
                                        'shared-repo-from',
                                        $file->getRepo()->getDisplayName()
-                               )->text();
+                               )->escaped();
                        }
                        $out->addHTML( "<li>{$link} {$fromSrc}</li>\n" );
                }
@@ -1053,8 +1054,8 @@ EOT
        protected function doRenderLangOpt( array $langChoices, $curLang, $defaultLang ) {
                global $wgScript;
                sort( $langChoices );
-               $curLang = wfBCP47( $curLang );
-               $defaultLang = wfBCP47( $defaultLang );
+               $curLang = LanguageCode::bcp47( $curLang );
+               $defaultLang = LanguageCode::bcp47( $defaultLang );
                $opts = '';
                $haveCurrentLang = false;
                $haveDefaultLang = false;
@@ -1066,7 +1067,7 @@ EOT
                // include a choice for that. Last of all, if we're viewing
                // the file in a language not on the list, add it as a choice.
                foreach ( $langChoices as $lang ) {
-                       $code = wfBCP47( $lang );
+                       $code = LanguageCode::bcp47( $lang );
                        $name = Language::fetchLanguageName( $code, $this->getContext()->getLanguage()->getCode() );
                        if ( $name !== '' ) {
                                $display = $this->getContext()->msg( 'img-lang-opt', $code, $name )->text();