dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add redirect=no only to redirects on redirect pages
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiParamInfo.php
diff --git
a/includes/api/ApiParamInfo.php
b/includes/api/ApiParamInfo.php
index
18ca0ab
..
6e44f82
100644
(file)
--- a/
includes/api/ApiParamInfo.php
+++ b/
includes/api/ApiParamInfo.php
@@
-48,7
+48,7
@@
class ApiParamInfo extends ApiBase {
if ( is_array( $params['modules'] ) ) {
$modules = $params['modules'];
} else {
if ( is_array( $params['modules'] ) ) {
$modules = $params['modules'];
} else {
- $modules =
array()
;
+ $modules =
[]
;
}
if ( is_array( $params['querymodules'] ) ) {
}
if ( is_array( $params['querymodules'] ) ) {
@@
-57,7
+57,7
@@
class ApiParamInfo extends ApiBase {
$modules[] = 'query+' . $m;
}
} else {
$modules[] = 'query+' . $m;
}
} else {
- $queryModules =
array()
;
+ $queryModules =
[]
;
}
if ( is_array( $params['formatmodules'] ) ) {
}
if ( is_array( $params['formatmodules'] ) ) {
@@
-66,10
+66,10
@@
class ApiParamInfo extends ApiBase {
$modules[] = $m;
}
} else {
$modules[] = $m;
}
} else {
- $formatModules =
array()
;
+ $formatModules =
[]
;
}
}
- $res =
array()
;
+ $res =
[]
;
foreach ( $modules as $m ) {
try {
foreach ( $modules as $m ) {
try {
@@
-100,7
+100,7
@@
class ApiParamInfo extends ApiBase {
}
$result = $this->getResult();
}
$result = $this->getResult();
- $result->addValue(
array( $this->getModuleName() )
, 'helpformat', $this->helpFormat );
+ $result->addValue(
[ $this->getModuleName() ]
, 'helpformat', $this->helpFormat );
foreach ( $res as $key => $stuff ) {
ApiResult::setIndexedTagName( $res[$key], 'module' );
foreach ( $res as $key => $stuff ) {
ApiResult::setIndexedTagName( $res[$key], 'module' );
@@
-133,7
+133,7
@@
class ApiParamInfo extends ApiBase {
break;
case 'wikitext':
break;
case 'wikitext':
- $ret =
array()
;
+ $ret =
[]
;
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->text();
}
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->text();
}
@@
-144,7
+144,7
@@
class ApiParamInfo extends ApiBase {
break;
case 'html':
break;
case 'html':
- $ret =
array()
;
+ $ret =
[]
;
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->parseAsBlock();
}
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->parseAsBlock();
}
@@
-156,12
+156,12
@@
class ApiParamInfo extends ApiBase {
break;
case 'raw':
break;
case 'raw':
- $res[$key] =
array()
;
+ $res[$key] =
[]
;
foreach ( $msgs as $m ) {
foreach ( $msgs as $m ) {
- $a =
array(
+ $a =
[
'key' => $m->getKey(),
'params' => $m->getParams(),
'key' => $m->getKey(),
'params' => $m->getParams(),
-
)
;
+
]
;
if ( $m instanceof ApiHelpParamValueMessage ) {
$a['forvalue'] = $m->getParamValue();
}
if ( $m instanceof ApiHelpParamValueMessage ) {
$a['forvalue'] = $m->getParamValue();
}
@@
-177,7
+177,7
@@
class ApiParamInfo extends ApiBase {
* @return ApiResult
*/
private function getModuleInfo( $module ) {
* @return ApiResult
*/
private function getModuleInfo( $module ) {
- $ret =
array()
;
+ $ret =
[]
;
$path = $module->getModulePath();
$ret['name'] = $module->getModuleName();
$path = $module->getModulePath();
$ret['name'] = $module->getModuleName();
@@
-216,23
+216,23
@@
class ApiParamInfo extends ApiBase {
$ret['helpurls'] = (array)$module->getHelpUrls();
if ( isset( $ret['helpurls'][0] ) && $ret['helpurls'][0] === false ) {
$ret['helpurls'] = (array)$module->getHelpUrls();
if ( isset( $ret['helpurls'][0] ) && $ret['helpurls'][0] === false ) {
- $ret['helpurls'] =
array()
;
+ $ret['helpurls'] =
[]
;
}
ApiResult::setIndexedTagName( $ret['helpurls'], 'helpurl' );
if ( $this->helpFormat !== 'none' ) {
}
ApiResult::setIndexedTagName( $ret['helpurls'], 'helpurl' );
if ( $this->helpFormat !== 'none' ) {
- $ret['examples'] =
array()
;
+ $ret['examples'] =
[]
;
$examples = $module->getExamplesMessages();
foreach ( $examples as $qs => $msg ) {
$examples = $module->getExamplesMessages();
foreach ( $examples as $qs => $msg ) {
- $item =
array(
+ $item =
[
'query' => $qs
'query' => $qs
-
)
;
- $msg = ApiBase::makeMessage( $msg, $this->context,
array(
+
]
;
+ $msg = ApiBase::makeMessage( $msg, $this->context,
[
$module->getModulePrefix(),
$module->getModuleName(),
$module->getModulePath()
$module->getModulePrefix(),
$module->getModuleName(),
$module->getModulePath()
-
)
);
- $this->formatHelpMessages( $item, 'description',
array( $msg )
);
+
]
);
+ $this->formatHelpMessages( $item, 'description',
[ $msg ]
);
if ( isset( $item['description'] ) ) {
if ( is_array( $item['description'] ) ) {
$item['description'] = $item['description'][0];
if ( isset( $item['description'] ) ) {
if ( is_array( $item['description'] ) ) {
$item['description'] = $item['description'][0];
@@
-245,17
+245,17
@@
class ApiParamInfo extends ApiBase {
ApiResult::setIndexedTagName( $ret['examples'], 'example' );
}
ApiResult::setIndexedTagName( $ret['examples'], 'example' );
}
- $ret['parameters'] =
array()
;
+ $ret['parameters'] =
[]
;
$params = $module->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
$paramDesc = $module->getFinalParamDescription();
foreach ( $params as $name => $settings ) {
if ( !is_array( $settings ) ) {
$params = $module->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
$paramDesc = $module->getFinalParamDescription();
foreach ( $params as $name => $settings ) {
if ( !is_array( $settings ) ) {
- $settings =
array( ApiBase::PARAM_DFLT => $settings )
;
+ $settings =
[ ApiBase::PARAM_DFLT => $settings ]
;
}
}
- $item =
array(
+ $item =
[
'name' => $name
'name' => $name
-
)
;
+
]
;
if ( isset( $paramDesc[$name] ) ) {
$this->formatHelpMessages( $item, 'description', $paramDesc[$name], true );
}
if ( isset( $paramDesc[$name] ) ) {
$this->formatHelpMessages( $item, 'description', $paramDesc[$name], true );
}
@@
-330,7
+330,7
@@
class ApiParamInfo extends ApiBase {
sort( $item['type'] );
$prefix = $module->isMain()
? '' : ( $module->getModulePath() . '+' );
sort( $item['type'] );
$prefix = $module->isMain()
? '' : ( $module->getModulePath() . '+' );
- $item['submodules'] =
array()
;
+ $item['submodules'] =
[]
;
foreach ( $item['type'] as $v ) {
$item['submodules'][$v] = $prefix . $v;
}
foreach ( $item['type'] as $v ) {
$item['submodules'][$v] = $prefix . $v;
}
@@
-338,6
+338,8
@@
class ApiParamInfo extends ApiBase {
if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
$item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
}
if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
$item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
}
+ } elseif ( $settings[ApiBase::PARAM_TYPE] === 'tags' ) {
+ $item['type'] = ChangeTags::listExplicitlyDefinedTags();
} else {
$item['type'] = $settings[ApiBase::PARAM_TYPE];
}
} else {
$item['type'] = $settings[ApiBase::PARAM_TYPE];
}
@@
-361,22
+363,22
@@
class ApiParamInfo extends ApiBase {
}
if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
}
if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
- $item['info'] =
array()
;
+ $item['info'] =
[]
;
foreach ( $settings[ApiBase::PARAM_HELP_MSG_INFO] as $i ) {
$tag = array_shift( $i );
foreach ( $settings[ApiBase::PARAM_HELP_MSG_INFO] as $i ) {
$tag = array_shift( $i );
- $info =
array(
+ $info =
[
'name' => $tag,
'name' => $tag,
-
)
;
+
]
;
if ( count( $i ) ) {
$info['values'] = $i;
ApiResult::setIndexedTagName( $info['values'], 'v' );
}
if ( count( $i ) ) {
$info['values'] = $i;
ApiResult::setIndexedTagName( $info['values'], 'v' );
}
- $this->formatHelpMessages( $info, 'text',
array(
+ $this->formatHelpMessages( $info, 'text',
[
$this->context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
->numParams( count( $i ) )
->params( $this->context->getLanguage()->commaList( $i ) )
->params( $module->getModulePrefix() )
$this->context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
->numParams( count( $i ) )
->params( $this->context->getLanguage()->commaList( $i ) )
->params( $module->getModulePrefix() )
-
)
);
+
]
);
ApiResult::setSubelementsList( $info, 'text' );
$item['info'][] = $info;
}
ApiResult::setSubelementsList( $info, 'text' );
$item['info'][] = $info;
}
@@
-392,12
+394,12
@@
class ApiParamInfo extends ApiBase {
if ( $this->helpFormat === 'none' ) {
$ret['dynamicparameters'] = true;
} else {
if ( $this->helpFormat === 'none' ) {
$ret['dynamicparameters'] = true;
} else {
- $dynamicParams = ApiBase::makeMessage( $dynamicParams, $this->context,
array(
+ $dynamicParams = ApiBase::makeMessage( $dynamicParams, $this->context,
[
$module->getModulePrefix(),
$module->getModuleName(),
$module->getModulePath()
$module->getModulePrefix(),
$module->getModuleName(),
$module->getModulePath()
-
)
);
- $this->formatHelpMessages( $ret, 'dynamicparameters',
array( $dynamicParams )
);
+
]
);
+ $this->formatHelpMessages( $ret, 'dynamicparameters',
[ $dynamicParams ]
);
}
}
}
}
@@
-416,39
+418,39
@@
class ApiParamInfo extends ApiBase {
$formatmodules = $this->getMain()->getModuleManager()->getNames( 'format' );
sort( $formatmodules );
$formatmodules = $this->getMain()->getModuleManager()->getNames( 'format' );
sort( $formatmodules );
- return
array(
- 'modules' =>
array(
+ return
[
+ 'modules' =>
[
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_ISMULTI => true,
-
)
,
- 'helpformat' =>
array(
+
]
,
+ 'helpformat' =>
[
ApiBase::PARAM_DFLT => 'none',
ApiBase::PARAM_DFLT => 'none',
- ApiBase::PARAM_TYPE =>
array( 'html', 'wikitext', 'raw', 'none' )
,
-
)
,
+ ApiBase::PARAM_TYPE =>
[ 'html', 'wikitext', 'raw', 'none' ]
,
+
]
,
- 'querymodules' =>
array(
+ 'querymodules' =>
[
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => $querymodules,
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => $querymodules,
-
)
,
- 'mainmodule' =>
array(
+
]
,
+ 'mainmodule' =>
[
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_DEPRECATED => true,
-
)
,
- 'pagesetmodule' =>
array(
+
]
,
+ 'pagesetmodule' =>
[
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_DEPRECATED => true,
-
)
,
- 'formatmodules' =>
array(
+
]
,
+ 'formatmodules' =>
[
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => $formatmodules,
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => $formatmodules,
- )
-
)
;
+ ]
+
]
;
}
protected function getExamplesMessages() {
}
protected function getExamplesMessages() {
- return
array(
+ return
[
'action=paraminfo&modules=parse|phpfm|query+allpages|query+siteinfo'
=> 'apihelp-paraminfo-example-1',
'action=paraminfo&modules=parse|phpfm|query+allpages|query+siteinfo'
=> 'apihelp-paraminfo-example-1',
-
)
;
+
]
;
}
public function getHelpUrls() {
}
public function getHelpUrls() {