本文整理汇总了PHP中LinksUpdate::getParserOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP LinksUpdate::getParserOutput方法的具体用法?PHP LinksUpdate::getParserOutput怎么用?PHP LinksUpdate::getParserOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinksUpdate
的用法示例。
在下文中一共展示了LinksUpdate::getParserOutput方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onLinksUpdateComplete
/**
* Insert assessment records after page is saved
* @param LinksUpdate $linksUpdate
*/
public static function onLinksUpdateComplete(&$linksUpdate)
{
$pOut = $linksUpdate->getParserOutput();
if ($pOut->getExtensionData('ext-pageassessment-assessmentdata') !== null) {
$assessmentData = $pOut->getExtensionData('ext-pageassessment-assessmentdata');
} else {
// Even if there is no assessment data, we still need to run doUpdates
// in case any assessment data was deleted from the page.
$assessmentData = [];
}
$title = $linksUpdate->getTitle();
// In most cases $title will be a talk page, but we want to associate the
// assessment data with the subject page.
$subjectTitle = $title->getSubjectPage();
PageAssessmentsBody::doUpdates($subjectTitle, $assessmentData);
}
示例2: onLinksUpdate
/**
* LinksUpdate hook handler
* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdate
* @param LinksUpdate $linksUpdate
*/
public static function onLinksUpdate(&$linksUpdate)
{
global $wgUseDumbLinkUpdate;
$out = $linksUpdate->getParserOutput();
$data = array();
if (isset($out->geoData)) {
$geoData = $out->geoData;
$data = $geoData->getAll();
}
if ($wgUseDumbLinkUpdate || !count($data)) {
self::doDumbUpdate($data, $linksUpdate->mId);
} else {
self::doSmartUpdate($data, $linksUpdate->mId);
}
return true;
}
示例3: onLinksUpdate
/**
* LinksUpdate hook handler - saves a count of h2 elements that occur in the WikiPage
* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdate
*
* @param LinksUpdate $lu
* @return bool
*/
public static function onLinksUpdate(LinksUpdate $lu)
{
if ($lu->getTitle()->isTalkPage()) {
$parserOutput = $lu->getParserOutput();
$sections = $parserOutput->getSections();
$numTopics = 0;
foreach ($sections as $section) {
if ($section['toclevel'] == 1) {
$numTopics += 1;
}
}
if ($numTopics) {
$lu->mProperties['page_top_level_section_count'] = $numTopics;
}
}
return true;
}
示例4: onLinksUpdate
/**
* Modifies ParserOutput
* @param \LinksUpdate $linksUpdate
* @return bool
*/
public static function onLinksUpdate(\LinksUpdate $linksUpdate)
{
$linksUpdate->mParserOutput = (new \FlagsController())->modifyParserOutputWithFlags($linksUpdate->getParserOutput(), $linksUpdate->getTitle()->getArticleID());
return true;
}