/**
* Set a message to display on a validation error.
- * @param $msg Mixed String or Array of valid inputs to wfMsgExt()
+ * @param $msg Mixed String or Array of valid inputs to wfMessage()
* (so each entry can be either a String or Array)
* @return HTMLForm $this for chaining calls (since 1.20)
*/
'input',
array(
'type' => 'reset',
- 'value' => wfMsg( 'htmlform-reset' )
+ 'value' => wfMessage( 'htmlform-reset' )->text()
)
) . "\n";
}
$errorstr .= Html::rawElement(
'li',
array(),
- wfMsgExt( $msg, array( 'parseinline' ), $error )
+ wfMessage( $msg, $error )->parse()
);
}
function getSubmitText() {
return $this->mSubmitText
? $this->mSubmitText
- : wfMsg( 'htmlform-submit' );
+ : wfMessage( 'htmlform-submit' )->text();
}
/**
* @return String
*/
public function getLegend( $key ) {
- return wfMsg( "{$this->mMessagePrefix}-$key" );
+ return wfMessage( "{$this->mMessagePrefix}-$key" )->text();
}
/**
*/
function validate( $value, $alldata ) {
if ( isset( $this->mParams['required'] ) && $this->mParams['required'] !== false && $value === '' ) {
- return wfMsgExt( 'htmlform-required', 'parseinline' );
+ return wfMessage( 'htmlform-required' )->parse();
}
if ( isset( $this->mValidationCallback ) ) {
$msgInfo = array();
}
- $this->mLabel = wfMsgExt( $msg, 'parseinline', $msgInfo );
+ $this->mLabel = wfMessage( $msg, $msgInfo )->parse();
} elseif ( isset( $params['label'] ) ) {
$this->mLabel = $params['label'];
}
# http://dev.w3.org/html5/spec/common-microsyntaxes.html#real-numbers
# with the addition that a leading '+' sign is ok.
if ( !preg_match( '/^((\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?)?$/i', $value ) ) {
- return wfMsgExt( 'htmlform-float-invalid', 'parse' );
+ return wfMessage( 'htmlform-float-invalid' )->parseAsBlock();
}
# The "int" part of these message names is rather confusing.
$min = $this->mParams['min'];
if ( $min > $value ) {
- return wfMsgExt( 'htmlform-int-toolow', 'parse', array( $min ) );
+ return wfMessage( 'htmlform-int-toolow', array( $min ) )->parseAsBlock();
}
}
$max = $this->mParams['max'];
if ( $max < $value ) {
- return wfMsgExt( 'htmlform-int-toohigh', 'parse', array( $max ) );
+ return wfMessage( 'htmlform-int-toohigh', array( $max ) )->parseAsBlock();
}
}
# value to, eg, save in the DB, clean it up with intval().
if ( !preg_match( '/^((\+|\-)?\d+)?$/', trim( $value ) )
) {
- return wfMsgExt( 'htmlform-int-invalid', 'parse' );
+ return wfMessage( 'htmlform-int-invalid' )->parseAsBlock();
}
return true;
if ( in_array( $value, $validOptions ) )
return true;
else
- return wfMsgExt( 'htmlform-select-badoption', 'parseinline' );
+ return wfMessage( 'htmlform-select-badoption' )->parse();
}
function getInputHTML( $value ) {
function __construct( $params ) {
if ( !in_array( 'other', $params['options'], true ) ) {
- $msg = isset( $params['other'] ) ? $params['other'] : wfMsg( 'htmlform-selectorother-other' );
+ $msg = isset( $params['other'] ) ?
+ $params['other'] :
+ wfMessage( 'htmlform-selectorother-other' )->text();
$params['options'][$msg] = 'other';
}
if ( count( $validValues ) == count( $value ) ) {
return true;
} else {
- return wfMsgExt( 'htmlform-select-badoption', 'parseinline' );
+ return wfMessage( 'htmlform-select-badoption' )->parse();
}
}
} elseif ( $text == '' ) {
$final = $list;
} else {
- $final = $list . wfMsgForContent( 'colon-separator' ) . $text;
+ $final = $list . wfMessage( 'colon-separator' )->inContentLanguage()->text() . $text;
}
} else {
$list = 'other';
$text = $final;
foreach ( $this->mFlatOptions as $option ) {
- $match = $option . wfMsgForContent( 'colon-separator' );
+ $match = $option . wfMessage( 'colon-separator' )->inContentLanguage()->text();
if ( strpos( $text, $match ) === 0 ) {
$list = $option;
$text = substr( $text, strlen( $match ) );
}
if ( isset( $this->mParams['required'] ) && $this->mParams['required'] !== false && $value[1] === '' ) {
- return wfMsgExt( 'htmlform-required', 'parseinline' );
+ return wfMessage( 'htmlform-required' )->parse();
}
return true;
if ( in_array( $value, $validOptions ) ) {
return true;
} else {
- return wfMsgExt( 'htmlform-select-badoption', 'parseinline' );
+ return wfMessage( 'htmlform-select-badoption' )->parse();
}
}