Public Member Functions | |
__construct (Article $article) | |
getExpiry ($action) | |
Get the expiry time for a given action, by combining the relevant inputs. | |
execute () | |
show ($err=null) | |
save () | |
buildForm () | |
Build the input form. | |
buildSelector ($action, $selected) | |
buildScript () | |
buildCleanupScript () | |
showLogExtract (&$out) | |
Public Attributes | |
$mRestrictions = array() | |
A map of action to restriction level, from request or default. | |
$mReason = '' | |
The custom/additional protection reason. | |
$mReasonSelection = '' | |
The reason selected from the list, blank for other/additional. | |
$mCascade = false | |
True if the restrictions are cascading, from request or 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. | |
$mApplicableTypes = array() | |
Types (i.e. | |
$mExistingExpiry = array() | |
Map of action to the expiry time of the existing protection. | |
Private Member Functions | |
getOptionLabel ($permission) | |
Prepare the label for a protection selector option. |
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html Handles the page protection UI and backend
Definition at line 25 of file ProtectionForm.php.
ProtectionForm::__construct | ( | Article $ | article | ) |
Definition at line 56 of file ProtectionForm.php.
References $action, $wgRequest, $wgRestrictionLevels, $wgRestrictionTypes, $wgUser, Article::exists(), and wfReadOnly().
ProtectionForm::buildCleanupScript | ( | ) |
Definition at line 521 of file ProtectionForm.php.
References $key, $options, $script, $wgGroupPermissions, $wgRestrictionLevels, Xml::encodeJsVar(), Xml::escapeJsString(), Xml::tags(), and wfMsg().
Referenced by buildForm().
ProtectionForm::buildForm | ( | ) |
Build the input form.
Definition at line 290 of file ProtectionForm.php.
References $action, $msg, $out, $t, $wgLang, $wgUser, buildCleanupScript(), buildScript(), buildSelector(), Xml::checkLabel(), Xml::closeElement(), Xml::element(), Xml::hidden(), Xml::input(), Xml::label(), Xml::listDropDown(), Title::makeTitleSafe(), Xml::openElement(), Xml::option(), Xml::submitButton(), Xml::tags(), wfEmptyMsg(), wfMsg(), wfMsgForContent(), and wfMsgHtml().
Referenced by show().
ProtectionForm::buildScript | ( | ) |
Definition at line 514 of file ProtectionForm.php.
References $wgStylePath, $wgStyleVersion, and Xml::tags().
Referenced by buildForm().
ProtectionForm::buildSelector | ( | $ | action, | |
$ | selected | |||
) |
Definition at line 463 of file ProtectionForm.php.
References $action, $key, $out, $wgRestrictionLevels, $wgUser, Xml::closeElement(), getOptionLabel(), Xml::openElement(), and Xml::option().
Referenced by buildForm().
ProtectionForm::execute | ( | ) |
Definition at line 158 of file ProtectionForm.php.
References $wgOut, $wgRequest, save(), and show().
ProtectionForm::getExpiry | ( | $ | action | ) |
Get the expiry time for a given action, by combining the relevant inputs.
Returns a 14-char timestamp or "infinity", or false if the input was invalid
Definition at line 134 of file ProtectionForm.php.
References $action, Block::infinity(), and wfTimestamp().
Referenced by save().
ProtectionForm::getOptionLabel | ( | $ | permission | ) | [private] |
Prepare the label for a protection selector option.
string | $permission Permission required |
Definition at line 502 of file ProtectionForm.php.
References $key, $msg, wfEmptyMsg(), and wfMsg().
Referenced by buildSelector().
ProtectionForm::save | ( | ) |
Definition at line 220 of file ProtectionForm.php.
References $action, $ok, $wgGroupPermissions, $wgOut, $wgRequest, $wgUser, getExpiry(), show(), wfMsg(), wfMsgForContent(), and wfTimestampNow().
Referenced by execute().
ProtectionForm::show | ( | $ | err = null |
) |
Definition at line 170 of file ProtectionForm.php.
References $title, $wgOut, $wgUser, buildForm(), showLogExtract(), wfMsg(), wfMsgHtml(), and wfReadOnly().
ProtectionForm::showLogExtract | ( | &$ | out | ) |
OutputPage | $out private |
Definition at line 547 of file ProtectionForm.php.
References $out, Xml::element(), and LogPage::logName().
Referenced by show().
ProtectionForm::$mApplicableTypes = array() |
Types (i.e.
actions) for which levels can be selected
Definition at line 51 of file ProtectionForm.php.
ProtectionForm::$mCascade = false |
True if the restrictions are cascading, from request or existing protection.
Definition at line 36 of file ProtectionForm.php.
ProtectionForm::$mExistingExpiry = array() |
Map of action to the expiry time of the existing protection.
Definition at line 54 of file ProtectionForm.php.
ProtectionForm::$mExpiry = array() |
Map of action to "other" expiry time.
Used in preference to mExpirySelection.
Definition at line 39 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 45 of file ProtectionForm.php.
ProtectionForm::$mPermErrors = array() |
ProtectionForm::$mReason = '' |
ProtectionForm::$mReasonSelection = '' |
The reason selected from the list, blank for other/additional.
Definition at line 33 of file ProtectionForm.php.
ProtectionForm::$mRestrictions = array() |
A map of action to restriction level, from request or default.
Definition at line 27 of file ProtectionForm.php.