r93839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93838‎ | r93839 | r93840 >
Date:17:19, 3 August 2011
Author:ialex
Status:ok
Tags:
Comment:
Call Linker methods statically
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -131,7 +131,7 @@
132132 * @return void
133133 */
134134 static function profilePreferences( $user, &$defaultPreferences ) {
135 - global $wgLang, $wgUser;
 135+ global $wgLang;
136136 ## User info #####################################
137137 // Information panel
138138 $defaultPreferences['username'] = array(
@@ -224,7 +224,7 @@
225225 );
226226
227227 if ( $wgAuth->allowPasswordChange() ) {
228 - $link = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'ChangePassword' ),
 228+ $link = Linker::link( SpecialPage::getTitleFor( 'ChangePassword' ),
229229 wfMsgHtml( 'prefs-resetpass' ), array(),
230230 array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' ) ) );
231231
@@ -353,7 +353,7 @@
354354 $helpMessages[] = 'prefs-help-email-others';
355355 }
356356
357 - $link = $wgUser->getSkin()->link(
 357+ $link = Linker::link(
358358 SpecialPage::getTitleFor( 'ChangeEmail' ),
359359 wfMsgHtml( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' ),
360360 array(),
@@ -389,14 +389,10 @@
390390 $disableEmailPrefs = false;
391391 } else {
392392 $disableEmailPrefs = true;
393 - $skin = $wgUser->getSkin();
394393 $emailauthenticated = wfMsgExt( 'emailnotauthenticated', 'parseinline' ) . '<br />' .
395 - $skin->link(
 394+ Linker::linkKnown(
396395 SpecialPage::getTitleFor( 'Confirmemail' ),
397 - wfMsg( 'emailconfirmlink' ),
398 - array(),
399 - array(),
400 - array( 'known', 'noclasses' )
 396+ wfMsg( 'emailconfirmlink' )
401397 ) . '<br />';
402398 }
403399 } else {
@@ -489,17 +485,16 @@
490486 # This code is basically copied from generateSkinOptions(). It'd
491487 # be nice to somehow merge this back in there to avoid redundancy.
492488 if ( $wgAllowUserCss || $wgAllowUserJs ) {
493 - $sk = $user->getSkin();
494489 $linkTools = array();
495490
496491 if ( $wgAllowUserCss ) {
497492 $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.css' );
498 - $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
 493+ $linkTools[] = Linker::link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
499494 }
500495
501496 if ( $wgAllowUserJs ) {
502497 $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.js' );
503 - $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
 498+ $linkTools[] = Linker::link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
504499 }
505500
506501 $defaultPreferences['commoncssjs'] = array(
@@ -1065,7 +1060,6 @@
10661061 }
10671062 }
10681063 asort( $validSkinNames );
1069 - $sk = $user->getSkin();
10701064
10711065 foreach ( $validSkinNames as $skinkey => $sn ) {
10721066 $linkTools = array();
@@ -1082,12 +1076,12 @@
10831077 # Create links to user CSS/JS pages
10841078 if ( $wgAllowUserCss ) {
10851079 $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' );
1086 - $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
 1080+ $linkTools[] = Linker::link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
10871081 }
10881082
10891083 if ( $wgAllowUserJs ) {
10901084 $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' );
1091 - $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
 1085+ $linkTools[] = Linker::link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
10921086 }
10931087
10941088 $display = $sn . ' ' . wfMsg( 'parentheses', $wgLang->pipeList( $linkTools ) );
@@ -1504,12 +1498,9 @@
15051499 function getButtons() {
15061500 $html = parent::getButtons();
15071501
1508 - global $wgUser;
1509 -
1510 - $sk = $wgUser->getSkin();
15111502 $t = SpecialPage::getTitleFor( 'Preferences', 'reset' );
15121503
1513 - $html .= "\n" . $sk->link( $t, wfMsgHtml( 'restoreprefs' ) );
 1504+ $html .= "\n" . Linker::link( $t, wfMsgHtml( 'restoreprefs' ) );
15141505
15151506 $html = Xml::tags( 'div', array( 'class' => 'mw-prefs-buttons' ), $html );
15161507

Status & tagging log