* Fixed $wgProfileToDatabase/$wgProfileCallTree interaction (later disabled the former)
[lhc/web/wiklou.git] / includes / Skin.php
index 0c45f49..a543023 100644 (file)
@@ -176,14 +176,18 @@ class Skin extends Linker {
 
                wfProfileIn( __METHOD__ );
 
-               if( false !== $wgFavicon ) {
-                       $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
-               }
-
+               # Generally the order of the favicon and apple-touch-icon links
+               # should not matter, but Konqueror (3.5.9 at least) incorrectly
+               # uses whichever one appears later in the HTML source.  Make sure
+               # apple-touch-icon is specified first to avoid this.
                if( false !== $wgAppleTouchIcon ) {
                        $out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
                }
 
+               if( false !== $wgFavicon ) {
+                       $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
+               }
+
                # OpenSearch description link
                $out->addLink( array(
                        'rel' => 'search',
@@ -337,6 +341,18 @@ class Skin extends Linker {
 
                $ns = $wgTitle->getNamespace();
                $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
+               $separatorTransTable = $wgContLang->separatorTransformTable();
+               $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
+               $compactSeparatorTransTable = array(
+                       implode( "\t", array_keys( $separatorTransTable ) ),
+                       implode( "\t", $separatorTransTable ),
+               );
+               $digitTransTable = $wgContLang->digitTransformTable();
+               $digitTransTable = $digitTransTable ? $digitTransTable : array();
+               $compactDigitTransTable = array(
+                       implode( "\t", array_keys( $digitTransTable ) ),
+                       implode( "\t", $digitTransTable ),
+               );
 
                $vars = array(
                        'skin' => $data['skinname'],
@@ -364,6 +380,8 @@ class Skin extends Linker {
                        'wgVersion' => $wgVersion,
                        'wgEnableAPI' => $wgEnableAPI,
                        'wgEnableWriteAPI' => $wgEnableWriteAPI,
+                       'wgSeparatorTransformTable' => $compactSeparatorTransTable,
+                       'wgDigitTransformTable' => $compactDigitTransTable,
                );
                
                if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false )){
@@ -551,12 +569,6 @@ END;
                        'action' => 'raw',
                        'maxage' => $wgSquidMaxage,
                );
-               if( $wgUser->isLoggedIn() ) {
-                       // Ensure that logged-in users' generated CSS isn't clobbered
-                       // by anons' publicly cacheable generated CSS.
-                       $siteargs['smaxage'] = '0';
-                       $siteargs['ts'] = $wgUser->mTouched;
-               }
 
                // Add any extension CSS
                foreach( $out->getExtStyle() as $tag ) {
@@ -573,14 +585,20 @@ END;
                                'smaxage' => $wgSquidMaxage
                        ) + $siteargs );
                        # Site settings must override extension css! (bug 15025)
-                       $out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI) );
-                       $out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI), "print" );
+                       $out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) );
+                       $out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI ), 'print' );
                        if( $wgHandheldStyle ) {
-                               $out->addStyle( self::makeNSUrl( 'Handheld.css', $query, NS_MEDIAWIKI), "handheld" );
+                               $out->addStyle( self::makeNSUrl( 'Handheld.css', $query, NS_MEDIAWIKI ), 'handheld' );
                        }
                        $out->addStyle( self::makeNSUrl( $this->getSkinName() . '.css', $query, NS_MEDIAWIKI ) );
                }
 
+               if( $wgUser->isLoggedIn() ) {
+                       // Ensure that logged-in users' generated CSS isn't clobbered
+                       // by anons' publicly cacheable generated CSS.
+                       $siteargs['smaxage'] = '0';
+                       $siteargs['ts'] = $wgUser->mTouched;
+               }
                // Per-user styles based on preferences
                $siteargs['gen'] = 'css';
                if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) {
@@ -597,8 +615,8 @@ END;
                                // @FIXME: properly escape the cdata!
                                $this->usercss = "/*<![CDATA[*/\n" . $previewCss . "/*]]>*/";
                        } else {
-                               $out->addStyle( self::makeUrl($this->userpage .'/'.$this->getSkinName() .'.css',
-                                       'action=raw&ctype=text/css') );
+                               $out->addStyle( self::makeUrl($this->userpage . '/' . $this->getSkinName() .'.css',
+                                       'action=raw&ctype=text/css' ) );
                        }
                }
 
