Go to the documentation of this file.
34 parent::__construct(
'ResetTokens' );
48 if ( !isset( $this->tokensList ) ) {
50 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
52 Hooks::run(
'SpecialResetTokensTokens', [ &$tokens ] );
54 $hiddenPrefs = $this->
getConfig()->get(
'HiddenPrefs' );
55 $tokens = array_filter( $tokens,
function ( $tok ) use ( $hiddenPrefs ) {
56 return !in_array( $tok[
'preference'], $hiddenPrefs );
59 $this->tokensList = $tokens;
70 parent::execute(
$par );
77 Html::successBox(
'$1' ),
93 foreach ( $tokens as $tok ) {
94 $label = $this->
msg(
'resettokens-token-label' )
95 ->rawParams( $this->
msg( $tok[
'label-message'] )->parse() )
96 ->params( $user->getTokenFromOption( $tok[
'preference'] ) )
98 $tokensForForm[$label] = $tok[
'preference'];
102 'label-message' =>
'resettokens-tokens',
103 'type' =>
'multiselect',
104 'options' => $tokensForForm,
108 'label-message' =>
'resettokens-no-tokens',
137 if ( $formData[
'tokens'] ) {
139 foreach ( $formData[
'tokens'] as $tokenPref ) {
140 $user->resetTokenFromOption( $tokenPref );
142 $user->saveSettings();
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getDisplayFormat()
Get display format for the form.
getTokensList()
Returns the token information list for this page after running the hook and filtering out disabled pr...
getOutput()
Get the OutputPage being used for this instance.
Special page which uses an HTMLForm to handle processing.
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,...
doesWrites()
Indicates whether this special page may perform database writes.
getFormFields()
Display appropriate message if there's nothing to do.
getConfig()
Shortcut to get main config object.
execute( $par)
Basic SpecialPage workflow: get a form, send it to the user; get some data back,.
getUser()
Shortcut to get the User executing this instance.
string null $par
The sub-page of the special page.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
alterForm(HTMLForm $form)
Suppress the submit button if there's nothing to do; provide additional message on it otherwise.
isListed()
Whether this special page is listed in Special:SpecialPages.
Let users reset tokens like the watchlist token.
onSubmit(array $formData)
Process the form on POST submission.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.