42 parent::__construct(
'ResetTokens' );
60 if ( !isset( $this->tokensList ) ) {
62 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
64 $this->
getHookRunner()->onSpecialResetTokensTokens( $tokens );
67 $tokens = array_filter( $tokens,
static function ( $tok ) use ( $hiddenPrefs ) {
68 return !in_array( $tok[
'preference'], $hiddenPrefs );
71 $this->tokensList = $tokens;
74 return $this->tokensList;
82 parent::execute(
$par );
89 Html::successBox(
'$1' ),
105 foreach ( $tokens as $tok ) {
106 $label = $this->
msg(
'resettokens-token-label' )
107 ->rawParams( $this->
msg( $tok[
'label-message'] )->parse() )
108 ->params( $user->getTokenFromOption( $tok[
'preference'] ) )
110 $tokensForForm[$label] = $tok[
'preference'];
114 'label-message' =>
'resettokens-tokens',
115 'type' =>
'multiselect',
116 'options' => $tokensForForm,
120 'label-message' =>
'resettokens-no-tokens',
149 if ( $formData[
'tokens'] ) {
151 foreach ( $formData[
'tokens'] as $tokenPref ) {
152 $user->resetTokenFromOption( $tokenPref );
154 $user->saveSettings();
175class_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.