MediaWiki  REL1_24
ProtectionForm Class Reference

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

Collaboration diagram for ProtectionForm:

List of all members.

Public Member Functions

 __construct (Article $article)
 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.

Protected Attributes

array $mApplicableTypes = array()
 Types (i.e.
bool $mCascade = false
 True if the restrictions are cascading, from request or existing protection *.
array $mExistingExpiry = array()
 Map of action to the expiry time of the existing protection *.
array $mExpiry = array()
 Map of action to "other" expiry time.
array $mExpirySelection = array()
 Map of action to value selected in expiry drop-down list.
array $mPermErrors = array()
 Permissions errors for the protect action *.
 $mReason = ''
 $mReasonSelection = ''
array $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.

Private Attributes

IContextSource $mContext
 *

Detailed Description

Handles the page protection UI and backend.

Definition at line 29 of file ProtectionForm.php.


Constructor & Destructor Documentation

Definition at line 55 of file ProtectionForm.php.


Member Function Documentation

error also a ContextSource error or success ProtectionForm::buildForm ( )

Build the input form.

Returns:
string HTML form

Definition at line 336 of file ProtectionForm.php.

ProtectionForm::buildSelector ( action,
selected 
)

Build protection level selector.

Parameters:
string$actionAction to protect
string$selectedCurrent protection level
Returns:
string HTML fragment

Definition at line 565 of file ProtectionForm.php.

References $attribs, $key, $out, array(), as, Xml\closeElement(), getOptionLabel(), MWNamespace\getRestrictionLevels(), Xml\openElement(), and Xml\option().

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

Definition at line 170 of file ProtectionForm.php.

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

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

Definition at line 143 of file ProtectionForm.php.

References $time, $value, and wfGetDB().

ProtectionForm::getOptionLabel ( permission) [private]

Prepare the label for a protection selector option.

Parameters:
string$permissionPermission required
Returns:
string

Definition at line 593 of file ProtectionForm.php.

Referenced by buildSelector().

Loads the current state of protection into the object.

Definition at line 81 of file ProtectionForm.php.

Save submitted protection form.

Returns:
bool Success

Definition at line 254 of file ProtectionForm.php.

ProtectionForm::show ( err = null)

Show the input form with optional error message.

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

Definition at line 190 of file ProtectionForm.php.

Show protection long extracts for this page.

Parameters:
OutputPage$outprivate

Definition at line 612 of file ProtectionForm.php.


Member Data Documentation

array ProtectionForm::$mApplicableTypes = array() [protected]

Types (i.e.

actions) for which levels can be selected *

Definition at line 49 of file ProtectionForm.php.

bool ProtectionForm::$mCascade = false [protected]

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

Definition at line 38 of file ProtectionForm.php.

IContextSource ProtectionForm::$mContext [private]

*

Definition at line 53 of file ProtectionForm.php.

array ProtectionForm::$mExistingExpiry = array() [protected]

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

Definition at line 51 of file ProtectionForm.php.

array ProtectionForm::$mExpiry = array() [protected]

Map of action to "other" expiry time.

Used in preference to mExpirySelection. *

Definition at line 40 of file ProtectionForm.php.

array ProtectionForm::$mExpirySelection = array() [protected]

Map of action to value selected in expiry drop-down list.

Will be set to 'othertime' whenever mExpiry is set.

Definition at line 45 of file ProtectionForm.php.

array ProtectionForm::$mPermErrors = array() [protected]

Permissions errors for the protect action *.

Definition at line 47 of file ProtectionForm.php.

ProtectionForm::$mReason = '' [protected]

Definition at line 33 of file ProtectionForm.php.

ProtectionForm::$mReasonSelection = '' [protected]

Definition at line 36 of file ProtectionForm.php.

array ProtectionForm::$mRestrictions = array() [protected]

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

Definition at line 30 of file ProtectionForm.php.


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