X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPreferences.php;h=2e7b4cd2d27761e98c08e101771d1ecf1141f4e6;hb=fc3c3784eb8171c4327f09b89c0e78b8455aeea5;hp=965a36e703f5229dc9e673ab7b891f884ab50181;hpb=787cb106c4c55d8742b9f636645ca8635e6acff8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index 965a36e703..2e7b4cd2d2 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -61,11 +61,11 @@ class SpecialPreferences extends SpecialPage { $out->wrapWikiMsg( Html::rawElement( 'div', - array( + [ 'class' => 'mw-preferences-messagebox successbox', 'id' => 'mw-preferences-success' - ), - Html::element( 'p', array(), '$1' ) + ], + Html::element( 'p', [], '$1' ) ), 'savedprefs' ); @@ -74,28 +74,32 @@ class SpecialPreferences extends SpecialPage { $this->addHelpLink( 'Help:Preferences' ); // Load the user from the master to reduce CAS errors on double post (T95839) - $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser(); + if ( $this->getRequest()->wasPosted() ) { + $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser(); + } else { + $user = $this->getUser(); + } $htmlForm = Preferences::getFormObject( $user, $this->getContext() ); - $htmlForm->setSubmitCallback( array( 'Preferences', 'tryUISubmit' ) ); + $htmlForm->setSubmitCallback( [ 'Preferences', 'tryUISubmit' ] ); $sectionTitles = $htmlForm->getPreferenceSections(); $prefTabs = ''; foreach ( $sectionTitles as $key ) { $prefTabs .= Html::rawElement( 'li', - array( + [ 'role' => 'presentation', 'class' => ( $key === 'personal' ) ? 'selected' : null - ), + ], Html::rawElement( 'a', - array( + [ 'id' => 'preftab-' . $key, 'role' => 'tab', 'href' => '#mw-prefsection-' . $key, 'aria-controls' => 'mw-prefsection-' . $key, 'aria-selected' => ( $key === 'personal' ) ? 'true' : 'false', 'tabIndex' => ( $key === 'personal' ) ? 0 : -1, - ), + ], $htmlForm->getLegend( $key ) ) ); @@ -103,10 +107,10 @@ class SpecialPreferences extends SpecialPage { $out->addHTML( Html::rawElement( 'ul', - array( + [ 'id' => 'preftoc', 'role' => 'tablist' - ), + ], $prefTabs ) ); $htmlForm->show(); @@ -121,11 +125,11 @@ class SpecialPreferences extends SpecialPage { $context = new DerivativeContext( $this->getContext() ); $context->setTitle( $this->getPageTitle( 'reset' ) ); // Reset subpage - $htmlForm = new HTMLForm( array(), $context, 'prefs-restore' ); + $htmlForm = new HTMLForm( [], $context, 'prefs-restore' ); $htmlForm->setSubmitTextMsg( 'restoreprefs' ); $htmlForm->setSubmitDestructive(); - $htmlForm->setSubmitCallback( array( $this, 'submitReset' ) ); + $htmlForm->setSubmitCallback( [ $this, 'submitReset' ] ); $htmlForm->suppressReset(); $htmlForm->show();