Merge "Title: Refactor JS/CSS page handling to be more sane"
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index 83d2ae9..228d319 100644 (file)
@@ -1,9 +1,5 @@
 <?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
@@ -155,6 +151,7 @@ abstract class ApiBase extends ContextSource {
         * ((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;
@@ -900,7 +897,7 @@ abstract class ApiBase extends ContextSource {
 
                if ( $badParams ) {
                        $this->dieWithError(
-                               [ 'apierror-mustpostparams', join( ', ', $badParams ), count( $badParams ) ]
+                               [ 'apierror-mustpostparams', implode( ', ', $badParams ), count( $badParams ) ]
                        );
                }
        }
@@ -1029,7 +1026,7 @@ abstract class ApiBase extends ContextSource {
         * @param string $paramName Parameter name
         * @param array|mixed $paramSettings Default value or an array of settings
         *  using PARAM_* constants.
-        * @param bool $parseLimit Parse limit?
+        * @param bool $parseLimit Whether to parse and validate 'limit' parameters
         * @return mixed Parameter value
         */
        protected function getParameterFromSettings( $paramName, $paramSettings, $parseLimit ) {
@@ -1155,7 +1152,7 @@ abstract class ApiBase extends ContextSource {
                                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' );
                                }
@@ -1407,7 +1404,7 @@ abstract class ApiBase extends ContextSource {
        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;
@@ -1832,7 +1829,7 @@ abstract class ApiBase extends ContextSource {
                $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 );