r81403 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81402‎ | r81403 | r81404 >
Date:16:31, 2 February 2011
Author:ialex
Status:deferred
Tags:
Comment:
And while I'm a it: use QuickTemplate::getSkin() to get the Title object if available
Modified paths:
  • /trunk/extensions/Watchers/Watchers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Watchers/Watchers.php
@@ -44,20 +44,26 @@
4545 * Display link in toolbox
4646 */
4747 function wfWatchersExtensionAfterToolbox( &$tpl ) { # Checked for HTML and MySQL insertion attacks
48 - global $wgTitle;
49 - if( $wgTitle->isTalkPage() ) {
 48+ if ( method_exists( $tpl, 'getSkin' ) ) {
 49+ $title = $tpl->getSkin()->getTitle();
 50+ } else {
 51+ global $wgTitle;
 52+ $title = $wgTitle;
 53+ }
 54+
 55+ if( $title->isTalkPage() ) {
5056 # No talk pages please
5157 return true;
5258 }
5359
54 - if( $wgTitle->getNamespace() < 0 ) {
 60+ if( $title->getNamespace() < 0 ) {
5561 # No special pages please
5662 return true;
5763 }
5864
5965 echo '<li id="t-watchers"><a href="' ;
6066 $nt = SpecialPage::getTitleFor( 'Watchers' );
61 - echo $nt->escapeLocalURL( 'page=' . $wgTitle->getPrefixedDBkey() );
 67+ echo $nt->escapeLocalURL( 'page=' . $title->getPrefixedDBkey() );
6268 echo '">';
6369 echo wfMsgHtml( 'watchers_link_title' );
6470 echo "</a></li>\n";

Status & tagging log