本文整理汇总了PHP中ParserOutput::setTOCEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::setTOCEnabled方法的具体用法?PHP ParserOutput::setTOCEnabled怎么用?PHP ParserOutput::setTOCEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::setTOCEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractWikitextParts
/**
* Extract parts of the text - opening, main and auxiliary.
*/
private function extractWikitextParts()
{
if (!is_null($this->allText)) {
return;
}
$this->parserOutput->setEditSectionTokens(false);
$this->parserOutput->setTOCEnabled(false);
$text = $this->parserOutput->getText();
if (strlen($text) == 0) {
$this->allText = "";
// empty text - nothing to seek here
return;
}
$opening = null;
$this->openingText = $this->extractHeadingBeforeFirstHeading($text);
// Add extra spacing around break tags so text crammed together like<br>this
// doesn't make one word.
$text = str_replace('<br', "\n<br", $text);
$formatter = new HtmlFormatter($text);
// Strip elements from the page that we never want in the search text.
$formatter->remove($this->excludedElementSelectors);
$formatter->filterContent();
// Strip elements from the page that are auxiliary text. These will still be
// searched but matches will be ranked lower and non-auxiliary matches will be
// preferred in highlighting.
$formatter->remove($this->auxiliaryElementSelectors);
$auxiliaryElements = $formatter->filterContent();
$this->allText = trim(Sanitizer::stripAllTags($formatter->getText()));
foreach ($auxiliaryElements as $auxiliaryElement) {
$this->auxText[] = trim(Sanitizer::stripAllTags($formatter->getText($auxiliaryElement)));
}
}