@@ -628,7 +646,7 @@ END;
                if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
                  $wgTitle->quickUserCan( 'edit' ) ) {
                        $s = $wgTitle->getFullURL( $this->editUrlOptions() );
-                       $s = 'document.location = "' .wfEscapeJSString( $s ) .'";';
+                       $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
                        $a += array ('ondblclick' => $s);
 
                }
@@ -871,13 +889,28 @@ END;
                return $data;
        }
 
+       /**
+        * Generate debug data HTML for displaying at the bottom of the main content
+        * area.
+        * @return String HTML containing debug data, if enabled (otherwise empty).
+        */
+       protected function generateDebugHTML() {
+               global $wgShowDebug, $wgOut;
+               if ( $wgShowDebug ) {
+                       $listInternals = str_replace( "\n", "</li>\n<li>", htmlspecialchars( $wgOut->mDebugtext ) );
+                       return "\n<hr>\n<strong>Debug data:</strong><ul style=\"font-family:monospace;\"><li>" .
+                               $listInternals . "</li></ul>\n";
+               }
+               return '';
+       }
+
        /**
         * This gets called shortly before the </body> tag.
         * @return String HTML to be put before </body>
         */
        function afterContent() {
                $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
-               return $printfooter . $this->doAfterContent();
+               return $printfooter . $this->generateDebugHTML() . $this->doAfterContent();
        }
 
        /**
@@ -907,35 +940,35 @@ END;
        function doAfterContent() { return "</div></div>"; }
 
        function pageTitleLinks() {
-               global $wgOut, $wgTitle, $wgUser, $wgRequest;
+               global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
 
                $oldid = $wgRequest->getVal( 'oldid' );
                $diff = $wgRequest->getVal( 'diff' );
                $action = $wgRequest->getText( 'action' );
 
-               $s = $this->printableLink();
+               $s[] = $this->printableLink();
                $disclaimer = $this->disclaimerLink(); # may be empty
                if( $disclaimer ) {
-                       $s .= ' | ' . $disclaimer;
+                       $s[] = $disclaimer;
                }
                $privacy = $this->privacyLink(); # may be empty too
                if( $privacy ) {
-                       $s .= ' | ' . $privacy;
+                       $s[] = $privacy;
                }
 
                if ( $wgOut->isArticleRelated() ) {
-                       if ( $wgTitle->getNamespace() == NS_IMAGE ) {
+                       if ( $wgTitle->getNamespace() == NS_FILE ) {
                                $name = $wgTitle->getDBkey();
                                $image = wfFindFile( $wgTitle );
                                if( $image ) {
                                        $link = htmlspecialchars( $image->getURL() );
                                        $style = $this->getInternalLinkAttributes( $link, $name );
-                                       $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
+                                       $s[] = "<a href=\"{$link}\"{$style}>{$name}</a>";
                                }
                        }
                }
                if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
-                       $s .= ' | ' . $this->makeKnownLinkObj( $wgTitle,
+                       $s[] .= $this->makeKnownLinkObj( $wgTitle,
                                        wfMsg( 'currentrev' ) );
                }
 
@@ -945,7 +978,7 @@ END;
                        if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
                                $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
                                $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
-                               $s.= ' | <strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
+                               $s[] = '<strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
                                # disable caching
                                $wgOut->setSquidMaxage(0);
                                $wgOut->enableClientCache(false);
@@ -954,9 +987,9 @@ END;
 
                $undelete = $this->getUndeleteLink();
                if( !empty( $undelete ) ) {
-                       $s .= ' | '.$undelete;
+                       $s[] = $undelete;
                }
-               return $s;
+               return $wgLang->pipeList( $s );
        }
 
        function getUndeleteLink() {
@@ -979,23 +1012,24 @@ END;
        }
 
        function printableLink() {
-               global $wgOut, $wgFeedClasses, $wgRequest;
+               global $wgOut, $wgFeedClasses, $wgRequest, $wgLang;
 
                $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
 
-               $s = "<a href=\"$printurl\">" . wfMsg( 'printableversion' ) . '</a>';
+               $s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
                if( $wgOut->isSyndicated() ) {
                        foreach( $wgFeedClasses as $format => $class ) {
                                $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
-                               $s .= " | <a href=\"$feedurl\">{$format}</a>";
+                               $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
+                                               . " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
                        }
                }
-               return $s;
+               return $wgLang->pipeList( $s );
        }
 
        function pageTitle() {
                global $wgOut;
-               $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>';
+               $s = '<h1 class="pagetitle">' . $wgOut->getPageTitle() . '</h1>';
                return $s;
        }
 
@@ -1005,7 +1039,7 @@ END;
                $sub = $wgOut->getSubtitle();
                if ( '' == $sub ) {
                        global $wgExtraSubtitle;
-                       $sub = wfMsg( 'tagline' ) . $wgExtraSubtitle;
+                       $sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle;
                }
                $subpages = $this->subPageSubtitle();
                $sub .= !empty($subpages)?"</p><p class='subpages'>$subpages":'';
@@ -1035,7 +1069,7 @@ END;
                                                $getlink = $this->makeKnownLinkObj( $linkObj, htmlspecialchars( $display ) );
                                                $c++;
                                                if ($c>1) {
-                                                       $subpages .= ' | ';
+                                                       $subpages .= wfMsgExt( 'pipe-separator' , 'escapenoentities' );
                                                } else  {
                                                        $subpages .= '&lt; ';
                                                }
@@ -1098,16 +1132,21 @@ END;
                        $ret .= $this->link( $wgUser->getUserPage(),
                                htmlspecialchars( $wgUser->getName() ) );
                        $ret .= " ($talkLink)<br />";
-                       $ret .= $this->link(
-                               SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
-                               array(), array( 'returnto' => $returnTo )
-                       );
-                       $ret .= ' | ' . $this->specialLink( 'preferences' );
-               }
-               $ret .= ' | ' . $this->link(
-                       Title::newFromText( wfMsgForContent( 'helppage' ) ),
-                       wfMsg( 'help' )
-               );
+                       $ret .= $wgLang->pipeList( array(
+                               $this->link(
+                                       SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
+                                       array(), array( 'returnto' => $returnTo )
+                               ),
+                               $this->specialLink( 'preferences' ),
+                       ) );
+               }
+               $ret = $wgLang->pipeList( array(
+                       $ret,
+                       $this->link(
+                               Title::newFromText( wfMsgForContent( 'helppage' ) ),
+                               wfMsg( 'help' )
+                       ),
+               ) );
 
                return $ret;
        }
@@ -1122,16 +1161,22 @@ END;
        }
 
        function searchForm() {
-               global $wgRequest;
+               global $wgRequest, $wgUseTwoButtonsSearchForm;
                $search = $wgRequest->getText( 'search' );
 
                $s = '<form id="searchform'.$this->searchboxes.'" name="search" class="inline" method="post" action="'
                  . $this->escapeSearchLink() . "\">\n"
                  . '<input type="text" id="searchInput'.$this->searchboxes.'" name="search" size="19" value="'
                  . htmlspecialchars(substr($search,0,256)) . "\" />\n"
-                 . '<input type="submit" name="go" value="' . wfMsg ('searcharticle') . '" />&nbsp;'
-                 . '<input type="submit" name="fulltext" value="' . wfMsg ('searchbutton') . "\" />\n</form>";
-
+                 . '<input type="submit" name="go" value="' . wfMsg ('searcharticle') . '" />';
+               
+               if ($wgUseTwoButtonsSearchForm)
+                       $s .= '&nbsp;<input type="submit" name="fulltext" value="' . wfMsg ('searchbutton') . "\" />\n";
+               else
+                       $s .= ' <a href="' . $this->escapeSearchLink() . '" rel="search">' . wfMsg ('powersearch-legend') . "</a>\n";
+               
+               $s .= '</form>';
+               
                // Ensure unique id's for search boxes made after the first
                $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
                
@@ -1140,23 +1185,29 @@ END;
 
        function topLinks() {
                global $wgOut;
-               $sep = " |\n";
 
-               $s = $this->mainPageLink() . $sep
-                 . $this->specialLink( 'recentchanges' );
+               $s = array(
+                       $this->mainPageLink(),
+                       $this->specialLink( 'recentchanges' )
+               );
 
                if ( $wgOut->isArticleRelated() ) {
-                       $s .=  $sep . $this->editThisPage()
-                         . $sep . $this->historyLink();
+                       $s[] = $this->editThisPage();
+                       $s[] = $this->historyLink();
                }
                # Many people don't like this dropdown box
-               #$s .= $sep . $this->specialPagesList();
+               #$s[] = $this->specialPagesList();
 
-               $s .= $this->variantLinks();
+               if( $this->variantLinks() ) {
+                       $s[] = $this->variantLinks();
+               }
 
-               $s .= $this->extensionTabLinks();
+               if( $this->extensionTabLinks() ) {
+                       $s[] = $this->extensionTabLinks();
+               }
 
-               return $s;
+               // FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
+               return implode( $s, wfMsgExt( 'pipe-separator' , 'escapenoentities' ) . "\n" );
        }
 
        /**
@@ -1167,14 +1218,23 @@ END;
         */
        function extensionTabLinks() {
                $tabs = array();
-               $s = '';
+               $out = '';
+               $s = array();
                wfRunHooks( 'SkinTemplateTabs', array( $this, &$tabs ) );
                foreach( $tabs as $tab ) {
-                       $s .= ' | ' . Xml::element( 'a',
+                       $s[] = Xml::element( 'a',
                                array( 'href' => $tab['href'] ),
                                $tab['text'] );
                }
-               return $s;
+
+               if( count( $s ) ) {
+                       global $wgLang;
+
+                       $out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
+                       $out .= $wgLang->pipeList( $s );
+               }
+
+               return $out;
        }
 
        /**
@@ -1184,14 +1244,14 @@ END;
        function variantLinks() {
                $s = '';
                /* show links to different language variants */
-               global $wgDisableLangConversion, $wgContLang, $wgTitle;
+               global $wgDisableLangConversion, $wgLang, $wgContLang, $wgTitle;
                $variants = $wgContLang->getVariants();
                if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
                        foreach( $variants as $code ) {
                                $varname = $wgContLang->getVariantname( $code );
                                if( $varname == 'disable' )
                                        continue;
-                               $s .= ' | <a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>';
+                               $s = $wgLang->pipeList( array( $s, '<a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>' ) );
                        }
                }
                return $s;
