Replace get{Local,Full,Link,Canonical}URL's $variant argument with a secondary $query...
[lhc/web/wiklou.git] / includes / Linker.php
index 71a5107..3ccba76 100644 (file)
@@ -250,11 +250,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;
        }
@@ -389,7 +389,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;
@@ -866,7 +866,7 @@ 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
         */
@@ -969,6 +969,8 @@ class Linker {
                        $items[] = self::emailLink( $userId, $userText );
                }
 
+               wfRunHooks( 'UserToolLinksEdit', array( $userId, $userText, &$items ) );
+
                if ( $items ) {
                        return ' <span class="mw-usertoollinks">(' . $wgLang->pipeList( $items ) . ')</span>';
                } else {
@@ -1132,6 +1134,7 @@ class Linker {
         * @return string
         */
        private static function formatAutocommentsCallback( $match ) {
+               global $wgLang;
                $title = self::$autocommentTitle;
                $local = self::$autocommentLocal;
 
@@ -1157,7 +1160,7 @@ class Linker {
                        }
                        if ( $sectionTitle ) {
                                $link = self::link( $sectionTitle,
-                                       htmlspecialchars( wfMsgForContent( 'sectionlink' ) ), array(), array(),
+                                       $wgLang->getArrow(), array(), array(),
                                        'noclasses' );
                        } else {
                                $link = '';
@@ -1581,7 +1584,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';
@@ -1713,10 +1716,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" );
@@ -1823,9 +1822,8 @@ class Linker {
                                return Linker::revDeleteLink( $query,
                                        $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide );
                        }
-               } else {
-                       return '';
                }
+               return '';
        }
 
        /**
@@ -2007,9 +2005,6 @@ class Linker {
         * Returns the attributes for the tooltip and access key.
         */
        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.
@@ -2031,9 +2026,6 @@ class Linker {
         * Returns raw bits of HTML, use titleAttrib()
         */
        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.