<?php
/**
- *
- *
- * Created on Sep 5, 2006
- *
* Copyright © 2006, 2010 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* ((string|array|Message)[]) When PARAM_TYPE is an array, this is an array
* mapping those values to $msg for ApiBase::makeMessage(). Any value not
* having a mapping will use apihelp-{$path}-paramvalue-{$param}-{$value}.
+ * Specify an empty array to use the default message key for all values.
* @since 1.25
*/
const PARAM_HELP_MSG_PER_VALUE = 14;
if ( $badParams ) {
$this->dieWithError(
- [ 'apierror-mustpostparams', join( ', ', $badParams ), count( $badParams ) ]
+ [ 'apierror-mustpostparams', implode( ', ', $badParams ), count( $badParams ) ]
);
}
}
if ( $multi ) {
// This loses the potential $wgContLang->checkTitleEncoding() transformation
// done by WebRequest for $_GET. Let's call that a feature.
- $value = join( "\x1f", $request->normalizeUnicode( explode( "\x1f", $rawValue ) ) );
+ $value = implode( "\x1f", $request->normalizeUnicode( explode( "\x1f", $rawValue ) ) );
} else {
$this->dieWithError( 'apierror-badvalue-notmultivalue', 'badvalue_notmultivalue' );
}
protected function parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues,
$allSpecifier = null, $limit1 = null, $limit2 = null
) {
- if ( ( trim( $value ) === '' || trim( $value ) === "\x1f" ) && $allowMultiple ) {
+ if ( ( $value === '' || $value === "\x1f" ) && $allowMultiple ) {
return [];
}
$limit1 = $limit1 ?: self::LIMIT_SML1;
* @return string Validated and normalized parameter
*/
private function validateUser( $value, $encParamName ) {
+ if ( ExternalUserNames::isExternal( $value ) && User::newFromName( $value, false ) ) {
+ return $value;
+ }
+
$title = Title::makeTitleSafe( NS_USER, $value );
if ( $title === null || $title->hasFragment() ) {
$this->dieWithError(
$msgs = [ $this->msg( 'api-usage-mailinglist-ref' ) ];
Hooks::run( 'ApiDeprecationHelp', [ &$msgs ] );
if ( count( $msgs ) > 1 ) {
- $key = '$' . join( ' $', range( 1, count( $msgs ) ) );
+ $key = '$' . implode( ' $', range( 1, count( $msgs ) ) );
$msg = ( new RawMessage( $key ) )->params( $msgs );
} else {
$msg = reset( $msgs );