From cc8b186a64ef83063c50e2da638059058e8c0482 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 18 Apr 2006 01:34:43 +0000 Subject: [PATCH] Remove an unused global, and fall back to a cleaner and safer method of producing links. Will probably have to gut this bit of code to fix the link quirk. --- includes/SpecialWatchlist.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index 5f5544b39c..fdc42e0e3f 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -18,7 +18,7 @@ function wfSpecialWatchlist( $par ) { global $wgUser, $wgOut, $wgLang, $wgMemc, $wgRequest, $wgContLang; global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname; global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker; - global $wgEnotifWatchlist, $wgFilterRobotsWL; + global $wgEnotifWatchlist; $fname = 'wfSpecialWatchlist'; $wgOut->setPagetitle( wfMsg( 'watchlist' ) ); @@ -313,12 +313,17 @@ function wfSpecialWatchlist( $par ) { $skin = $wgUser->getSkin(); $linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' ); - foreach( $linkElements as $var => $msg ) { - $label = $$var == 0 ? wfMsgHtml( 'hide' ) : wfMsgHtml( 'show' ); - $linkBits = wfArrayToCGI( array( $var => 1 - $$var ), $nondefaults ); - $link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ); - $links[] = wfMsgHtml( $msg, $link ); - } + # Problems encountered using the fancier method + $label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' ); + $linkBits = wfArrayToCGI( array( 'hideBots' => 1 - (int)$hideBots ), $nondefaults ); + $link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ); + $links[] = wfMsgHtml( 'wlhideshowbots', $link ); + + $label = $hideOwn ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' ); + $linkBits = wfArrayToCGI( array( 'hideOwn' => 1 - (int)$hideOwn ), $nondefaults ); + $link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits ); + $links[] = wfMsgHtml( 'wlhideshowown', $link ); + $wgOut->addHTML( implode( ' | ', $links ) ); # Form for namespace filtering -- 2.20.1