Merge "(bug 38556) Add header and footer messages to MediaWiki's info action"
[lhc/web/wiklou.git] / includes / Linker.php
index fe2650b..7aba444 100644 (file)
@@ -536,6 +536,7 @@ class Linker {
         *          valign          Vertical alignment (baseline, sub, super, top, text-top, middle,
         *                          bottom, text-bottom)
         *          alt             Alternate text for image (i.e. alt attribute). Plain text.
+        *          class           HTML for image classes. Plain text.
         *          caption         HTML for image caption.
         *          link-url        URL to link to
         *          link-title      Title object to link to
@@ -580,6 +581,9 @@ class Linker {
                if ( !isset( $fp['title'] ) ) {
                        $fp['title'] = '';
                }
+               if ( !isset( $fp['class'] ) ) {
+                       $fp['class'] = '';
+               }
 
                $prefix = $postfix = '';
 
@@ -663,8 +667,11 @@ class Linker {
                        $params = array(
                                'alt' => $fp['alt'],
                                'title' => $fp['title'],
-                               'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false ,
-                               'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false );
+                               'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false,
+                               'img-class' => $fp['class'] );
+                       if ( isset( $fp['border'] ) ) {
+                               $params['img-class'] .= ( $params['img-class'] !== '' ) ? ' thumbborder' : 'thumbborder';
+                       }
                        $params = self::getImageLinkMTOParams( $fp, $query, $parser ) + $params;
 
                        $s = $thumb->toHtml( $params );
@@ -831,7 +838,8 @@ class Linker {
                        $params = array(
                                'alt' => $fp['alt'],
                                'title' => $fp['title'],
-                               'img-class' => 'thumbimage' );
+                               'img-class' => ( isset( $fp['class'] ) && $fp['class'] !== '' ) ? $fp['class'] . ' thumbimage' : 'thumbimage'
+                       );
                        $params = self::getImageLinkMTOParams( $fp, $query ) + $params;
                        $s .= $thumb->toHtml( $params );
                        if ( isset( $fp['framed'] ) ) {
@@ -1582,11 +1590,13 @@ class Linker {
         * Wraps the TOC in a table and provides the hide/collapse javascript.
         *
         * @param $toc String: html of the Table Of Contents
-        * @param $lang mixed: Language code for the toc title
+        * @param $lang String|Language|false: Language for the toc title, defaults to user language
         * @return String: full html of the TOC
         */
        public static function tocList( $toc, $lang = false ) {
+               $lang = wfGetLangObj( $lang );
                $title = wfMessage( 'toc' )->inLanguage( $lang )->escaped();
+
                return
                   '<table id="toc" class="toc"><tr><td>'
                 . '<div id="toctitle"><h2>' . $title . "</h2></div>\n"
@@ -1853,7 +1863,6 @@ class Linker {
         * @return String: HTML output
         */
        public static function formatHiddenCategories( $hiddencats ) {
-               global $wgLang;
                wfProfileIn( __METHOD__ );
 
                $outText = '';