Index: trunk/extensions/CreateRedirect/CreateRedirect.php |
— | — | @@ -61,20 +61,27 @@ |
62 | 62 | * |
63 | 63 | * @return Boolean: true |
64 | 64 | */ |
65 | | -function createRedirect_AddToolboxLink( &$skin ) { |
66 | | - global $wgRequest, $wgTitle; |
| 65 | +function createRedirect_AddToolboxLink( &$tpl ) { |
| 66 | + global $wgRequest; |
67 | 67 | |
68 | 68 | // 1. Determine whether to actually add the link at all. |
69 | 69 | // There are certain cases, e.g. in the edit dialog, in a special page, |
70 | 70 | // where it's inappropriate for the link to appear. |
71 | 71 | // 2. Check the title. Is it a "Special:" page? Don't display the link. |
72 | 72 | $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() ) { |
74 | 81 | return true; |
75 | 82 | } |
76 | 83 | |
77 | 84 | // 3. Add the link! |
78 | | - $href = SpecialPage::getTitleFor( 'CreateRedirect', $wgTitle->getPrefixedText() )->getLocalURL(); |
| 85 | + $href = SpecialPage::getTitleFor( 'CreateRedirect', $title->getPrefixedText() )->getLocalURL(); |
79 | 86 | echo Html::rawElement( 'li', null, Html::element( 'a', array( 'href' => $href ), wfMsg( 'createredirect' ) ) ); |
80 | 87 | |
81 | 88 | return true; |