r93228 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93227‎ | r93228 | r93229 >
Date:17:58, 26 July 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
doc tweak
Modified paths:
  • /trunk/extensions/AdminLinks/AdminLinks_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AdminLinks/AdminLinks_body.php
@@ -5,8 +5,6 @@
66 * @author Yaron Koren
77 */
88
9 -if ( !defined( 'MEDIAWIKI' ) ) die();
10 -
119 class AdminLinks extends SpecialPage {
1210 var $skin;
1311
@@ -87,9 +85,14 @@
8886 /**
8987 * For administrators, add a link to the special 'AdminLinks' page
9088 * 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
9295 */
93 - public static function addURLToUserLinks( &$personal_urls, &$title ) {
 96+ public static function addURLToUserLinks( array &$personal_urls, Title &$title ) {
9497 global $wgUser;
9598 // if user is a sysop, add link
9699 if ( $wgUser->isAllowed( 'adminlinks' ) ) {
@@ -98,6 +101,7 @@
99102 if ( version_compare( $wgVersion, '1.16', '<' ) ) {
100103 wfLoadExtensionMessages( 'AdminLinks' );
101104 }
 105+
102106 $al = SpecialPage::getTitleFor( 'AdminLinks' );
103107 $href = $al->getLocalURL();
104108 $admin_links_vals = array(
@@ -105,6 +109,7 @@
106110 'href' => $href,
107111 'active' => ( $href == $title->getLocalURL() )
108112 );
 113+
109114 // find the location of the 'my preferences' link, and
110115 // add the link to 'AdminLinks' right before it.
111116 // this is a "key-safe" splice - it preserves both the
@@ -116,10 +121,12 @@
117122 $prefs_location = array_search( 'preferences', $tab_keys );
118123 array_splice( $tab_keys, $prefs_location, 0, 'adminlinks' );
119124 array_splice( $tab_values, $prefs_location, 0, array( $admin_links_vals ) );
 125+
120126 $personal_urls = array();
121 - for ( $i = 0; $i < count( $tab_keys ); $i++ )
 127+
 128+ for ( $i = 0; $i < count( $tab_keys ); $i++ ) {
122129 $personal_urls[$tab_keys[$i]] = $tab_values[$i];
123 -
 130+ }
124131 }
125132 return true;
126133 }
@@ -304,4 +311,5 @@
305312 $item->text = "<a class=\"external text\" rel=\"nofollow\" href=\"$url\">$label</a>";
306313 return $item;
307314 }
 315+
308316 }

Status & tagging log