本文整理匯總了PHP中ApiMain::getModules方法的典型用法代碼示例。如果您正苦於以下問題:PHP ApiMain::getModules方法的具體用法?PHP ApiMain::getModules怎麽用?PHP ApiMain::getModules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ApiMain
的用法示例。
在下文中一共展示了ApiMain::getModules方法的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;
}