MediaWiki
1.28.0
|
Handles the page protection UI and backend. More...
Public Member Functions | |
__construct (Article $article) | |
buildForm () | |
Build the input form. More... | |
buildSelector ($action, $selected) | |
Build protection level selector. More... | |
execute () | |
Main entry point for action=protect and action=unprotect. More... | |
getExpiry ($action) | |
Get the expiry time for a given action, by combining the relevant inputs. More... | |
loadData () | |
Loads the current state of protection into the object. More... | |
save () | |
Save submitted protection form. More... | |
show ($err=null) | |
Show the input form with optional error message. More... | |
showLogExtract (&$out) | |
Show protection long extracts for this page. More... | |
Protected Attributes | |
array | $mApplicableTypes = [] |
Types (i.e. More... | |
bool | $mCascade = false |
True if the restrictions are cascading, from request or existing protection. More... | |
array | $mExistingExpiry = [] |
Map of action to the expiry time of the existing protection. More... | |
array | $mExpiry = [] |
Map of action to "other" expiry time. More... | |
array | $mExpirySelection = [] |
Map of action to value selected in expiry drop-down list. More... | |
array | $mPermErrors = [] |
Permissions errors for the protect action. More... | |
string | $mReason = '' |
The custom/additional protection reason. More... | |
string | $mReasonSelection = '' |
The reason selected from the list, blank for other/additional. More... | |
array | $mRestrictions = [] |
A map of action to restriction level, from request or default. More... | |
Private Member Functions | |
getOptionLabel ($permission) | |
Prepare the label for a protection selector option. More... | |
Private Attributes | |
IContextSource | $mContext |
Handles the page protection UI and backend.
Definition at line 29 of file ProtectionForm.php.
ProtectionForm::__construct | ( | Article | $article | ) |
Definition at line 63 of file ProtectionForm.php.
References $article, Article\getContext(), Article\getTitle(), loadData(), wfReadOnly(), and wfReadOnlyReason().
ProtectionForm::buildForm | ( | ) |
Build the input form.
Definition at line 346 of file ProtectionForm.php.
References $attribs, $context, $lang, $link, $mCascade, $mContext, $out, $output, $t, $timestamp, $user, $value, ParserOutput\addJsConfigVars(), ParserOutput\addModules(), as, buildSelector(), Xml\checkLabel(), Xml\closeElement(), Xml\element(), false, Html\hidden(), Xml\input(), Xml\label(), Linker\linkKnown(), list, Xml\listDropDown(), Xml\openElement(), Hooks\run(), Xml\submitButton(), text, and wfMessage().
Referenced by show().
ProtectionForm::buildSelector | ( | $action, | |
$selected | |||
) |
Build protection level selector.
string | $action | Action to protect |
string | $selected | Current protection level |
Definition at line 573 of file ProtectionForm.php.
References as, getOptionLabel(), and MWNamespace\getRestrictionLevels().
Referenced by buildForm().
ProtectionForm::execute | ( | ) |
Main entry point for action=protect and action=unprotect.
Definition at line 180 of file ProtectionForm.php.
References MWNamespace\getRestrictionLevels(), save(), and show().
ProtectionForm::getExpiry | ( | $action | ) |
Get the expiry time for a given action, by combining the relevant inputs.
string | $action |
Definition at line 153 of file ProtectionForm.php.
References $time, $value, TS_MW, wfIsInfinity(), and wfTimestamp().
Referenced by save().
|
private |
Prepare the label for a protection selector option.
string | $permission | Permission required |
Definition at line 601 of file ProtectionForm.php.
Referenced by buildSelector().
ProtectionForm::loadData | ( | ) |
Loads the current state of protection into the object.
Definition at line 91 of file ProtectionForm.php.
References $request, as, ContextSource\getRequest(), and MWNamespace\getRestrictionLevels().
Referenced by __construct().
ProtectionForm::save | ( | ) |
Save submitted protection form.
Definition at line 264 of file ProtectionForm.php.
References $mReason, $mReasonSelection, $out, $request, $status, $user, as, WatchAction\doWatchOrUnwatch(), getExpiry(), ContextSource\getRequest(), Hooks\run(), show(), and wfTimestampNow().
Referenced by execute().
ProtectionForm::show | ( | $err = null | ) |
Show the input form with optional error message.
string | $err | Error message or null if there's no error |
Definition at line 200 of file ProtectionForm.php.
References $out, $title, $titles, as, buildForm(), list, showLogExtract(), and wfEscapeWikiText().
ProtectionForm::showLogExtract | ( | & | $out | ) |
Show protection long extracts for this page.
OutputPage | $out | private |
Definition at line 620 of file ProtectionForm.php.
References $out, Xml\element(), Hooks\run(), and LogEventsList\showLogExtract().
Referenced by show().
|
protected |
Types (i.e.
actions) for which levels can be selected
Definition at line 55 of file ProtectionForm.php.
|
protected |
True if the restrictions are cascading, from request or existing protection.
Definition at line 40 of file ProtectionForm.php.
Referenced by buildForm().
|
private |
Definition at line 61 of file ProtectionForm.php.
Referenced by buildForm().
|
protected |
Map of action to the expiry time of the existing protection.
Definition at line 58 of file ProtectionForm.php.
|
protected |
Map of action to "other" expiry time.
Used in preference to mExpirySelection.
Definition at line 43 of file ProtectionForm.php.
|
protected |
Map of action to value selected in expiry drop-down list.
Will be set to 'othertime' whenever mExpiry is set.
Definition at line 49 of file ProtectionForm.php.
|
protected |
Permissions errors for the protect action.
Definition at line 52 of file ProtectionForm.php.
|
protected |
The custom/additional protection reason.
Definition at line 34 of file ProtectionForm.php.
Referenced by save().
|
protected |
The reason selected from the list, blank for other/additional.
Definition at line 37 of file ProtectionForm.php.
Referenced by save().
|
protected |
A map of action to restriction level, from request or default.
Definition at line 31 of file ProtectionForm.php.