From d91d1616fb3c88fe33731dfe7623c176d2646942 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 12 Feb 2008 18:01:42 +0000 Subject: [PATCH] * (bug 12968) Render redirect wikilinks in a redirect class for customization via user/site CSS. Based on a patch by Cobi This works for logged in users who have set a threshold > 0 in its preferences. This way no extra database query is necessary. Highly resource-intensive javascripts are now obsolete (see example in bugreport) --- RELEASE-NOTES | 2 ++ includes/Linker.php | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 249f36b5b2..3c9324b529 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -159,6 +159,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN $wgDefaultRobotPolicy setting. * (bug 12239) Use different separators for autocomments * (bug 12857) Patrol link on new pages should clear floats +* (bug 12968) Render redirect wikilinks in a redirect class for customization + via user/site CSS. === Bug fixes in 1.12 === diff --git a/includes/Linker.php b/includes/Linker.php index 0fd5df363e..30a5f18f89 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -76,18 +76,21 @@ class Linker { * Return the CSS colour of a known link * * @param mixed $s - * @param integer $id - * @param integer $threshold + * @param integer $threshold user defined threshold + * @return string $colour CSS class */ function getLinkColour( $s, $threshold ) { - if( $threshold > 0 && $s!=false ) { - $colour = ( $s->page_len >= $threshold || - $s->page_is_redirect || - !Namespace::isContent( $s->page_namespace ) - ? '' : 'stub' ); + if( $s == false ) { + return ''; } - else { - $colour = ''; + + $colour = ''; + if ( $s->page_is_redirect ) { + # Page is a redirect + $colour = 'mw-redirect'; + } elseif ( $threshold > 0 && $s->page_len < $threshold && Namespace::isContent( $s->page_namespace ) ) { + # Page is a stub + $colour = 'stub'; } return $colour; } -- 2.20.1