summaryrefslogtreecommitdiff
path: root/includes/ProtectionForm.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/ProtectionForm.php')
-rw-r--r--includes/ProtectionForm.php57
1 files changed, 22 insertions, 35 deletions
diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php
index 1219da51..4cad7b74 100644
--- a/includes/ProtectionForm.php
+++ b/includes/ProtectionForm.php
@@ -157,7 +157,7 @@ class ProtectionForm {
$value = $this->mExpirySelection[$action];
}
if ( wfIsInfinity( $value ) ) {
- $time = wfGetDB( DB_SLAVE )->getInfinity();
+ $time = 'infinity';
} else {
$unix = strtotime( $value );
@@ -384,7 +384,12 @@ class ProtectionForm {
"mwProtect-$action-expires"
);
- $expiryFormOptions = '';
+ $expiryFormOptions = new XmlSelect( "wpProtectExpirySelection-$action", "mwProtectExpirySelection-$action", $this->mExpirySelection[$action] );
+ $expiryFormOptions->setAttribute( 'tabindex', '2' );
+ if ( $this->disabled ) {
+ $expiryFormOptions->setAttribute( 'disabled', 'disabled' );
+ }
+
if ( $this->mExistingExpiry[$action] ) {
if ( $this->mExistingExpiry[$action] == 'infinity' ) {
$existingExpiryMessage = $context->msg( 'protect-existing-expiry-infinity' );
@@ -394,29 +399,17 @@ class ProtectionForm {
$t = $lang->userTime( $this->mExistingExpiry[$action], $user );
$existingExpiryMessage = $context->msg( 'protect-existing-expiry', $timestamp, $d, $t );
}
- $expiryFormOptions .=
- Xml::option(
- $existingExpiryMessage->text(),
- 'existing',
- $this->mExpirySelection[$action] == 'existing'
- ) . "\n";
+ $expiryFormOptions->addOption( $existingExpiryMessage->text(), 'existing' );
}
- $expiryFormOptions .= Xml::option(
- $context->msg( 'protect-othertime-op' )->text(),
- "othertime"
- ) . "\n";
+ $expiryFormOptions->addOption( $context->msg( 'protect-othertime-op' )->text(), 'othertime' );
foreach ( explode( ',', $scExpiryOptions ) as $option ) {
if ( strpos( $option, ":" ) === false ) {
$show = $value = $option;
} else {
list( $show, $value ) = explode( ":", $option );
}
- $expiryFormOptions .= Xml::option(
- $show,
- htmlspecialchars( $value ),
- $this->mExpirySelection[$action] === $value
- ) . "\n";
+ $expiryFormOptions->addOption( $show, htmlspecialchars( $value ) );
}
# Add expiry dropdown
if ( $showProtectOptions && !$this->disabled ) {
@@ -426,12 +419,7 @@ class ProtectionForm {
{$mProtectexpiry}
</td>
<td class='mw-input'>" .
- Xml::tags( 'select',
- array(
- 'id' => "mwProtectExpirySelection-$action",
- 'name' => "wpProtectExpirySelection-$action",
- 'tabindex' => '2' ) + $this->disabledAttrib,
- $expiryFormOptions ) .
+ $expiryFormOptions->getHTML() .
"</td>
</tr></table>";
}
@@ -541,9 +529,8 @@ class ProtectionForm {
$out .= Xml::closeElement( 'fieldset' );
if ( $user->isAllowed( 'editinterface' ) ) {
- $title = Title::makeTitle( NS_MEDIAWIKI, 'Protect-dropdown' );
- $link = Linker::link(
- $title,
+ $link = Linker::linkKnown(
+ $context->msg( 'protect-dropdown' )->inContentLanguage()->getTitle(),
$context->msg( 'protect-edit-reasonlist' )->escaped(),
array(),
array( 'action' => 'edit' )
@@ -577,18 +564,18 @@ class ProtectionForm {
);
$id = 'mwProtect-level-' . $action;
- $attribs = array(
- 'id' => $id,
- 'name' => $id,
- 'size' => count( $levels ),
- ) + $this->disabledAttrib;
- $out = Xml::openElement( 'select', $attribs );
+ $select = new XmlSelect( $id, $id, $selected );
+ $select->setAttribute( 'size', count( $levels ) );
+ if ( $this->disabled ) {
+ $select->setAttribute( 'disabled', 'disabled' );
+ }
+
foreach ( $levels as $key ) {
- $out .= Xml::option( $this->getOptionLabel( $key ), $key, $key == $selected );
+ $select->addOption( $this->getOptionLabel( $key ), $key );
}
- $out .= Xml::closeElement( 'select' );
- return $out;
+
+ return $select->getHTML();
}
/**