40 parent::__construct(
'ResetTokens' );
58 if ( !isset( $this->tokensList ) ) {
60 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
62 $this->
getHookRunner()->onSpecialResetTokensTokens( $tokens );
65 $tokens = array_filter( $tokens,
static function ( $tok ) use ( $hiddenPrefs ) {
66 return !in_array( $tok[
'preference'], $hiddenPrefs );
69 $this->tokensList = $tokens;
72 return $this->tokensList;
80 parent::execute(
$par );
87 Html::successBox(
'$1' ),
103 foreach ( $tokens as $tok ) {
104 $label = $this->
msg(
'resettokens-token-label' )
105 ->rawParams( $this->
msg( $tok[
'label-message'] )->parse() )
106 ->params( $user->getTokenFromOption( $tok[
'preference'] ) )
108 $tokensForForm[$label] = $tok[
'preference'];
112 'label-message' =>
'resettokens-tokens',
113 'type' =>
'multiselect',
114 'options' => $tokensForForm,
118 'label-message' =>
'resettokens-no-tokens',
147 if ( $formData[
'tokens'] ) {
149 foreach ( $formData[
'tokens'] as $tokenPref ) {
150 $user->resetTokenFromOption( $tokenPref );
152 $user->saveSettings();
173class_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 sub-page 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.
getConfig()
Shortcut to get main config object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
requireNamedUser( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in or is a temporary user, throws UserNotLoggedIn.
getOutput()
Get the OutputPage being used for this instance.