本文整理匯總了PHP中OutputPage::enableTOC方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputPage::enableTOC方法的具體用法?PHP OutputPage::enableTOC怎麽用?PHP OutputPage::enableTOC使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OutputPage
的用法示例。
在下文中一共展示了OutputPage::enableTOC方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onOutputPageParserOutput
/**
* OutputPageParserOutput hook handler
* Disables TOC in output before it grabs HTML
* @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput
*
* @param OutputPage $outputPage
* @param ParserOutput $po
* @return bool
*/
public static function onOutputPageParserOutput($outputPage, ParserOutput $po)
{
global $wgMFWikibaseImageCategory;
$context = MobileContext::singleton();
$isBeta = $context->isBetaGroupMember();
$mfUseWikibaseDescription = $context->getMFConfig()->get('MFUseWikibaseDescription');
if ($context->shouldDisplayMobileView()) {
$outputPage->enableTOC(false);
$outputPage->setProperty('MinervaTOC', $po->getTOCHTML() !== '');
if ($mfUseWikibaseDescription && $isBeta) {
$item = $po->getProperty('wikibase_item');
if ($item) {
$desc = ExtMobileFrontend::getWikibaseDescription($item);
$category = ExtMobileFrontend::getWikibasePropertyValue($item, $wgMFWikibaseImageCategory);
if ($desc) {
$outputPage->setProperty('wgMFDescription', $desc);
}
if ($category) {
$outputPage->setProperty('wgMFImagesCategory', $category);
}
}
}
// Enable wrapped sections
$po->setText(ExtMobileFrontend::DOMParse($outputPage, $po->getText(), $isBeta));
}
return true;
}
示例2: onOutputPageParserOutput
/**
* OutputPageParserOutput hook handler
* Disables TOC in output before it grabs HTML
* @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput
*
* @param OutputPage $outputPage
* @param ParserOutput $po
* @return bool
*/
public static function onOutputPageParserOutput($outputPage, ParserOutput $po)
{
$context = MobileContext::singleton();
$mfUseWikibaseDescription = $context->getMFConfig()->get('MFUseWikibaseDescription');
if ($context->shouldDisplayMobileView()) {
$outputPage->enableTOC(false);
$outputPage->setProperty('MinervaTOC', $po->getTOCHTML() !== '');
if ($mfUseWikibaseDescription && $context->isBetaGroupMember()) {
$item = $po->getProperty('wikibase_item');
if ($item) {
$desc = ExtMobileFrontend::getWikibaseDescription($item);
if ($desc) {
$outputPage->setProperty('wgMFDescription', $desc);
}
}
}
}
return true;
}