r95879 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95878‎ | r95879 | r95880 >
Date:15:58, 31 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed handling of list params in ParamInput
Modified paths:
  • /trunk/extensions/Validator/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/Validator/includes/ListParameter.php (modified) (history)
  • /trunk/extensions/Validator/includes/ParameterInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/RELEASE-NOTES
@@ -8,6 +8,7 @@
99 (2011-09-xx)
1010
1111 * Fixed compatibility fallback in Parameter::getDescription.
 12+* Fixed handling of list parameters in ParameterInput.
1213
1314 === Validator 0.4.10 ===
1415 (2011-08-04)
Index: trunk/extensions/Validator/includes/ParameterInput.php
@@ -130,10 +130,16 @@
131131 *
132132 * @since 0.4.6
133133 *
134 - * @return mixed
 134+ * @return string
135135 */
136136 protected function getValueToUse() {
137 - return $this->currentValue === false ? $this->param->getDefault() : $this->currentValue;
 137+ $value = $this->currentValue === false ? $this->param->getDefault() : $this->currentValue;
 138+
 139+ if ( $this->param->isList() && is_array( $value ) ) {
 140+ $value = implode( $this->param->getDelimiter(), $value );
 141+ }
 142+
 143+ return $value;
138144 }
139145
140146 /**
Index: trunk/extensions/Validator/includes/ListParameter.php
@@ -233,4 +233,15 @@
234234 $this->setDoManipulationOfDefault( $manipulate );
235235 }
236236
 237+ /**
 238+ * Returns the delimiter.
 239+ *
 240+ * @since 0.4.11
 241+ *
 242+ * @return string
 243+ */
 244+ public function getDelimiter() {
 245+ return $this->delimiter;
 246+ }
 247+
237248 }
\ No newline at end of file