r81844 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81843‎ | r81844 | r81845 >
Date:20:57, 9 February 2011
Author:ialex
Status:deferred
Tags:
Comment:
Use QuickTemplate::getSkin() if available
Modified paths:
  • /trunk/extensions/CreateRedirect/CreateRedirect.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CreateRedirect/CreateRedirect.php
@@ -61,20 +61,27 @@
6262 *
6363 * @return Boolean: true
6464 */
65 -function createRedirect_AddToolboxLink( &$skin ) {
66 - global $wgRequest, $wgTitle;
 65+function createRedirect_AddToolboxLink( &$tpl ) {
 66+ global $wgRequest;
6767
6868 // 1. Determine whether to actually add the link at all.
6969 // There are certain cases, e.g. in the edit dialog, in a special page,
7070 // where it's inappropriate for the link to appear.
7171 // 2. Check the title. Is it a "Special:" page? Don't display the link.
7272 $action = $wgRequest->getText( 'action', 'view' );
73 - if( $action != 'view' && $action != 'purge' && !$wgTitle->isSpecialPage() ) {
 73+ if ( method_exists( $tpl, 'getSkin' ) ) {
 74+ $title = $tpl->getSkin()->getTitle();
 75+ } else {
 76+ global $wgTitle;
 77+ $title = $wgTitle;
 78+ }
 79+
 80+ if( $action != 'view' && $action != 'purge' && !$title->isSpecialPage() ) {
7481 return true;
7582 }
7683
7784 // 3. Add the link!
78 - $href = SpecialPage::getTitleFor( 'CreateRedirect', $wgTitle->getPrefixedText() )->getLocalURL();
 85+ $href = SpecialPage::getTitleFor( 'CreateRedirect', $title->getPrefixedText() )->getLocalURL();
7986 echo Html::rawElement( 'li', null, Html::element( 'a', array( 'href' => $href ), wfMsg( 'createredirect' ) ) );
8087
8188 return true;

Status & tagging log