Add support for preloadparams[]

Bug: 70493
Change-Id: Ice61fd0581b3ef8220b6a603b52463c973fb770b
This commit is contained in:
Jackmcbarn 2014-09-06 21:23:19 -04:00 committed by Kunal Mehta
parent dfcfb58337
commit 2b9fbd23d6
2 changed files with 28 additions and 2 deletions

View file

@ -15,6 +15,7 @@ class InputBox {
private $mType = ''; private $mType = '';
private $mWidth = 50; private $mWidth = 50;
private $mPreload = ''; private $mPreload = '';
private $mPreloadparams = array();
private $mEditIntro = ''; private $mEditIntro = '';
private $mSummary = ''; private $mSummary = '';
private $mNosummary = ''; private $mNosummary = '';
@ -367,6 +368,15 @@ class InputBox {
'value' => $this->mPreload, 'value' => $this->mPreload,
) )
); );
foreach ( $this->mPreloadparams as $preloadparams ) {
$htmlOut .= Xml::openElement( 'input',
array(
'type' => 'hidden',
'name' => 'preloadparams[]',
'value' => $preloadparams,
)
);
}
$htmlOut .= Xml::openElement( 'input', $htmlOut .= Xml::openElement( 'input',
array( array(
'type' => 'hidden', 'type' => 'hidden',
@ -551,6 +561,15 @@ class InputBox {
'value' => $this->mPreload, 'value' => $this->mPreload,
) )
); );
foreach ( $this->mPreloadparams as $preloadparams ) {
$htmlOut .= Xml::openElement( 'input',
array(
'type' => 'hidden',
'name' => 'preloadparams[]',
'value' => $preloadparams,
)
);
}
$htmlOut .= Xml::openElement( 'input', $htmlOut .= Xml::openElement( 'input',
array( array(
'type' => 'hidden', 'type' => 'hidden',
@ -613,7 +632,14 @@ class InputBox {
if ( strpos( $line, '=' ) === false ) if ( strpos( $line, '=' ) === false )
continue; continue;
list( $name, $value ) = explode( '=', $line, 2 ); list( $name, $value ) = explode( '=', $line, 2 );
$values[ strtolower( trim( $name ) ) ] = Sanitizer::decodeCharReferences( trim( $value ) ); $name = strtolower( trim( $name ) );
$value = Sanitizer::decodeCharReferences( trim( $value ) );
if ( $name == 'preloadparams[]' ) {
// We have to special-case this one because it's valid for it to appear more than once.
$this->mPreloadparams[] = $value;
} else {
$values[ $name ] = $value;
}
} }
// Validate the dir value. // Validate the dir value.

View file

@ -33,7 +33,7 @@ $wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__, 'path' => __FILE__,
'name' => 'InputBox', 'name' => 'InputBox',
'author' => array( 'Erik Moeller', 'Leonardo Pimenta', 'Rob Church', 'Trevor Parscal', 'DaSch' ), 'author' => array( 'Erik Moeller', 'Leonardo Pimenta', 'Rob Church', 'Trevor Parscal', 'DaSch' ),
'version' => '0.2.0', 'version' => '0.3.0',
'url' => 'https://www.mediawiki.org/wiki/Extension:InputBox', 'url' => 'https://www.mediawiki.org/wiki/Extension:InputBox',
'description' => 'Allow inclusion of predefined HTML forms.', 'description' => 'Allow inclusion of predefined HTML forms.',
'descriptionmsg' => 'inputbox-desc', 'descriptionmsg' => 'inputbox-desc',