From: Raimond Spekking Date: Tue, 12 Feb 2008 18:01:42 +0000 (+0000) Subject: * (bug 12968) Render redirect wikilinks in a redirect class for customization via... X-Git-Tag: 1.31.0-rc.0~49514 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%7B%7B%20url_for%28%27vote%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=d91d1616fb3c88fe33731dfe7623c176d2646942;p=lhc%2Fweb%2Fwiklou.git * (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) --- 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; }