Index: trunk/extensions/Watchers/Watchers.php |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | |
34 | 34 | $wgSpecialPages['Watchers'] = 'SpecialWatchers'; |
35 | 35 | |
36 | | -$wgHooks['SkinTemplateToolboxEnd'][] = 'wfWatchersExtensionAfterToolbox'; |
| 36 | +$wgHooks['BaseTemplateToolbox'][] = 'wfWatchersExtensionAfterToolbox'; |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Set this to a number to anonymize results ("X or more" / "Less that X" people watching this page) |
— | — | @@ -43,30 +43,22 @@ |
44 | 44 | /** |
45 | 45 | * Display link in toolbox |
46 | 46 | */ |
47 | | -function wfWatchersExtensionAfterToolbox( &$tpl ) { # Checked for HTML and MySQL insertion attacks |
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() ) { |
56 | | - # No talk pages please |
| 47 | +function wfWatchersExtensionAfterToolbox( $tpl, $toolbox ) { # Checked for HTML and MySQL insertion attacks |
| 48 | + # Only when displaying non-talk pages |
| 49 | + if( !isset( $toolbox['whatlinkshere'] ) || $toolbox['whatlinkshere'] === false ) { |
57 | 50 | return true; |
58 | 51 | } |
59 | 52 | |
60 | | - if( $title->getNamespace() < 0 ) { |
61 | | - # No special pages please |
62 | | - return true; |
63 | | - } |
64 | | - |
65 | | - echo '<li id="t-watchers"><a href="' ; |
| 53 | + $title = $tpl->getSkin()->getTitle(); |
66 | 54 | $nt = SpecialPage::getTitleFor( 'Watchers' ); |
67 | | - echo $nt->escapeLocalURL( 'page=' . $title->getPrefixedDBkey() ); |
68 | | - echo '">'; |
69 | | - echo wfMsgHtml( 'watchers_link_title' ); |
70 | | - echo "</a></li>\n"; |
| 55 | + $res['watchers'] = array( |
| 56 | + 'href' => $nt->getLocalURL( 'page=' . $title->getPrefixedDBkey() ), |
| 57 | + 'msg' => 'watchers_link_title', |
| 58 | + 'id' => 't-watchers', |
| 59 | + ); |
71 | 60 | |
| 61 | + $after = isset( $toolbox['recentchangeslinked'] ) ? 'recentchangeslinked' : 'whatlinkshere'; |
| 62 | + $toolbox = wfArrayInsertAfter( $toolbox, $res, $after ); |
| 63 | + |
72 | 64 | return true; |
73 | 65 | } |