本文整理汇总了PHP中ApiMain::getModuleFromPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiMain::getModuleFromPath方法的具体用法?PHP ApiMain::getModuleFromPath怎么用?PHP ApiMain::getModuleFromPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiMain
的用法示例。
在下文中一共展示了ApiMain::getModuleFromPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($par)
{
if (empty($par)) {
$par = 'main';
}
// These come from transclusions
$request = $this->getRequest();
$options = ['action' => 'help', 'nolead' => true, 'submodules' => $request->getCheck('submodules'), 'recursivesubmodules' => $request->getCheck('recursivesubmodules'), 'title' => $request->getVal('title', $this->getPageTitle('$1')->getPrefixedText())];
// These are for linking from wikitext, since url parameters are a pain
// to do.
while (true) {
if (substr($par, 0, 4) === 'sub/') {
$par = substr($par, 4);
$options['submodules'] = 1;
continue;
}
if (substr($par, 0, 5) === 'rsub/') {
$par = substr($par, 5);
$options['recursivesubmodules'] = 1;
continue;
}
$moduleName = $par;
break;
}
if (!$this->including()) {
unset($options['nolead'], $options['title']);
$options['modules'] = $moduleName;
$link = wfAppendQuery(wfExpandUrl(wfScript('api'), PROTO_CURRENT), $options);
$this->getOutput()->redirect($link);
return;
}
$main = new ApiMain($this->getContext(), false);
try {
$module = $main->getModuleFromPath($moduleName);
} catch (UsageException $ex) {
$this->getOutput()->addHTML(Html::rawElement('span', ['class' => 'error'], $this->msg('apihelp-no-such-module', $moduleName)->inContentLanguage()->parse()));
return;
}
ApiHelp::getHelp($this->getContext(), $module, $options);
}