41 parent::__construct(
'ResetTokens' );
59 if ( !isset( $this->tokensList ) ) {
61 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
63 $this->
getHookRunner()->onSpecialResetTokensTokens( $tokens );
66 $tokens = array_filter( $tokens,
static function ( $tok ) use ( $hiddenPrefs ) {
67 return !in_array( $tok[
'preference'], $hiddenPrefs );
70 $this->tokensList = $tokens;
73 return $this->tokensList;
81 parent::execute(
$par );
88 Html::successBox(
'$1' ),
104 foreach ( $tokens as $tok ) {
105 $label = $this->
msg(
'resettokens-token-label' )
106 ->rawParams( $this->
msg( $tok[
'label-message'] )->parse() )
107 ->params( $user->getTokenFromOption( $tok[
'preference'] ) )
109 $tokensForForm[$label] = $tok[
'preference'];
113 'label-message' =>
'resettokens-tokens',
114 'type' =>
'multiselect',
115 'options' => $tokensForForm,
119 'label-message' =>
'resettokens-no-tokens',
148 if ( $formData[
'tokens'] ) {
150 foreach ( $formData[
'tokens'] as $tokenPref ) {
151 $user->resetTokenFromOption( $tokenPref );
153 $user->saveSettings();
174class_alias( SpecialResetTokens::class,
'SpecialResetTokens' );
A class containing constants representing the names of configuration variables.
const HiddenPrefs
Name constant for the HiddenPrefs setting, for use with Config::get()
Special page which uses an HTMLForm to handle processing.
string null $par
The subpage of the special page.
Parent class for all special pages.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getUser()
Shortcut to get the User executing this instance.
requireNamedUser( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin', bool $alwaysRedirectToLoginPage=false)
If the user is not logged in or is a temporary user, throws UserNotLoggedIn.
getConfig()
Shortcut to get main config object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.