Don't produce a title attribute for external links when the link text is
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 23 Sep 2004 02:25:41 +0000 (02:25 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 23 Sep 2004 02:25:41 +0000 (02:25 +0000)
the same as the URL. (We already don't produce a print expansion for these.)

includes/Skin.php

index 45f1f2a..87c23d7 100644 (file)
@@ -315,6 +315,7 @@ class Skin {
        function getExternalLinkAttributes( $link, $text, $class='' ) {
                global $wgUser, $wgOut, $wgLang;
 
+               $same = ($link == $text);
                $link = urldecode( $link );
                $link = $wgLang->checkTitleEncoding( $link );
                $link = str_replace( '_', ' ', $link );
@@ -322,7 +323,7 @@ class Skin {
 
                $r = ($class != '') ? " class='$class'" : " class='external'";
 
-               if ( 1 == $wgUser->getOption( 'hover' ) ) {
+               if ( !$same && $wgUser->getOption( 'hover' ) ) {
                        $r .= " title=\"{$link}\"";
                }
                return $r;
@@ -1510,8 +1511,10 @@ class Skin {
                $fname = 'Skin::makeLinkObj';
 
                # Fail gracefully
-               if ( ! isset($nt) )
+               if ( ! isset($nt) ) {
+                       # wfDebugDieBacktrace();
                        return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+               }
 
                if ( $nt->isExternal() ) {
                        $u = $nt->getFullURL();
@@ -1640,8 +1643,10 @@ class Skin {
                global $wgOut, $wgUser;
 
                # Fail gracefully
-               if ( ! isset($nt) )
+               if ( ! isset($nt) ) {
+                       # wfDebugDieBacktrace();
                        return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+               }
 
                $fname = 'Skin::makeBrokenLinkObj';
                wfProfileIn( $fname );