@@ -1199,21 +1259,21 @@ END;
 
        function bottomLinks() {
                global $wgOut, $wgUser, $wgTitle, $wgUseTrackbacks;
-               $sep = " |\n";
+               $sep = wfMsgExt( 'pipe-separator' , 'escapenoentities' ) . "\n";
 
                $s = '';
                if ( $wgOut->isArticleRelated() ) {
-                       $s .= '<strong>' . $this->editThisPage() . '</strong>';
+                       $element[] = '<strong>' . $this->editThisPage() . '</strong>';
                        if ( $wgUser->isLoggedIn() ) {
-                               $s .= $sep . $this->watchThisPage();
+                               $element[] = $this->watchThisPage();
                        }
-                       $s .= $sep . $this->talkLink()
-                         . $sep . $this->historyLink()
-                         . $sep . $this->whatLinksHere()
-                         . $sep . $this->watchPageLinksLink();
+                       $element[] = $this->talkLink();
+                       $element[] = $this->historyLink();
+                       $element[] = $this->whatLinksHere();
+                       $element[] = $this->watchPageLinksLink();
 
                        if ($wgUseTrackbacks)
-                               $s .= $sep . $this->trackbackLink();
+                               $element[] = $this->trackbackLink();
 
                        if ( $wgTitle->getNamespace() == NS_USER
                            || $wgTitle->getNamespace() == NS_USER_TALK )
@@ -1223,12 +1283,15 @@ END;
                                $ip=User::isIP($wgTitle->getText());
 
                                if($id || $ip) { # both anons and non-anons have contri list
-                                       $s .= $sep . $this->userContribsLink();
+                                       $element[] = $this->userContribsLink();
                                }
                                if( $this->showEmailUser( $id ) ) {
-                                       $s .= $sep . $this->emailUserLink();
+                                       $element[] = $this->emailUserLink();
                                }
                        }
+                       
+                       $s = implode( $element, $sep );
+
                        if ( $wgTitle->getArticleId() ) {
                                $s .= "\n<br />";
                                if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); }
