本文整理汇总了PHP中ApiMain::getFormats方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiMain::getFormats方法的具体用法?PHP ApiMain::getFormats怎么用?PHP ApiMain::getFormats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiMain
的用法示例。
在下文中一共展示了ApiMain::getFormats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInputs
/**
* @return string
*/
private function getInputs()
{
global $wgEnableWriteAPI;
$apiMain = new ApiMain(new FauxRequest(array()), $wgEnableWriteAPI);
$this->apiQuery = new ApiQuery($apiMain, 'query');
$formats = array_filter(array_keys($apiMain->getFormats()), 'SpecialApiSandbox::filterFormats');
sort($formats);
$modules = array_keys($apiMain->getModules());
sort($modules);
$key = array_search('query', $modules);
if ($key !== false) {
array_splice($modules, $key, 1);
array_unshift($modules, 'query');
}
$queryModules = array_merge($this->getQueryModules('list'), $this->getQueryModules('prop'), $this->getQueryModules('meta'));
$s = '<table class="api-sandbox-options">
<tbody>
';
$s .= '<tr><td class="api-sandbox-label"><label for="api-sandbox-format">format=</label></td><td class="api-sandbox-value">' . self::getSelect('format', $formats, 'json') . '</td><td></td></tr>
';
$s .= '<tr><td class="api-sandbox-label"><label for="api-sandbox-action">action=</label></td><td class="api-sandbox-value">' . self::getSelect('action', $modules) . '</td><td id="api-sandbox-help" rowspan="2"></td></tr>
';
$s .= '<tr id="api-sandbox-query-row" style="display: none"><td class="api-sandbox-label">' . '</td><td class="api-sandbox-value">' . self::getSelect('query', $queryModules) . '</td></tr>
</table>
';
$s .= '<div id="api-sandbox-main-inputs"></div><div id="api-sandbox-query-inputs" style="display: none"></div>' . $this->openFieldset('generic-parameters') . '<div id="api-sandbox-generic-inputs" class="mw-collapsible mw-collapsed"></div></fieldset>' . $this->openFieldset('generator-parameters', array('style' => 'display: none;')) . '<div id="api-sandbox-generator-inputs"></div></fieldset>
';
$s .= Html::element('input', array('type' => 'submit', 'id' => 'api-sandbox-submit', 'value' => wfMessage('apisb-submit')->text(), 'disabled' => 'disabled')) . "\n";
return $s;
}
示例2: getInputs
/**
* @return string
*/
private function getInputs()
{
global $wgEnableWriteAPI;
$apiMain = new ApiMain(new FauxRequest(array()), $wgEnableWriteAPI);
$this->apiQuery = new ApiQuery($apiMain, 'query');
$formats = array_filter(array_keys($apiMain->getFormats()), 'SpecialApiSandbox::filterFormats');
sort($formats);
$formatOptions = array_combine($formats, $formats);
$modules = array_keys($apiMain->getModules());
sort($modules);
$key = array_search('query', $modules);
if ($key !== false) {
array_splice($modules, $key, 1);
array_unshift($modules, 'query');
}
$moduleOptions = array_combine($modules, $modules);
$queryModules = array_merge($this->getQueryModules('list'), $this->getQueryModules('prop'), $this->getQueryModules('meta'));
#$s = '<div id="api-sandbox-buttons"></div>';
#$s .= '<div id="api-sandbox-examples" style="display: none;"></div>';
$s = '
<table class="api-sandbox-options">
<tbody>
<tr>
<th><label for="api-sandbox-format">' . $this->msg('apisb-label-format')->escaped() . '</label></th>
<th><label for="api-sandbox-action">' . $this->msg('apisb-label-action')->escaped() . '</label></th>
<th class="api-sandbox-docs-col">' . $this->msg('apisb-label-doc')->escaped() . '</th>
</tr>
<tr>
<td>' . $this->getSelect('format', $formatOptions, 'json') . '</td>
<td>
' . $this->getSelect('action', $moduleOptions) . '
<div id="api-sandbox-query-row" style="display: none;">
' . $this->getSelect('query', $queryModules) . '
</div>
</td>
<td class="api-sandbox-docs-col">
<div id="api-sandbox-buttons"></div>
<div dir="ltr" id="api-sandbox-help"></div>
<div id="api-sandbox-examples" style="display: none;"></div>
</td>
</tr>
</tbody>
</table>
';
$s .= '<div id="api-sandbox-main-inputs"></div><div id="api-sandbox-query-inputs" style="display: none"></div>' . $this->openFieldset('generic-parameters') . '<div id="api-sandbox-generic-inputs" class="mw-collapsible mw-collapsed"></div></fieldset>' . $this->openFieldset('generator-parameters', array('style' => 'display: none;')) . '<div id="api-sandbox-generator-inputs"></div></fieldset>
';
return $s;
}