* Use local context to get messages
[lhc/web/wiklou.git] / includes / Linker.php
index e37bbb3..918bebc 100644 (file)
@@ -12,6 +12,7 @@ class Linker {
         * Flags for userToolLinks()
         */
        const TOOL_LINKS_NOBLOCK = 1;
+       const TOOL_LINKS_EMAIL   = 2;
 
        /**
         * Get the appropriate HTML attributes to add to the "a" element of an ex-
@@ -19,10 +20,11 @@ class Linker {
         *
         * @param $class String: the contents of the class attribute; if an empty
         *   string is passed, which is the default value, defaults to 'external'.
+        * @return string
         * @deprecated since 1.18 Just pass the external class directly to something using Html::expandAttributes
         */
        static function getExternalLinkAttributes( $class = 'external' ) {
-               wfDeprecated( __METHOD__ );
+               wfDeprecated( __METHOD__, '1.18' );
                return self::getLinkAttributesInternal( '', $class );
        }
 
@@ -35,6 +37,7 @@ class Linker {
         * @param $unused String: unused
         * @param $class String: the contents of the class attribute; if an empty
         *   string is passed, which is the default value, defaults to 'external'.
+        * @return string
         */
        static function getInterwikiLinkAttributes( $title, $unused = null, $class = 'external' ) {
                global $wgContLang;
@@ -56,6 +59,7 @@ class Linker {
         *   not HTML-escaped
         * @param $unused String: unused
         * @param $class String: the contents of the class attribute, default none
+        * @return string
         */
        static function getInternalLinkAttributes( $title, $unused = null, $class = '' ) {
                $title = urldecode( $title );
@@ -72,6 +76,7 @@ class Linker {
         * @param $class String: the contents of the class attribute, default none
         * @param $title Mixed: optional (unescaped) string to use in the title
         *   attribute; if false, default to the name of the page we're linking to
+        * @return string
         */
        static function getInternalLinkAttributesObj( $nt, $unused = null, $class = '', $title = false ) {
                if ( $title === false ) {
@@ -108,7 +113,7 @@ class Linker {
         * @param $threshold Integer: user defined threshold
         * @return String: CSS class
         */
-       static function getLinkColour( $t, $threshold ) {
+       public static function getLinkColour( $t, $threshold ) {
                $colour = '';
                if ( $t->isRedirect() ) {
                        # Page is a redirect
@@ -134,6 +139,11 @@ class Linker {
         *      name of the target).
         * link() replaces the old functions in the makeLink() family.
         *
+        * @since 1.18 Method exists since 1.16 as non-static, made static in 1.18.
+        * You can call it using this if you want to keep compat with these:
+        * $linker = class_exists( 'DummyLinker' ) ? new DummyLinker() : new Linker();
+        * $linker->link( ... );
+        *
         * @param $target        Title  Can currently only be a Title, but this may
         *   change to support Images, literal URLs, etc.
         * @param $html          string The HTML contents of the <a> element, i.e.,
@@ -223,6 +233,7 @@ class Linker {
 
        /**
         * Identical to link(), except $options defaults to 'known'.
+        * @return string
         */
        public static function linkKnown(
                $target, $html = null, $customAttribs = array(),
@@ -235,6 +246,9 @@ class Linker {
         * Returns the Url used to link to a Title
         *
         * @param $target Title
+        * @param $query Array: query parameters
+        * @param $options Array
+        * @return String
         */
        private static function linkUrl( $target, $query, $options ) {
                wfProfileIn( __METHOD__ );
@@ -249,11 +263,11 @@ class Linker {
                # there's already an action specified, or unless 'edit' makes no sense
                # (i.e., for a nonexistent special page).
                if ( in_array( 'broken', $options ) && empty( $query['action'] )
-                       && $target->getNamespace() != NS_SPECIAL ) {
+                       && !$target->isSpecialPage() ) {
                        $query['action'] = 'edit';
                        $query['redlink'] = '1';
                }
-               $ret = $target->getLinkUrl( $query );
+               $ret = $target->getLinkURL( $query );
                wfProfileOut( __METHOD__ );
                return $ret;
        }
@@ -358,7 +372,7 @@ class Linker {
         */
        static function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                global $wgUser;
-               wfDeprecated( __METHOD__ );
+               wfDeprecated( __METHOD__, '1.17' );
 
                $threshold = $wgUser->getStubThreshold();
                $colour = ( $size < $threshold ) ? 'stub' : '';
@@ -375,7 +389,7 @@ class Linker {
         *
         * @return string
         */
-       static function makeSelfLinkObj( $nt, $html = '', $query = '', $trail = '', $prefix = '' ) {
+       public static function makeSelfLinkObj( $nt, $html = '', $query = '', $trail = '', $prefix = '' ) {
                if ( $html == '' ) {
                        $html = htmlspecialchars( $nt->getPrefixedText() );
                }
@@ -388,7 +402,7 @@ class Linker {
         * @return Title
         */
        static function normaliseSpecialPage( Title $title ) {
-               if ( $title->getNamespace() == NS_SPECIAL ) {
+               if ( $title->isSpecialPage() ) {
                        list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
                        if ( !$name ) {
                                return $title;
@@ -409,7 +423,7 @@ class Linker {
         *
         * @return string
         */
-       static function fnamePart( $url ) {
+       private static function fnamePart( $url ) {
                $basename = strrchr( $url, '/' );
                if ( false === $basename ) {
                        $basename = $url;
@@ -428,7 +442,7 @@ class Linker {
         *
         * @return string
         */
-       static function makeExternalImage( $url, $alt = '' ) {
+       public static function makeExternalImage( $url, $alt = '' ) {
                if ( $alt == '' ) {
                        $alt = self::fnamePart( $url );
                }
@@ -477,7 +491,7 @@ class Linker {
         * @param $widthOption: Used by the parser to remember the user preference thumbnailsize
         * @return String: HTML for an image, with links, wrappers, etc.
         */
-       static function makeImageLink2( Title $title, $file, $frameParams = array(),
+       public static function makeImageLink2( Title $title, $file, $frameParams = array(),
                $handlerParams = array(), $time = false, $query = "", $widthOption = null )
        {
                $res = null;
@@ -601,10 +615,11 @@ class Linker {
        /**
         * Get the link parameters for MediaTransformOutput::toHtml() from given
         * frame parameters supplied by the Parser.
-        * @param $frameParams The frame parameters
-        * @param $query An optional query string to add to description page links
+        * @param $frameParams array The frame parameters
+        * @param $query string An optional query string to add to description page links
+        * @return array
         */
-       static function getImageLinkMTOParams( $frameParams, $query = '' ) {
+       private static function getImageLinkMTOParams( $frameParams, $query = '' ) {
                $mtoParams = array();
                if ( isset( $frameParams['link-url'] ) && $frameParams['link-url'] !== '' ) {
                        $mtoParams['custom-url-link'] = $frameParams['link-url'];
@@ -632,8 +647,9 @@ class Linker {
         * @param $params Array
         * @param $framed Boolean
         * @param $manualthumb String
+        * @return mixed
         */
-       static function makeThumbLinkObj( Title $title, $file, $label = '', $alt,
+       public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt,
                $align = 'right', $params = array(), $framed = false , $manualthumb = "" )
        {
                $frameParams = array(
@@ -659,7 +675,7 @@ class Linker {
         * @param string $query
         * @return mixed
         */
-       static function makeThumbLink2( Title $title, $file, $frameParams = array(),
+       public static function makeThumbLink2( Title $title, $file, $frameParams = array(),
                $handlerParams = array(), $time = false, $query = "" )
        {
                global $wgStylePath, $wgContLang;
@@ -840,7 +856,7 @@ class Linker {
         * This will make a broken link if $file is false.
         *
         * @param $title Title object.
-        * @param $file File|false mixed File object or false
+        * @param $file File|bool mixed File object or false
         * @param $html String: pre-sanitized HTML
         * @return String: HTML
         *
@@ -865,11 +881,11 @@ class Linker {
        /**
         * Make a link to a special page given its name and, optionally,
         * a message key from the link text.
-        * Usage example: $skin->specialLink( 'recentchanges' )
+        * Usage example: Linker::specialLink( 'Recentchanges' )
         *
         * @return string
         */
-       static function specialLink( $name, $key = '' ) {
+       public static function specialLink( $name, $key = '' ) {
                if ( $key == '' ) {
                        $key = strtolower( $name );
                }
@@ -884,13 +900,14 @@ class Linker {
         * @param $escape Boolean: do we escape the link text?
         * @param $linktype String: type of external link. Gets added to the classes
         * @param $attribs Array of extra attributes to <a>
+        * @return string
         */
-       static function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
+       public static function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
                $class = "external";
-               if ( isset($linktype) && $linktype ) {
+               if ( $linktype ) {
                        $class .= " $linktype";
                }
-               if ( isset($attribs['class']) && $attribs['class'] ) {
+               if ( isset( $attribs['class'] ) && $attribs['class'] ) {
                        $class .= " {$attribs['class']}";
                }
                $attribs['class'] = $class;
@@ -912,17 +929,23 @@ class Linker {
        /**
         * Make user link (or user contributions for unregistered users)
         * @param $userId   Integer: user id in database.
-        * @param $userText String: user name in database
+        * @param $userName String: user name in database.
+        * @param $altUserName String: text to display instead of the user name (optional)
         * @return String: HTML fragment
-        * @private
+        * @since 1.19 Method exists for a long time. $displayText was added in 1.19.
         */
-       static function userLink( $userId, $userText ) {
+       public static function userLink( $userId, $userName, $altUserName = false ) {
                if ( $userId == 0 ) {
-                       $page = SpecialPage::getTitleFor( 'Contributions', $userText );
+                       $page = SpecialPage::getTitleFor( 'Contributions', $userName );
                } else {
-                       $page = Title::makeTitle( NS_USER, $userText );
+                       $page = Title::makeTitle( NS_USER, $userName );
                }
-               return self::link( $page, htmlspecialchars( $userText ), array( 'class' => 'mw-userlink' ) );
+
+               return self::link(
+                       $page,
+                       htmlspecialchars( $altUserName !== false ? $altUserName : $userName ),
+                       array( 'class' => 'mw-userlink' )
+               );
        }
 
        /**
@@ -932,7 +955,7 @@ class Linker {
         * @param $userText String: user name or IP address
         * @param $redContribsWhenNoEdits Boolean: should the contributions link be
         *        red if the user has no edits?
-        * @param $flags Integer: customisation flags (e.g. Linker::TOOL_LINKS_NOBLOCK)
+        * @param $flags Integer: customisation flags (e.g. Linker::TOOL_LINKS_NOBLOCK and Linker::TOOL_LINKS_EMAIL)
         * @param $edits Integer: user edit count (optional, for performance)
         * @return String: HTML fragment
         */
@@ -941,7 +964,8 @@ class Linker {
        ) {
                global $wgUser, $wgDisableAnonTalk, $wgLang;
                $talkable = !( $wgDisableAnonTalk && 0 == $userId );
-               $blockable = !$flags & self::TOOL_LINKS_NOBLOCK;
+               $blockable = !( $flags & self::TOOL_LINKS_NOBLOCK );
+               $addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId;
 
                $items = array();
                if ( $talkable ) {
@@ -964,8 +988,14 @@ class Linker {
                        $items[] = self::blockLink( $userId, $userText );
                }
 
+               if ( $addEmailLink && $wgUser->canSendEmail() ) {
+                       $items[] = self::emailLink( $userId, $userText );
+               }
+
+               wfRunHooks( 'UserToolLinksEdit', array( $userId, $userText, &$items ) );
+
                if ( $items ) {
-                       return ' <span class="mw-usertoollinks">(' . $wgLang->pipeList( $items ) . ')</span>';
+                       return ' <span class="mw-usertoollinks">' . wfMessage( 'parentheses' )->rawParams( $wgLang->pipeList( $items ) )->escaped() . '</span>';
                } else {
                        return '';
                }
@@ -976,6 +1006,7 @@ class Linker {
         * @param $userId Integer: user identifier
         * @param $userText String: user name or IP address
         * @param $edits Integer: user edit count (optional, for performance)
+        * @return String
         */
        public static function userToolLinksRedContribs( $userId, $userText, $edits = null ) {
                return self::userToolLinks( $userId, $userText, true, 0, $edits );
@@ -986,9 +1017,8 @@ class Linker {
         * @param $userId Integer: user id in database.
         * @param $userText String: user name in database.
         * @return String: HTML fragment with user talk link
-        * @private
         */
-       static function userTalkLink( $userId, $userText ) {
+       public static function userTalkLink( $userId, $userText ) {
                $userTalkPage = Title::makeTitle( NS_USER_TALK, $userText );
                $userTalkLink = self::link( $userTalkPage, wfMsgHtml( 'talkpagelinktext' ) );
                return $userTalkLink;
@@ -998,21 +1028,31 @@ class Linker {
         * @param $userId Integer: userid
         * @param $userText String: user name in database.
         * @return String: HTML fragment with block link
-        * @private
         */
-       static function blockLink( $userId, $userText ) {
+       public static function blockLink( $userId, $userText ) {
                $blockPage = SpecialPage::getTitleFor( 'Block', $userText );
                $blockLink = self::link( $blockPage, wfMsgHtml( 'blocklink' ) );
                return $blockLink;
        }
 
+       /**
+        * @param $userId Integer: userid
+        * @param $userText String: user name in database.
+        * @return String: HTML fragment with e-mail user link
+        */
+       public static function emailLink( $userId, $userText ) {
+               $emailPage = SpecialPage::getTitleFor( 'Emailuser', $userText );
+               $emailLink = self::link( $emailPage, wfMsgHtml( 'emaillink' ) );
+               return $emailLink;
+       }
+
        /**
         * Generate a user link if the current user is allowed to view it
         * @param $rev Revision object.
         * @param $isPublic Boolean: show only if all users can see it
         * @return String: HTML fragment
         */
-       static function revUserLink( $rev, $isPublic = false ) {
+       public static function revUserLink( $rev, $isPublic = false ) {
                if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
                        $link = wfMsgHtml( 'rev-deleted-user' );
                } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
@@ -1033,7 +1073,7 @@ class Linker {
         * @param $isPublic Boolean: show only if all users can see it
         * @return string HTML
         */
-       static function revUserTools( $rev, $isPublic = false ) {
+       public static function revUserTools( $rev, $isPublic = false ) {
                if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
                        $link = wfMsgHtml( 'rev-deleted-user' );
                } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
@@ -1065,8 +1105,9 @@ class Linker {
         * @param $comment String
         * @param $title Mixed: Title object (to generate link to the section in autocomment) or null
         * @param $local Boolean: whether section links should refer to local page
+        * @return mixed|String
         */
-       static function formatComment( $comment, $title = null, $local = false ) {
+       public static function formatComment( $comment, $title = null, $local = false ) {
                wfProfileIn( __METHOD__ );
 
                # Sanitize text a bit:
@@ -1096,7 +1137,7 @@ class Linker {
         * Called by Linker::formatComment.
         *
         * @param $comment String: comment text
-        * @param $title An optional title object used to links to sections
+        * @param $title Title|null An optional title object used to links to sections
         * @param $local Boolean: whether section links should refer to local page
         * @return String: formatted comment
         */
@@ -1118,6 +1159,7 @@ class Linker {
         * @return string
         */
        private static function formatAutocommentsCallback( $match ) {
+               global $wgLang;
                $title = self::$autocommentTitle;
                $local = self::$autocommentLocal;
 
@@ -1143,23 +1185,22 @@ class Linker {
                        }
                        if ( $sectionTitle ) {
                                $link = self::link( $sectionTitle,
-                                       htmlspecialchars( wfMsgForContent( 'sectionlink' ) ), array(), array(),
+                                       $wgLang->getArrow(), array(), array(),
                                        'noclasses' );
                        } else {
                                $link = '';
                        }
                }
-               $auto = "$link$auto";
                if ( $pre ) {
                        # written summary $presep autocomment (summary /* section */)
-                       $auto = wfMsgExt( 'autocomment-prefix', array( 'escapenoentities', 'content' ) ) . $auto;
+                       $pre .= wfMsgExt( 'autocomment-prefix', array( 'escapenoentities', 'content' ) );
                }
                if ( $post ) {
                        # autocomment $postsep written summary (/* section */ summary)
                        $auto .= wfMsgExt( 'colon-separator', array( 'escapenoentities', 'content' ) );
                }
                $auto = '<span class="autocomment">' . $auto . '</span>';
-               $comment = $pre . $auto . $post;
+               $comment = $pre . $link . $wgLang->getDirMark() . '<span dir="auto">' . $auto . $post . '</span>';
                return $comment;
        }
 
@@ -1175,7 +1216,7 @@ class Linker {
         *
         * @todo FIXME: Doesn't handle sub-links as in image thumb texts like the main parser
         * @param $comment String: text to format links in
-        * @param $title An optional title object used to links to sections
+        * @param $title Title|null An optional title object used to links to sections
         * @param $local Boolean: whether section links should refer to local page
         * @return String
         */
@@ -1220,7 +1261,9 @@ class Linker {
                        # Media link; trail not supported.
                        $linkRegexp = '/\[\[(.*?)\]\]/';
                        $title = Title::makeTitleSafe( NS_FILE, $submatch[1] );
-                       $thelink = self::makeMediaLinkObj( $title, $text );
+                       if ( $title ) {
+                               $thelink = self::makeMediaLinkObj( $title, $text );
+                       }
                } else {
                        # Other kind of link
                        if ( preg_match( $wgContLang->linkTrail(), $match[4], $submatch ) ) {
@@ -1266,7 +1309,7 @@ class Linker {
         * @param  $text
         * @return string
         */
-       static function normalizeSubpageLink( $contextTitle, $target, &$text ) {
+       public static function normalizeSubpageLink( $contextTitle, $target, &$text ) {
                # Valid link forms:
                # Foobar -- normal
                # :Foobar -- override special treatment of prefix (images, language links)
@@ -1291,7 +1334,7 @@ class Linker {
                        # bug 7425
                        $target = trim( $target );
                        # Look at the first character
-                       if ( $target != '' && $target { 0 } === '/' ) {
+                       if ( $target != '' && $target[0] === '/' ) {
                                # / at end means we don't want the slash to be shown
                                $m = array();
                                $trailingSlashes = preg_match_all( '%(/+)$%', $target, $m );
@@ -1348,7 +1391,7 @@ class Linker {
         *
         * @return string
         */
-       static function commentBlock( $comment, $title = null, $local = false ) {
+       public static function commentBlock( $comment, $title = null, $local = false ) {
                // '*' used to be the comment inserted by the software way back
                // in antiquity in case none was provided, here for backwards
                // compatability, acc. to brion -ævar
@@ -1356,7 +1399,8 @@ class Linker {
                        return '';
                } else {
                        $formatted = self::formatComment( $comment, $title, $local );
-                       return " <span class=\"comment\">($formatted)</span>";
+                       $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped();
+                       return " <span class=\"comment\">$formatted</span>";
                }
        }
 
@@ -1369,7 +1413,7 @@ class Linker {
         * @param $isPublic Boolean: show only if all users can see it
         * @return String: HTML fragment
         */
-       static function revComment( Revision $rev, $local = false, $isPublic = false ) {
+       public static function revComment( Revision $rev, $local = false, $isPublic = false ) {
                if ( $rev->getRawComment() == "" ) {
                        return "";
                }
@@ -1397,7 +1441,7 @@ class Linker {
                } else {
                        global $wgLang;
                        $stxt = wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $size ) );
-                       $stxt = "($stxt)";
+                       $stxt = wfMessage( 'parentheses' )->rawParams( $stxt )->escaped();
                }
                $stxt = htmlspecialchars( $stxt );
                return "<span class=\"history-size\">$stxt</span>";
@@ -1408,7 +1452,7 @@ class Linker {
         *
         * @return string
         */
-       static function tocIndent() {
+       public static function tocIndent() {
                return "\n<ul>";
        }
 
@@ -1417,7 +1461,7 @@ class Linker {
         *
         * @return string
         */
-       static function tocUnindent( $level ) {
+       public static function tocUnindent( $level ) {
                return "</li>\n" . str_repeat( "</ul>\n</li>\n", $level > 0 ? $level : 0 );
        }
 
@@ -1426,7 +1470,7 @@ class Linker {
         *
         * @return string
         */
-       static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
+       public static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
                $classes = "toclevel-$level";
                if ( $sectionIndex !== false ) {
                        $classes .= " tocsection-$sectionIndex";
@@ -1441,8 +1485,9 @@ class Linker {
         * End a Table Of Contents line.
         * tocUnindent() will be used instead if we're ending a line below
         * the new level.
+        * @return string
         */
-       static function tocLineEnd() {
+       public static function tocLineEnd() {
                return "</li>\n";
        }
 
@@ -1453,7 +1498,7 @@ class Linker {
         * @param $lang mixed: Language code for the toc title
         * @return String: full html of the TOC
         */
-       static function tocList( $toc, $lang = false ) {
+       public static function tocList( $toc, $lang = false ) {
                $title = wfMsgExt( 'toc', array( 'language' => $lang, 'escape' ) );
                return
                   '<table id="toc" class="toc"><tr><td>'
@@ -1466,7 +1511,7 @@ class Linker {
         * Generate a table of contents from a section tree
         * Currently unused.
         *
-        * @param $tree Return value of ParserOutput::getSections()
+        * @param $tree array Return value of ParserOutput::getSections()
         * @return String: HTML fragment
         */
        public static function generateTOC( $tree ) {
@@ -1519,6 +1564,7 @@ class Linker {
        /**
         * Split a link trail, return the "inside" portion and the remainder of the trail
         * as a two-element array
+        * @return array
         */
        static function splitTrail( $trail ) {
                global $wgContLang;
@@ -1546,8 +1592,9 @@ class Linker {
         * other users.
         *
         * @param $rev Revision object
+        * @return string
         */
-       static function generateRollback( $rev ) {
+       public static function generateRollback( $rev ) {
                return '<span class="mw-rollback-link">['
                        . self::buildRollbackLink( $rev )
                        . ']</span>';
@@ -1565,7 +1612,7 @@ class Linker {
                $query = array(
                        'action' => 'rollback',
                        'from' => $rev->getUserText(),
-                       'token' => $wgUser->editToken( array( $title->getPrefixedText(), $rev->getUserText() ) ),
+                       'token' => $wgUser->getEditToken( array( $title->getPrefixedText(), $rev->getUserText() ) ),
                );
                if ( $wgRequest->getBool( 'bot' ) ) {
                        $query['bot'] = '1';
@@ -1645,42 +1692,6 @@ class Linker {
                return $outText;
        }
 
-       /**
-        * Returns HTML for the "templates used on this page" list.
-        *
-        * @param $templates Array of templates from Article::getUsedTemplate
-        * or similar
-        * @param $preview Boolean: whether this is for a preview
-        * @param $section Boolean: whether this is for a section edit
-        * @return String: HTML output
-        */
-       public static function formatDistantTemplates( $templates, $preview = false, $section = false ) {
-               wfProfileIn( __METHOD__ );
-
-               $outText = '';
-               if ( count( $templates ) > 0 ) {
-
-                       # Construct the HTML
-                       $outText = '<div class="mw-templatesUsedExplanation">';
-                       if ( $preview ) {
-                               $outText .= wfMsgExt( 'distanttemplatesusedpreview', array( 'parse' ), count( $templates ) );
-                       } elseif ( $section ) {
-                               $outText .= wfMsgExt( 'distanttemplatesusedsection', array( 'parse' ), count( $templates ) );
-                       } else {
-                               $outText .= wfMsgExt( 'distanttemplatesused', array( 'parse' ), count( $templates ) );
-                       }
-                       $outText .= "</div><ul>\n";
-
-                       usort( $templates, array( 'Title', 'compare' ) );
-                       foreach ( $templates as $titleObj ) {
-                               $outText .= '<li>' . self::link( $titleObj ) . '</li>';
-                       }
-                       $outText .= '</ul>';
-               }
-               wfProfileOut( __METHOD__  );
-               return $outText;
-       }
-
        /**
         * Returns HTML for the "hidden categories on this page" list.
         *
@@ -1712,7 +1723,7 @@ class Linker {
         * Format a size in bytes for output, using an appropriate
         * unit (B, KB, MB or GB) according to the magnitude in question
         *
-        * @param $size Size to format
+        * @param $size int Size to format
         * @return String
         */
        public static function formatSize( $size ) {
@@ -1733,10 +1744,6 @@ class Linker {
         *   escape), or false for no title attribute
         */
        public static function titleAttrib( $name, $options = null ) {
-               global $wgEnableTooltipsAndAccesskeys;
-               if ( !$wgEnableTooltipsAndAccesskeys )
-                       return false;
-
                wfProfileIn( __METHOD__ );
 
                $message = wfMessage( "tooltip-$name" );
@@ -1819,32 +1826,32 @@ class Linker {
         */
        public static function getRevDeleteLink( User $user, Revision $rev, Title $title ) {
                $canHide = $user->isAllowed( 'deleterevision' );
-               if ( $canHide || ( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) {
-                       if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
-                               $revdlink = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
+               if ( !$canHide && !( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) {
+                       return '';
+               }
+
+               if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
+                       return Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
+               } else {
+                       if ( $rev->getId() ) {
+                               // RevDelete links using revision ID are stable across
+                               // page deletion and undeletion; use when possible.
+                               $query = array(
+                                       'type'   => 'revision',
+                                       'target' => $title->getPrefixedDBkey(),
+                                       'ids'    => $rev->getId()
+                               );
                        } else {
-                               if ( $rev->getId() ) {
-                                       // RevDelete links using revision ID are stable across
-                                       // page deletion and undeletion; use when possible.
-                                       $query = array(
-                                               'type'   => 'revision',
-                                               'target' => $title->getPrefixedDBkey(),
-                                               'ids'    => $rev->getId()
-                                       );
-                               } else {
-                                       // Older deleted entries didn't save a revision ID.
-                                       // We have to refer to these by timestamp, ick!
-                                       $query = array(
-                                               'type'   => 'archive',
-                                               'target' => $title->getPrefixedDBkey(),
-                                               'ids'    => $rev->getTimestamp()
-                                       );
-                               }
-                               return Linker::revDeleteLink( $query,
-                                       $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide );
+                               // Older deleted entries didn't save a revision ID.
+                               // We have to refer to these by timestamp, ick!
+                               $query = array(
+                                       'type'   => 'archive',
+                                       'target' => $title->getPrefixedDBkey(),
+                                       'ids'    => $rev->getTimestamp()
+                               );
                        }
-               } else {
-                       return '';
+                       return Linker::revDeleteLink( $query,
+                               $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
                }
        }
 
@@ -1863,7 +1870,7 @@ class Linker {
                $html = $delete ? wfMsgHtml( 'rev-delundel' ) : wfMsgHtml( 'rev-showdeleted' );
                $tag = $restricted ? 'strong' : 'span';
                $link = self::link( $sp, $html, array(), $query, array( 'known', 'noclasses' ) );
-               return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), "($link)" );
+               return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), wfMessage( 'parentheses' )->rawParams( $link )->escaped() );
        }
 
        /**
@@ -1876,7 +1883,7 @@ class Linker {
         */
        public static function revDeleteLinkDisabled( $delete = true ) {
                $html = $delete ? wfMsgHtml( 'rev-delundel' ) : wfMsgHtml( 'rev-showdeleted' );
-               return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), "($html)" );
+               return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), wfMessage( 'parentheses' )->rawParams( $html )->escaped() );
        }
 
        /* Deprecated methods */
@@ -1893,8 +1900,11 @@ class Linker {
         * @param $trail String: Optional trail. Alphabetic characters at the start of this string will
         *               be included in the link text. Other characters will be appended after
         *               the end of the link.
+        * @return string
         */
        static function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) {
+               wfDeprecated( __METHOD__, '1.16' );
+               
                $nt = Title::newFromText( $title );
                if ( $nt instanceof Title ) {
                        return self::makeBrokenLinkObj( $nt, $text, $query, $trail );
@@ -1919,8 +1929,11 @@ class Linker {
         *                      be included in the link text. Other characters will be appended after
         *                      the end of the link.
         * @param $prefix String: optional prefix. As trail, only before instead of after.
+        * @return string
         */
        static function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+               # wfDeprecated( __METHOD__, '1.16' ); // See r105985 and it's revert. Somewhere still used.
+               
                wfProfileIn( __METHOD__ );
                $query = wfCgiToArray( $query );
                list( $inside, $trail ) = self::splitTrail( $trail );
@@ -1948,11 +1961,13 @@ class Linker {
         * @param $prefix String: text before link text
         * @param $aprops String: extra attributes to the a-element
         * @param $style  String: style to apply - if empty, use getInternalLinkAttributesObj instead
-        * @return the a-element
+        * @return string the a-element
         */
        static function makeKnownLinkObj(
                $title, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = ''
        ) {
+               # wfDeprecated( __METHOD__, '1.16' ); // See r105985 and it's revert. Somewhere still used.
+               
                wfProfileIn( __METHOD__ );
 
                if ( $text == '' ) {
@@ -1984,8 +1999,11 @@ class Linker {
         *                      be included in the link text. Other characters will be appended after
         *                      the end of the link.
         * @param $prefix String: Optional prefix
+        * @return string
         */
        static function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) {
+               wfDeprecated( __METHOD__, '1.16' );
+               
                wfProfileIn( __METHOD__ );
 
                list( $inside, $trail ) = self::splitTrail( $trail );
@@ -2013,8 +2031,11 @@ class Linker {
         *                      be included in the link text. Other characters will be appended after
         *                      the end of the link.
         * @param $prefix String: Optional prefix
+        * @return string
         */
        static function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) {
+               wfDeprecated( __METHOD__, '1.16' );
+               
                if ( $colour != '' ) {
                        $style = self::getInternalLinkAttributesObj( $nt, $text, $colour );
                } else {
@@ -2025,11 +2046,9 @@ class Linker {
 
        /**
         * Returns the attributes for the tooltip and access key.
+        * @return array
         */
        public static function tooltipAndAccesskeyAttribs( $name ) {
-               global $wgEnableTooltipsAndAccesskeys;
-               if ( !$wgEnableTooltipsAndAccesskeys )
-                       return array();
                # @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
                # no attribute" instead of "output '' as value for attribute", this
                # would be three lines.
@@ -2047,13 +2066,10 @@ class Linker {
        }
 
        /**
-        * @deprecated since 1.14
         * Returns raw bits of HTML, use titleAttrib()
+        * @return null|string
         */
        public static function tooltip( $name, $options = null ) {
-               global $wgEnableTooltipsAndAccesskeys;
-               if ( !$wgEnableTooltipsAndAccesskeys )
-                       return '';
                # @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
                # no attribute" instead of "output '' as value for attribute", this
                # would be two lines.
@@ -2078,6 +2094,7 @@ class DummyLinker {
         *
         * @param $fname String Name of called method
         * @param $args Array Arguments to the method
+        * @return mixed
         */
        public function __call( $fname, $args ) {
                return call_user_func_array( array( 'Linker', $fname ), $args );