@@ -1237,6 +1300,7 @@ END;
                        }
                        $s .= "<br />\n" . $this->otherLanguages();
                }
+
                return $s;
        }
 
@@ -1247,6 +1311,7 @@ END;
                $oldid = $wgRequest->getVal( 'oldid' );
                $diff = $wgRequest->getVal( 'diff' );
                if ( ! $wgOut->isArticle() ) { return ''; }
+               if( !$wgArticle instanceOf Article ) { return ''; }
                if ( isset( $oldid ) || isset( $diff ) ) { return ''; }
                if ( 0 == $wgArticle->getID() ) { return ''; }
 
@@ -1282,13 +1347,12 @@ END;
        }
 
        function getCopyright( $type = 'detect' ) {
-               global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest;
+               global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest, $wgArticle;
 
                if ( $type == 'detect' ) {
-                       $oldid = $wgRequest->getVal( 'oldid' );
                        $diff = $wgRequest->getVal( 'diff' );
-
-                       if ( !is_null( $oldid ) && is_null( $diff ) && wfMsgForContent( 'history_copyright' ) !== '-' ) {
+                       $isCur = $wgArticle && $wgArticle->isCurrent();
+                       if ( is_null( $diff ) && !$isCur && wfMsgForContent( 'history_copyright' ) !== '-' ) {
                                $type = 'history';
                        } else {
                                $type = 'normal';
@@ -1346,7 +1410,7 @@ END;
        function lastModified() {
                global $wgLang, $wgArticle;
                if( $this->mRevisionId ) {
-                       $timestamp = Revision::getTimestampFromId( $this->mRevisionId, $wgArticle->getId() );
+                       $timestamp = Revision::getTimestampFromId( $wgArticle->getTitle(), $this->mRevisionId );
                } else {
                        $timestamp = $wgArticle->getTimestamp();
                }
@@ -1390,7 +1454,7 @@ END;
                $sp = wfMsg( 'specialpages' );
                $spp = $wgContLang->specialPage( 'Specialpages' );
 
-               $s = '<form id="specialpages" method="get" class="inline" ' .
+               $s = '<form id="specialpages" method="get" ' .
                  'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
                $s .= "<select name=\"wpDropdown\">\n";
                $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
@@ -1548,8 +1612,8 @@ END;
        function historyLink() {
                global $wgTitle;
 
-               return $this->makeKnownLinkObj( $wgTitle,
-                 wfMsg( 'history' ), 'action=history' );
+               return $this->link( $wgTitle, wfMsg( 'history' ),
+                       array( 'rel' => 'archives' ), array( 'action' => 'history' ) );
        }
 
        function whatLinksHere() {
@@ -1569,14 +1633,10 @@ END;
        }
 
        function showEmailUser( $id ) {
-               global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
-               return $wgEnableEmail &&
-                      $wgEnableUserEmail &&
-                      $wgUser->isLoggedIn() && # show only to signed in users
-                      0 != $id; # we can only email to non-anons ..
-#                     '' != $id->getEmail() && # who must have an email address stored ..
-#                     0 != $id->getEmailauthenticationtimestamp() && # .. which is authenticated
-#                     1 != $wgUser->getOption('disablemail'); # and not disabled
+               global $wgUser;
+               $targetUser = User::newFromId( $id );
+               return  $wgUser->canSendEmail() && # the sending user must have a confirmed email address
+                       $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
        }
 
        function emailUserLink() {
@@ -1618,11 +1678,11 @@ END;
                        return '';
                }
 
-               $s = wfMsg( 'otherlanguages' ) . ': ';
+               $s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' );
                $first = true;
                if($wgContLang->isRTL()) $s .= '<span dir="LTR">';
                foreach( $a as $l ) {
-                       if ( ! $first ) { $s .= ' | '; }
+                       if ( ! $first ) { $s .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); }
                        $first = false;
 
                        $nt = Title::newFromText( $l );
@@ -1637,12 +1697,6 @@ END;
                return $s;
        }
 
-       function bugReportsLink() {
-               $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
-                 wfMsg( 'bugreports' ) );
-               return $s;
-       }
-
        function talkLink() {
                global $wgTitle;
 
@@ -1665,7 +1719,7 @@ END;
                                case NS_PROJECT:
                                        $text = wfMsg( 'projectpage' );
                                        break;
-                               case NS_IMAGE:
+                               case NS_FILE:
                                        $text = wfMsg( 'imagepage' );
                                        # Make link known if image exists, even if the desc. page doesn't.
                                        if( wfFindFile( $link ) )
@@ -1831,7 +1885,9 @@ END;
                                        $link = wfMsgForContent( $line[0] );
                                        if ($link == '-')
                                                continue;
-                                       if (wfEmptyMsg($line[1], $text = wfMsg($line[1])))
+
+                                       $text = wfMsgExt($line[1], 'parsemag');
+                                       if (wfEmptyMsg($line[1], $text))
                                                $text = $line[1];
                                        if (wfEmptyMsg($line[0], $link))
                                                $link = $line[0];