MediaWiki  REL1_19
ProtectionForm Class Reference

Handles the page protection UI and backend. More...

List of all members.

Public Member Functions

 __construct (Page $article)
 buildCleanupScript ()
 buildForm ()
 Build the input form.
 buildSelector ($action, $selected)
 Build protection level selector.
 execute ()
 Main entry point for action=protect and action=unprotect.
 getExpiry ($action)
 Get the expiry time for a given action, by combining the relevant inputs.
 loadData ()
 Loads the current state of protection into the object.
 save ()
 Save submitted protection form.
 show ($err=null)
 Show the input form with optional error message.
 showLogExtract (&$out)
 Show protection long extracts for this page.

Public Attributes

 $mApplicableTypes = array()
 Types (i.e.
 $mCascade = false
 True if the restrictions are cascading, from request or existing protection.
 $mExistingExpiry = array()
 Map of action to the expiry time of the existing protection.
 $mExpiry = array()
 Map of action to "other" expiry time.
 $mExpirySelection = array()
 Map of action to value selected in expiry drop-down list.
 $mPermErrors = array()
 Permissions errors for the protect action.
 $mReason = ''
 The custom/additional protection reason.
 $mReasonSelection = ''
 The reason selected from the list, blank for other/additional.
 $mRestrictions = array()
 A map of action to restriction level, from request or default.

Private Member Functions

 getOptionLabel ($permission)
 Prepare the label for a protection selector option.

Detailed Description

Handles the page protection UI and backend.

Definition at line 29 of file ProtectionForm.php.


Constructor & Destructor Documentation

Definition at line 60 of file ProtectionForm.php.

References $wgUser, loadData(), wfReadOnly(), and wfReadOnlyReason().

Here is the call graph for this function:


Member Function Documentation

Definition at line 578 of file ProtectionForm.php.

References $options, $wgGroupPermissions, $wgOut, $wgRestrictionLevels, Xml\encodeJsCall(), Html\inlineScript(), ResourceLoader\makeLoaderConditionalScript(), and wfMessage().

Referenced by buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

Build the input form.

Returns:
String: HTML form

Definition at line 334 of file ProtectionForm.php.

References $out, $t, $title, $wgLang, $wgOut, $wgUser, buildCleanupScript(), buildSelector(), Xml\checkLabel(), Xml\closeElement(), Xml\element(), Html\hidden(), Xml\input(), Xml\label(), Linker\link(), Xml\listDropDown(), Title\makeTitle(), Xml\openElement(), Xml\option(), Xml\submitButton(), Xml\tags(), wfMessage(), wfMsg(), wfMsgForContent(), wfMsgHtml(), and wfRunHooks().

Referenced by show().

Here is the call graph for this function:

Here is the caller graph for this function:

ProtectionForm::buildSelector ( action,
selected 
)

Build protection level selector.

Parameters:
$actionString: action to protect
$selectedString: current protection level
Returns:
String: HTML fragment

Definition at line 527 of file ProtectionForm.php.

References $out, $wgRestrictionLevels, $wgUser, Xml\closeElement(), getOptionLabel(), Xml\openElement(), and Xml\option().

Referenced by buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

Main entry point for action=protect and action=unprotect.

Definition at line 184 of file ProtectionForm.php.

References $wgOut, save(), and show().

Here is the call graph for this function:

Get the expiry time for a given action, by combining the relevant inputs.

Parameters:
$actionstring
Returns:
string 14-char timestamp or "infinity", or false if the input was invalid

Definition at line 157 of file ProtectionForm.php.

References wfGetDB(), and wfTimestamp().

Referenced by save().

Here is the call graph for this function:

Here is the caller graph for this function:

ProtectionForm::getOptionLabel ( permission) [private]

Prepare the label for a protection selector option.

Parameters:
$permissionString: permission required
Returns:
String

Definition at line 566 of file ProtectionForm.php.

References wfMessage(), and wfMsg().

Referenced by buildSelector().

Here is the call graph for this function:

Here is the caller graph for this function:

Loads the current state of protection into the object.

Definition at line 84 of file ProtectionForm.php.

References $wgRestrictionLevels, and $wgUser.

Referenced by __construct().

Here is the caller graph for this function:

Save submitted protection form.

Returns:
Boolean: success

Definition at line 249 of file ProtectionForm.php.

References $wgGroupPermissions, $wgOut, $wgUser, WatchAction\doUnwatch(), WatchAction\doWatch(), getExpiry(), show(), wfMsgForContent(), wfRunHooks(), and wfTimestampNow().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

ProtectionForm::show ( err = null)

Show the input form with optional error message.

Parameters:
$errString: error message or null if there's no error

Definition at line 206 of file ProtectionForm.php.

References $title, $wgOut, buildForm(), showLogExtract(), wfEscapeWikiText(), and wfMessage().

Referenced by execute(), and save().

Here is the call graph for this function:

Here is the caller graph for this function:

Show protection long extracts for this page.

Parameters:
$outOutputPage private

Definition at line 607 of file ProtectionForm.php.

References $out, Xml\element(), LogPage\logName(), and wfRunHooks().

Referenced by show().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

ProtectionForm::$mApplicableTypes = array()

Types (i.e.

actions) for which levels can be selected

Definition at line 55 of file ProtectionForm.php.

ProtectionForm::$mCascade = false

True if the restrictions are cascading, from request or existing protection.

Definition at line 40 of file ProtectionForm.php.

ProtectionForm::$mExistingExpiry = array()

Map of action to the expiry time of the existing protection.

Definition at line 58 of file ProtectionForm.php.

ProtectionForm::$mExpiry = array()

Map of action to "other" expiry time.

Used in preference to mExpirySelection.

Definition at line 43 of file ProtectionForm.php.

ProtectionForm::$mExpirySelection = array()

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.

ProtectionForm::$mPermErrors = array()

Permissions errors for the protect action.

Definition at line 52 of file ProtectionForm.php.

ProtectionForm::$mReason = ''

The custom/additional protection reason.

Definition at line 34 of file ProtectionForm.php.

ProtectionForm::$mReasonSelection = ''

The reason selected from the list, blank for other/additional.

Definition at line 37 of file ProtectionForm.php.

ProtectionForm::$mRestrictions = array()

A map of action to restriction level, from request or default.

Definition at line 31 of file ProtectionForm.php.


The documentation for this class was generated from the following file: