Last few svn property fixes
[lhc/web/wiklou.git] / includes / Linker.php
index f466519..32f1a57 100644 (file)
@@ -23,8 +23,10 @@ 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'.
+        * @deprecated Just pass the external class directly to something using Html::expandAttributes
         */
        function getExternalLinkAttributes( $class = 'external' ) {
+               wfDeprecated( __METHOD__ );
                return $this->getLinkAttributesInternal( '', $class );
        }
 
@@ -69,7 +71,7 @@ class Linker {
         * Get the appropriate HTML attributes to add to the "a" element of an in-
         * ternal link, given the Title object for the page we want to link to.
         *
-        * @param $nt The Title object
+        * @param $nt Title
         * @param $unused String: unused
         * @param $class String: the contents of the class attribute, default none
         * @param $title Mixed: optional (unescaped) string to use in the title
@@ -159,6 +161,7 @@ class Linker {
        public function link( $target, $text = null, $customAttribs = array(), $query = array(), $options = array() ) {
                wfProfileIn( __METHOD__ );
                if ( !$target instanceof Title ) {
+                       wfProfileOut( __METHOD__ );
                        return "<!-- ERROR -->$text";
                }
                $options = (array)$options;
@@ -198,7 +201,7 @@ class Linker {
 
                $attribs = array_merge(
                        $attribs,
-                       $this->linkAttribs( $target, $customAttribs, $options )
+                       $this->linkAttribs( $target, $customAttribs, $options, $text )
                );
                if ( is_null( $text ) ) {
                        $text = $this->linkText( $target );
@@ -222,12 +225,14 @@ class Linker {
 
        /**
         * Returns the Url used to link to a Title
+        *
+        * @param $target Title
         */
        private function linkUrl( $target, $query, $options ) {
                wfProfileIn( __METHOD__ );
                # We don't want to include fragments for broken links, because they
                # generally make no sense.
-               if ( in_array( 'broken', $options ) and $target->mFragment !== '' ) {
+               if ( in_array( 'broken', $options ) && $target->mFragment !== '' ) {
                        $target = clone $target;
                        $target->mFragment = '';
                }
@@ -235,8 +240,8 @@ class Linker {
                # If it's a broken link, add the appropriate query pieces, unless
                # there's already an action specified, or unless 'edit' makes no sense
                # (i.e., for a nonexistent special page).
-               if ( in_array( 'broken', $options ) and empty( $query['action'] )
-               and $target->getNamespace() != NS_SPECIAL ) {
+               if ( in_array( 'broken', $options ) && empty( $query['action'] )
+                       && $target->getNamespace() != NS_SPECIAL ) {
                        $query['action'] = 'edit';
                        $query['redlink'] = '1';
                }
@@ -247,8 +252,10 @@ class Linker {
 
        /**
         * Returns the array of attributes used when linking to the Title $target
+        *
+        * @param $target Title
         */
-       private function linkAttribs( $target, $attribs, $options ) {
+       private function linkAttribs( $target, $attribs, $options, $linkText ) {
                wfProfileIn( __METHOD__ );
                global $wgUser;
                $defaults = array();
@@ -279,12 +286,13 @@ class Linker {
                }
 
                # Get a default title attribute.
+               $known = in_array( 'known', $options );
                if ( $target->getPrefixedText() == '' ) {
                        # A link like [[#Foo]].  This used to mean an empty title
                        # attribute, but that's silly.  Just don't output a title.
-               } elseif ( in_array( 'known', $options ) ) {
+               } elseif ( $known && strtolower($linkText) !== strtolower($target->getPrefixedText() ) ) {
                        $defaults['title'] = $target->getPrefixedText();
-               } else {
+               } elseif ( !$known ) {
                        $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
                }
 
@@ -305,6 +313,8 @@ class Linker {
 
        /**
         * Default text of the links to the Title $target
+        *
+        * @param $target Title
         */
        private function linkText( $target ) {
                # We might be passed a non-Title by make*LinkObj().  Fail gracefully.
@@ -314,7 +324,7 @@ class Linker {
 
                # If the target is just a fragment, with no title, we return the frag-
                # ment text.  Otherwise, we return the title text itself.
-               if ( $target->getPrefixedText() === '' and $target->getFragment() !== '' ) {
+               if ( $target->getPrefixedText() === '' && $target->getFragment() !== '' ) {
                        return htmlspecialchars( $target->getFragment() );
                }
                return htmlspecialchars( $target->getPrefixedText() );
@@ -324,14 +334,14 @@ class Linker {
         * Generate either a normal exists-style link or a stub link, depending
         * on the given page size.
         *
-        * @param $size Integer
-        * @param $nt Title object.
-        * @param $text String
-        * @param $query String
-        * @param $trail String
-        * @param $prefix String
-        * @return string HTML of link
-        * @deprecated
+        * @param $size Integer
+        * @param $nt Title object.
+        * @param $text String
+        * @param $query String
+        * @param $trail String
+        * @param $prefix String
+        * @return string HTML of link
+        * @deprecated @since 1.17
         */
        function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                global $wgUser;
@@ -347,6 +357,8 @@ class Linker {
         * Make appropriate markup for a link to the current article. This is currently rendered
         * as the bold link text. The calling sequence is the same as the other make*LinkObj functions,
         * despite $query not being used.
+        *
+        * @param $nt Title
         */
        function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                if ( $text == '' ) {
@@ -427,22 +439,23 @@ class Linker {
         *          caption         HTML for image caption.
         *          link-url        URL to link to
         *          link-title      Title object to link to
+        *          link-target     Value for the target attribue, only with link-url
         *          no-link         Boolean, suppress description link
         *
         * @param $handlerParams Array: associative array of media handler parameters, to be passed
         *       to transform(). Typical keys are "width" and "page".
         * @param $time String: timestamp of the file, set as false for current
         * @param $query String: query params for desc url
+        * @param $widthOption: Used by the parser to remember the user preference thumbnailsize
         * @return String: HTML for an image, with links, wrappers, etc.
         */
        function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "", $widthOption = null ) {
                $res = null;
                if ( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$this, &$title,
-               &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
+                       &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
                        return $res;
                }
 
-               global $wgContLang, $wgThumbLimits, $wgThumbUpright;
                if ( $file && !$file->allowInlineDisplay() ) {
                        wfDebug( __METHOD__ . ': ' . $title->getPrefixedDBkey() . " does not allow inline display\n" );
                        return $this->link( $title );
@@ -454,9 +467,15 @@ class Linker {
 
                // Clean up parameters
                $page = isset( $hp['page'] ) ? $hp['page'] : false;
-               if ( !isset( $fp['align'] ) ) $fp['align'] = '';
-               if ( !isset( $fp['alt'] ) ) $fp['alt'] = '';
-               if ( !isset( $fp['title'] ) ) $fp['title'] = '';
+               if ( !isset( $fp['align'] ) ) {
+                       $fp['align'] = '';
+               }
+               if ( !isset( $fp['alt'] ) ) {
+                       $fp['alt'] = '';
+               }
+               if ( !isset( $fp['title'] ) ) {
+                       $fp['title'] = '';
+               }
 
                $prefix = $postfix = '';
 
@@ -469,28 +488,31 @@ class Linker {
                        $hp['width'] = $file->getWidth( $page );
 
                        if ( isset( $fp['thumbnail'] ) || isset( $fp['framed'] ) || isset( $fp['frameless'] ) || !$hp['width'] ) {
+                               global $wgThumbLimits, $wgThumbUpright;
                                if ( !isset( $widthOption ) || !isset( $wgThumbLimits[$widthOption] ) ) {
-                                        $widthOption = User::getDefaultOption( 'thumbsize' );
+                                       $widthOption = User::getDefaultOption( 'thumbsize' );
                                }
 
                                // Reduce width for upright images when parameter 'upright' is used
                                if ( isset( $fp['upright'] ) && $fp['upright'] == 0 ) {
                                        $fp['upright'] = $wgThumbUpright;
                                }
-                               // Use width which is smaller: real image width or user preference width
                                // For caching health: If width scaled down due to upright parameter, round to full __0 pixel to avoid the creation of a lot of odd thumbs
                                $prefWidth = isset( $fp['upright'] ) ?
                                        round( $wgThumbLimits[$widthOption] * $fp['upright'], -1 ) :
                                        $wgThumbLimits[$widthOption];
-                               if ( $hp['width'] <= 0 || $prefWidth < $hp['width'] ) {
-                                       if ( !isset( $hp['height'] ) ) {
-                                               $hp['width'] = $prefWidth;
-                                       }
+
+                               // Use width which is smaller: real image width or user preference width
+                               // Unless image is scalable vector.
+                               if ( !isset( $hp['height'] ) && ( $hp['width'] <= 0 ||
+                                               $prefWidth < $hp['width'] || $file->isVectorized() ) ) {
+                                       $hp['width'] = $prefWidth;
                                }
                        }
                }
 
                if ( isset( $fp['thumbnail'] ) || isset( $fp['manualthumb'] ) || isset( $fp['framed'] ) ) {
+                       global $wgContLang;
                        # Create a thumbnail. Alignment depends on language
                        # writing direction, # right aligned for left-to-right-
                        # languages ("Western languages"), left-aligned
@@ -513,7 +535,7 @@ class Linker {
                        }
                }
 
-               if ( $file && $hp['width'] ) {
+               if ( $file && isset( $hp['width'] ) ) {
                        # Create a resized image, without the additional thumbnail features
                        $thumb = $file->transform( $hp );
                } else {
@@ -548,8 +570,11 @@ class Linker {
                $mtoParams = array();
                if ( isset( $frameParams['link-url'] ) && $frameParams['link-url'] !== '' ) {
                        $mtoParams['custom-url-link'] = $frameParams['link-url'];
+                       if ( isset( $frameParams['link-target'] ) ) {
+                               $mtoParams['custom-target-link'] = $frameParams['link-target'];
+                       }
                } elseif ( isset( $frameParams['link-title'] ) && $frameParams['link-title'] !== '' ) {
-                       $mtoParams['custom-title-link'] = $frameParams['link-title'];
+                       $mtoParams['custom-title-link'] = $this->normaliseSpecialPage( $frameParams['link-title'] );
                } elseif ( !empty( $frameParams['no-link'] ) ) {
                        // No link
                } else {
@@ -576,11 +601,24 @@ class Linker {
                        'caption' => $label,
                        'align' => $align
                );
-               if ( $framed ) $frameParams['framed'] = true;
-               if ( $manualthumb ) $frameParams['manualthumb'] = $manualthumb;
+               if ( $framed ) {
+                       $frameParams['framed'] = true;
+               }
+               if ( $manualthumb ) {
+                       $frameParams['manualthumb'] = $manualthumb;
+               }
                return $this->makeThumbLink2( $title, $file, $frameParams, $params );
        }
 
+       /**
+        * @param $title Title
+        * @param  $file File
+        * @param array $frameParams
+        * @param array $handlerParams
+        * @param bool $time
+        * @param string $query
+        * @return mixed
+        */
        function makeThumbLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "" ) {
                global $wgStylePath;
                $exists = $file && $file->exists();
@@ -675,10 +713,10 @@ class Linker {
         * Make a "broken" link to an image
         *
         * @param $title Title object
-        * @param $text String: link label
+        * @param $text String: link label in unescaped text form
         * @param $query String: query string
-        * @param $trail String: link trail
-        * @param $prefix String: link prefix
+        * @param $trail String: link trail (HTML fragment)
+        * @param $prefix String: link prefix (HTML fragment)
         * @param $time Boolean: a file of a certain timestamp was requested
         * @return String
         */
@@ -687,30 +725,31 @@ class Linker {
                if ( $title instanceof Title ) {
                        wfProfileIn( __METHOD__ );
                        $currentExists = $time ? ( wfFindFile( $title ) != false ) : false;
-                       if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && !$currentExists ) {
-                               if ( $text == '' )
-                                       $text = htmlspecialchars( $title->getPrefixedText() );
 
+                       list( $inside, $trail ) = self::splitTrail( $trail );
+                       if ( $text == '' )
+                               $text = htmlspecialchars( $title->getPrefixedText() );
+
+                       if ( ( $wgUploadMissingFileUrl || $wgEnableUploads ) && !$currentExists ) {
                                $redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
+
                                if ( $redir ) {
                                        wfProfileOut( __METHOD__ );
-                                       return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix );
+                                       return $this->linkKnown( $title, "$prefix$text$inside", array(), $query ) . $trail;
                                }
 
                                $href = $this->getUploadUrl( $title, $query );
 
-
-                               list( $inside, $trail ) = self::splitTrail( $trail );
-
                                wfProfileOut( __METHOD__ );
                                return '<a href="' . htmlspecialchars( $href ) . '" class="new" title="' .
-                                                               htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' .
-                                                               htmlspecialchars( $prefix . $text . $inside, ENT_NOQUOTES ) . '</a>' . $trail;
+                                       htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' .
+                                       "$prefix$text$inside</a>$trail";
                        } else {
                                wfProfileOut( __METHOD__ );
-                               return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix );
+                               return $this->linkKnown( $title, "$prefix$text$inside", array(), $query ) . $trail;
                        }
                } else {
+                       wfProfileOut( __METHOD__ );
                        return "<!-- ERROR -->{$prefix}{$text}{$trail}";
                }
        }
@@ -786,25 +825,17 @@ 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>
-        *
-        * @todo FIXME: This is a really crappy implementation. $linktype and
-        * 'external' are mashed into the class attrib for the link (which is made
-        * into a string). Then, if we've got additional params in $attribs, we
-        * add to it. People using this might want to change the classes (or other
-        * default link attributes), but passing $attribsText is just messy. Would
-        * make a lot more sense to make put the classes into $attribs, let the
-        * hook play with them, *then* expand it all at once.
         */
        function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
-               if ( isset( $attribs['class'] ) ) {
-                       # yet another hack :(
-                       $class = $attribs['class'];
-               } else {
-                       $class =  "external $linktype";
+               $class = "external";
+               if ( isset($linktype) && $linktype ) {
+                       $class .= " $linktype";
                }
-
-               $attribsText = $this->getExternalLinkAttributes( $class );
-               $url = htmlspecialchars( $url );
+               if ( isset($attribs['class']) && $attribs['class'] ) {
+                       $class .= " {$attribs['class']}";
+               }
+               $attribs['class'] = $class;
+               
                if ( $escape ) {
                        $text = htmlspecialchars( $text );
                }
@@ -814,10 +845,8 @@ class Linker {
                        wfDebug( "Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}\n", true );
                        return $link;
                }
-               if ( $attribs ) {
-                       $attribsText .= Html::expandAttributes( $attribs );
-               }
-               return '<a href="' . $url . '"' . $attribsText . '>' . $text . '</a>';
+               $attribs['href'] = $url;
+               return Html::rawElement( 'a', $attribs, $text );
        }
 
        /**
@@ -1094,7 +1123,7 @@ class Linker {
 
                # fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
                if ( strpos( $match[1], '%' ) !== false ) {
-                       $match[1] = str_replace( array( '<', '>' ), array( '&lt;', '&gt;' ), urldecode( $match[1] ) );
+                       $match[1] = str_replace( array( '<', '>' ), array( '&lt;', '&gt;' ), rawurldecode( $match[1] ) );
                }
 
                # Handle link renaming [[foo|text]] will show link as "text"
@@ -1149,6 +1178,13 @@ class Linker {
                return $comment;
        }
 
+       /**
+        * @static
+        * @param $contextTitle Title
+        * @param  $target
+        * @param  $text
+        * @return string
+        */
        static function normalizeSubpageLink( $contextTitle, $target, &$text ) {
                # Valid link forms:
                # Foobar -- normal
@@ -1253,7 +1289,9 @@ class Linker {
         * @return String: HTML fragment
         */
        function revComment( Revision $rev, $local = false, $isPublic = false ) {
-               if ( $rev->getRawComment() == "" ) return "";
+               if ( $rev->getRawComment() == "" ) {
+                       return "";
+               }
                if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
                        $block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
                } else if ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
@@ -1314,30 +1352,22 @@ class Linker {
         */
        function tocLineEnd() {
                return "</li>\n";
-       }
+       }
 
        /**
         * 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
         * @return String: full html of the TOC
         */
-       function tocList( $toc ) {
-               $title = wfMsgHtml( 'toc' ) ;
+       function tocList( $toc, $lang = false ) {
+               $title = wfMsgExt( 'toc', array( 'language' => $lang, 'escape' ) );
                return
                   '<table id="toc" class="toc"><tr><td>'
                 . '<div id="toctitle"><h2>' . $title . "</h2></div>\n"
                 . $toc
-                # no trailing newline, script should not be wrapped in a
-                # paragraph
-                . "</ul>\n</td></tr></table>"
-                . Html::inlineScript(
-                       'if (window.showTocToggle) {'
-                       . ' var tocShowText = "' . Xml::escapeJsString( wfMsg( 'showtoc' ) ) . '";'
-                       . ' var tocHideText = "' . Xml::escapeJsString( wfMsg( 'hidetoc' ) ) . '";'
-                       . ' showTocToggle();'
-                       . ' } ' )
-               . "\n";
+                . "</ul>\n</td></tr></table>\n";
        }
 
        /**
@@ -1386,6 +1416,8 @@ class Linker {
                // added to it for LTR text on RTL pages
                $attribs = array();
                if ( !is_null( $tooltip ) ) {
+                       # Bug 25462: undo double-escaping.
+                       $tooltip = Sanitizer::decodeCharReferences( $tooltip );
                        $attribs['title'] = wfMsgReal( 'editsectionhint', array( $tooltip ), true, $lang );
                }
                $link = $this->link( $nt, wfMsgExt( 'editsection', array( 'language' => $lang ) ),
@@ -1402,13 +1434,13 @@ class Linker {
                        $attribs = " title=\"$attribs\"";
                }
                $result = null;
-               wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $attribs, $link, &$result ) );
+               wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $attribs, $link, &$result, $lang ) );
                if ( !is_null( $result ) ) {
                        # For reverse compatibility, add the brackets *after* the hook is
                        # run, and even add them to hook-provided text.  (This is the main
                        # reason that the EditSectionLink hook is deprecated in favor of
                        # DoEditSectionLink: it can't change the brackets or the span.)
-                       $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $link );
+                       $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $result );
                        return "<span class=\"editsection\">$result</span>";
                }
 
@@ -1417,7 +1449,7 @@ class Linker {
                $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $link );
                $result = "<span class=\"editsection\">$result</span>";
 
-               wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result ) );
+               wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) );
                return $result;
        }
 
@@ -1498,17 +1530,20 @@ class Linker {
                $title = $rev->getTitle();
                $query = array(
                        'action' => 'rollback',
-                       'from' => $rev->getUserText()
+                       'from' => $rev->getUserText(),
+                       'token' => $wgUser->editToken( array( $title->getPrefixedText(), $rev->getUserText() ) ),
                );
                if ( $wgRequest->getBool( 'bot' ) ) {
                        $query['bot'] = '1';
                        $query['hidediff'] = '1'; // bug 15999
                }
-               $query['token'] = $wgUser->editToken( array( $title->getPrefixedText(),
-                       $rev->getUserText() ) );
-               return $this->link( $title, wfMsgHtml( 'rollbacklink' ),
+               return $this->link( 
+                       $title, 
+                       wfMsgHtml( 'rollbacklink' ),
                        array( 'title' => wfMsg( 'tooltip-rollback' ) ),
-                       $query, array( 'known', 'noclasses' ) );
+                       $query, 
+                       array( 'known', 'noclasses' ) 
+               );
        }
 
        /**
@@ -1630,10 +1665,12 @@ class Linker {
        public function titleAttrib( $name, $options = null ) {
                wfProfileIn( __METHOD__ );
 
-               if ( wfEmptyMsg( "tooltip-$name" ) ) {
+               $message = wfMessage( "tooltip-$name" );
+
+               if ( !$message->exists() ) {
                        $tooltip = false;
                } else {
-                       $tooltip = wfMsg( "tooltip-$name" );
+                       $tooltip = $message->text();
                        # Compatibility: formerly some tooltips had [alt-.] hardcoded
                        $tooltip = preg_replace( "/ ?\[alt-.\]$/", '', $tooltip );
                        # Message equal to '-' means suppress it.
@@ -1668,12 +1705,17 @@ class Linker {
         *   escape), or false for no accesskey attribute
         */
        public function accesskey( $name ) {
+               if ( isset( $this->accesskeycache[$name] ) ) {
+                       return $this->accesskeycache[$name];
+               }
                wfProfileIn( __METHOD__ );
 
-               if ( wfEmptyMsg( "accesskey-$name" ) ) {
+               $message = wfMessage( "accesskey-$name" );
+
+               if ( !$message->exists() ) {
                        $accesskey = false;
                } else {
-                       $accesskey = wfMsg( "accesskey-$name" );
+                       $accesskey = $message->plain();
                        if ( $accesskey === '' || $accesskey === '-' ) {
                                # FIXME: Per standard MW behavior, a value of '-' means to suppress the
                                # attribute, but this is broken for accesskey: that might be a useful
@@ -1683,7 +1725,7 @@ class Linker {
                }
 
                wfProfileOut( __METHOD__ );
-               return $accesskey;
+               return $this->accesskeycache[$name] = $accesskey;
        }
 
        /**
@@ -1720,16 +1762,7 @@ class Linker {
        /* Deprecated methods */
 
        /**
-        * @deprecated
-        */
-       function postParseLinkColour( $s = null ) {
-               wfDeprecated( __METHOD__ );
-               return null;
-       }
-
-
-       /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * This function is a shortcut to makeLinkObj(Title::newFromText($title),...). Do not call
         * it if you already have a title object handy. See makeLinkObj for further documentation.
@@ -1743,7 +1776,7 @@ class Linker {
         */
        function makeLink( $title, $text = '', $query = '', $trail = '' ) {
                wfProfileIn( __METHOD__ );
-               $nt = Title::newFromText( $title );
+               $nt = Title::newFromText( $title );
                if ( $nt instanceof Title ) {
                        $result = $this->makeLinkObj( $nt, $text, $query, $trail );
                } else {
@@ -1756,7 +1789,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * This function is a shortcut to makeKnownLinkObj(Title::newFromText($title),...). Do not call
         * it if you already have a title object handy. See makeKnownLinkObj for further documentation.
@@ -1781,7 +1814,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * This function is a shortcut to makeBrokenLinkObj(Title::newFromText($title),...). Do not call
         * it if you already have a title object handy. See makeBrokenLinkObj for further documentation.
@@ -1804,7 +1837,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * This function is a shortcut to makeStubLinkObj(Title::newFromText($title),...). Do not call
         * it if you already have a title object handy. See makeStubLinkObj for further documentation.
@@ -1828,7 +1861,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * Make a link for a title which may or may not be in the database. If you need to
         * call this lots of times, pre-fill the link cache with a LinkBatch, otherwise each
@@ -1845,7 +1878,6 @@ class Linker {
         */
        function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                wfProfileIn( __METHOD__ );
-
                $query = wfCgiToArray( $query );
                list( $inside, $trail ) = Linker::splitTrail( $trail );
                if ( $text === '' ) {
@@ -1859,7 +1891,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * Make a link for a title which definitely exists. This is faster than makeLinkObj because
         * it doesn't have to do a database query. It's also valid for interwiki titles and special
@@ -1895,7 +1927,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * Make a red link to the edit page of a given title.
         *
@@ -1923,7 +1955,7 @@ class Linker {
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * Make a brown link to a short article.
         *
@@ -1936,12 +1968,11 @@ class Linker {
         * @param $prefix String: Optional prefix
         */
        function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
-               // wfDeprecated( __METHOD__ );
                return $this->makeColouredLinkObj( $nt, 'stub', $text, $query, $trail, $prefix );
        }
 
        /**
-        * @deprecated Use link()
+        * @deprecated @since 1.16 Use link()
         *
         * Make a coloured link.
         *
@@ -1955,10 +1986,11 @@ class Linker {
         * @param $prefix String: Optional prefix
         */
        function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) {
-               // wfDeprecated( __METHOD__ );
                if ( $colour != '' ) {
                        $style = $this->getInternalLinkAttributesObj( $nt, $text, $colour );
-               } else $style = '';
+               } else {
+                       $style = '';
+               }
                return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix, '', $style );
        }
 
@@ -1970,7 +2002,7 @@ class Linker {
 
        /**
         * Creates the HTML source for images
-        * @deprecated use makeImageLink2
+        * @deprecated @since 1.16 use makeImageLink2
         *
         * @param $title Title object
         * @param $label String: label text
@@ -1985,8 +2017,7 @@ class Linker {
         * @return String
         */
        function makeImageLinkObj( $title, $label, $alt, $align = '', $handlerParams = array(), $framed = false,
-         $thumb = false, $manualthumb = '', $valign = '', $time = false )
-       {
+         $thumb = false, $manualthumb = '', $valign = '', $time = false ) {
                $frameParams = array( 'alt' => $alt, 'caption' => $label );
                if ( $align ) {
                        $frameParams['align'] = $align;
@@ -2013,36 +2044,6 @@ class Linker {
                return $this->makeMediaLinkObj( $nt, $text, $time );
        }
 
-       /**
-        * Used to generate section edit links that point to "other" pages
-        * (sections that are really part of included pages).
-        *
-        * @deprecated use Linker::doEditSectionLink()
-        * @param $title Title string.
-        * @param $section Integer: section number.
-        */
-       public function editSectionLinkForOther( $title, $section ) {
-               wfDeprecated( __METHOD__ );
-               $title = Title::newFromText( $title );
-               return $this->doEditSectionLink( $title, $section );
-       }
-
-       /**
-        * @deprecated use Linker::doEditSectionLink()
-        * @param $nt Title object.
-        * @param $section Integer: section number.
-        * @param $hint Link String: title, or default if omitted or empty
-        */
-       public function editSectionLink( Title $nt, $section, $hint = '' ) {
-               wfDeprecated( __METHOD__ );
-               if ( $hint === '' ) {
-                       # No way to pass an actual empty $hint here!  The new interface al-
-                       # lows this, so we have to do this for compatibility.
-                       $hint = null;
-               }
-               return $this->doEditSectionLink( $nt, $section, $hint );
-       }
-
        /**
         * Returns the attributes for the tooltip and access key.
         */
@@ -2065,15 +2066,19 @@ class Linker {
                }
                return $attribs;
        }
+
        /**
-        * @deprecated Returns raw bits of HTML, use titleAttrib() and accesskey()
+        * @deprecated @since 1.14
+        * Returns raw bits of HTML, use titleAttrib() and accesskey()
         */
        public function tooltipAndAccesskey( $name ) {
                return Xml::expandAttributes( $this->tooltipAndAccesskeyAttribs( $name ) );
        }
 
-
-       /** @deprecated Returns raw bits of HTML, use titleAttrib() */
+       /**
+        * @deprecated @since 1.14
+        * Returns raw bits of HTML, use titleAttrib()
+        */
        public function tooltip( $name, $options = null ) {
                global $wgEnableTooltipsAndAccesskeys;
                if ( !$wgEnableTooltipsAndAccesskeys )