X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiHelp.php;h=ea4f724abff6621a552f937dbbea56984c04920e;hp=3fd29ae928ab52567614bb9f36a30278015c631c;hb=c75f0e95c9888489961548c72ef24786c43838aa;hpb=aae0c8d42562d5d3f70cc18fa687ae331996b66f diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 3fd29ae928..ea4f724abf 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -4,7 +4,7 @@ * * Created on Aug 29, 2014 * - * Copyright © 2014 Brad Jorsch + * Copyright © 2014 Wikimedia Foundation and contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,6 +62,7 @@ class ApiHelp extends ApiBase { if ( $params['wrap'] ) { $data = [ 'mime' => 'text/html', + 'filename' => 'api-help.html', 'help' => $html, ]; ApiResult::setSubelementsList( $data, 'help' ); @@ -70,6 +71,7 @@ class ApiHelp extends ApiBase { $result->reset(); $result->addValue( null, 'text', $html, ApiResult::NO_SIZE_CHECK ); $result->addValue( null, 'mime', 'text/html', ApiResult::NO_SIZE_CHECK ); + $result->addValue( null, 'filename', 'api-help.html', ApiResult::NO_SIZE_CHECK ); } } @@ -485,7 +487,9 @@ class ApiHelp extends ApiBase { $type = $settings[ApiBase::PARAM_TYPE]; $multi = !empty( $settings[ApiBase::PARAM_ISMULTI] ); $hintPipeSeparated = true; - $count = ApiBase::LIMIT_SML2 + 1; + $count = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT2] ) + ? $settings[ApiBase::PARAM_ISMULTI_LIMIT2] + 1 + : ApiBase::LIMIT_SML2 + 1; if ( is_array( $type ) ) { $count = count( $type ); @@ -669,13 +673,25 @@ class ApiHelp extends ApiBase { if ( $multi ) { $extra = []; + $lowcount = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT1] ) + ? $settings[ApiBase::PARAM_ISMULTI_LIMIT1] + : ApiBase::LIMIT_SML1; + $highcount = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT2] ) + ? $settings[ApiBase::PARAM_ISMULTI_LIMIT2] + : ApiBase::LIMIT_SML2; + if ( $hintPipeSeparated ) { $extra[] = $context->msg( 'api-help-param-multi-separate' )->parse(); } - if ( $count > ApiBase::LIMIT_SML1 ) { - $extra[] = $context->msg( 'api-help-param-multi-max' ) - ->numParams( ApiBase::LIMIT_SML1, ApiBase::LIMIT_SML2 ) - ->parse(); + if ( $count > $lowcount ) { + if ( $lowcount === $highcount ) { + $msg = $context->msg( 'api-help-param-multi-max-simple' ) + ->numParams( $lowcount ); + } else { + $msg = $context->msg( 'api-help-param-multi-max' ) + ->numParams( $lowcount, $highcount ); + } + $extra[] = $msg->parse(); } if ( $extra ) { $info[] = implode( ' ', $extra );