Index: trunk/extensions/AdminLinks/AdminLinks_body.php |
— | — | @@ -5,8 +5,6 @@ |
6 | 6 | * @author Yaron Koren |
7 | 7 | */ |
8 | 8 | |
9 | | -if ( !defined( 'MEDIAWIKI' ) ) die(); |
10 | | - |
11 | 9 | class AdminLinks extends SpecialPage { |
12 | 10 | var $skin; |
13 | 11 | |
— | — | @@ -87,9 +85,14 @@ |
88 | 86 | /** |
89 | 87 | * For administrators, add a link to the special 'AdminLinks' page |
90 | 88 | * among the user's "personal URLs" at the top, if they have |
91 | | - * the 'adminlinks' permission |
| 89 | + * the 'adminlinks' permission. |
| 90 | + * |
| 91 | + * @param array $personal_urls |
| 92 | + * @param Title $title |
| 93 | + * |
| 94 | + * @return true |
92 | 95 | */ |
93 | | - public static function addURLToUserLinks( &$personal_urls, &$title ) { |
| 96 | + public static function addURLToUserLinks( array &$personal_urls, Title &$title ) { |
94 | 97 | global $wgUser; |
95 | 98 | // if user is a sysop, add link |
96 | 99 | if ( $wgUser->isAllowed( 'adminlinks' ) ) { |
— | — | @@ -98,6 +101,7 @@ |
99 | 102 | if ( version_compare( $wgVersion, '1.16', '<' ) ) { |
100 | 103 | wfLoadExtensionMessages( 'AdminLinks' ); |
101 | 104 | } |
| 105 | + |
102 | 106 | $al = SpecialPage::getTitleFor( 'AdminLinks' ); |
103 | 107 | $href = $al->getLocalURL(); |
104 | 108 | $admin_links_vals = array( |
— | — | @@ -105,6 +109,7 @@ |
106 | 110 | 'href' => $href, |
107 | 111 | 'active' => ( $href == $title->getLocalURL() ) |
108 | 112 | ); |
| 113 | + |
109 | 114 | // find the location of the 'my preferences' link, and |
110 | 115 | // add the link to 'AdminLinks' right before it. |
111 | 116 | // this is a "key-safe" splice - it preserves both the |
— | — | @@ -116,10 +121,12 @@ |
117 | 122 | $prefs_location = array_search( 'preferences', $tab_keys ); |
118 | 123 | array_splice( $tab_keys, $prefs_location, 0, 'adminlinks' ); |
119 | 124 | array_splice( $tab_values, $prefs_location, 0, array( $admin_links_vals ) ); |
| 125 | + |
120 | 126 | $personal_urls = array(); |
121 | | - for ( $i = 0; $i < count( $tab_keys ); $i++ ) |
| 127 | + |
| 128 | + for ( $i = 0; $i < count( $tab_keys ); $i++ ) { |
122 | 129 | $personal_urls[$tab_keys[$i]] = $tab_values[$i]; |
123 | | - |
| 130 | + } |
124 | 131 | } |
125 | 132 | return true; |
126 | 133 | } |
— | — | @@ -304,4 +311,5 @@ |
305 | 312 | $item->text = "<a class=\"external text\" rel=\"nofollow\" href=\"$url\">$label</a>"; |
306 | 313 | return $item; |
307 | 314 | } |
| 315 | + |
308 | 316 | } |