* (wpFormIdentifier).
*
* @param WebRequest $request
- * @return boolean
+ * @return bool
*/
protected function isSubmitAttempt( WebRequest $request ) {
return $request->getCheck( 'wpEditToken' ) || $request->getCheck( 'wpFormIdentifier' );
$this->mDir = $params['dir'];
}
- $validName = Sanitizer::escapeId( $this->mName );
- $validName = str_replace( [ '.5B', '.5D' ], [ '[', ']' ], $validName );
+ $validName = urlencode( $this->mName );
+ $validName = str_replace( [ '%5B', '%5D' ], [ '[', ']' ], $validName );
if ( $this->mName != $validName && !isset( $params['nodata'] ) ) {
throw new MWException( "Invalid name '{$this->mName}' passed to " . __METHOD__ );
}
if ( isset( $params['id'] ) ) {
$id = $params['id'];
- $validId = Sanitizer::escapeId( $id );
+ $validId = urlencode( $id );
if ( $id != $validId ) {
throw new MWException( "Invalid id '$id' passed to " . __METHOD__ );
/**
* Get a FieldLayout (or subclass thereof) to wrap this field in when using OOUI output.
+ * @param string $inputField
+ * @param array $config
* @return OOUI\FieldLayout|OOUI\ActionFieldLayout
*/
protected function getFieldLayoutOOUI( $inputField, $config ) {
$this->mOptionsLabelsNotFromMessage = true;
$this->mOptions = self::forceToStringRecursive( $this->mParams['options'] );
} elseif ( array_key_exists( 'options-message', $this->mParams ) ) {
- /** @todo This is copied from Xml::listDropDown(), deprecate/avoid duplication? */
$message = $this->getMessage( $this->mParams['options-message'] )->inContentLanguage()->plain();
-
- $optgroup = false;
- $this->mOptions = [];
- foreach ( explode( "\n", $message ) as $option ) {
- $value = trim( $option );
- if ( $value == '' ) {
- continue;
- } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
- # A new group is starting...
- $value = trim( substr( $value, 1 ) );
- $optgroup = $value;
- } elseif ( substr( $value, 0, 2 ) == '**' ) {
- # groupmember
- $opt = trim( substr( $value, 2 ) );
- if ( $optgroup === false ) {
- $this->mOptions[$opt] = $opt;
- } else {
- $this->mOptions[$optgroup][$opt] = $opt;
- }
- } else {
- # groupless reason list
- $optgroup = false;
- $this->mOptions[$option] = $option;
- }
- }
+ $this->mOptions = Xml::listDropDownOptions( $message );
} else {
$this->mOptions = null;
}
return null;
}
- $options = [];
-
- foreach ( $oldoptions as $text => $data ) {
- $options[] = [
- 'data' => (string)$data,
- 'label' => (string)$text,
- ];
- }
-
- return $options;
+ return Xml::listDropDownOptionsOoui( $oldoptions );
}
/**
* Whether this field requires the user agent to have JavaScript enabled for the client-side HTML5
* form validation to work correctly.
*
- * @return boolean
+ * @return bool
* @since 1.29
*/
public function needsJSForHtml5FormValidation() {