本文整理汇总了PHP中SMW\ApplicationFactory::newContentParser方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationFactory::newContentParser方法的具体用法?PHP ApplicationFactory::newContentParser怎么用?PHP ApplicationFactory::newContentParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\ApplicationFactory
的用法示例。
在下文中一共展示了ApplicationFactory::newContentParser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reparseToFetchSemanticData
private function reparseToFetchSemanticData($title)
{
$contentParser = $this->applicationFactory->newContentParser($title);
$parserOutput = $contentParser->parse()->getOutput();
if ($parserOutput === null) {
return null;
}
if (method_exists($parserOutput, 'getExtensionData')) {
return $parserOutput->getExtensionData('smwdata');
}
return $parserOutput->mSMWData;
}
示例2: refetchSemanticData
/**
* #347 showed that an external process (e.g. RefreshLinksJob) can inject a
* ParserOutput without/cleared SemanticData which forces the Store updater
* to create an empty container that will clear all existing data.
*
* To ensure that for a Title and its current revision an empty ParserOutput
* object is really meant to be "empty" (e.g. delete action initiated by a
* human) the content is re-parsed in order to fetch the newest available data
*
* @note Parsing is expensive but it is more expensive to loose data or to
* expect that an external process adheres the object contract
*/
private function refetchSemanticData()
{
wfDebug(__METHOD__ . ' Empty SemanticData / re-parsing: ' . $this->linksUpdate->getTitle()->getPrefixedDBkey() . "\n");
$contentParser = $this->applicationFactory->newContentParser($this->linksUpdate->getTitle());
$parserOutput = $contentParser->parse()->getOutput();
if ($parserOutput === null) {
return null;
}
if (method_exists($parserOutput, 'getExtensionData')) {
return $parserOutput->getExtensionData('smwdata');
}
return $parserOutput->mSMWData;
}
示例3: needToParsePageContentBeforeUpdate
private function needToParsePageContentBeforeUpdate()
{
$contentParser = $this->applicationFactory->newContentParser($this->getTitle());
$contentParser->forceToUseParser();
$contentParser->parse();
if (!$contentParser->getOutput() instanceof ParserOutput) {
$this->setLastError($contentParser->getErrors());
return false;
}
$parserData = $this->applicationFactory->newParserData($this->getTitle(), $contentParser->getOutput());
return $this->updateStore($parserData);
}
示例4: needToParsePageContentBeforeUpdate
/**
* SMW_UJ_PM_NP = new Parser to avoid "Parser state cleared" exception
*/
private function needToParsePageContentBeforeUpdate()
{
$contentParser = $this->applicationFactory->newContentParser($this->getTitle());
if ($this->getParameter('pm') === ($this->getParameter('pm') | SMW_UJ_PM_NP)) {
$contentParser->setParser(new \Parser($GLOBALS['wgParserConf']));
}
$contentParser->parse();
if (!$contentParser->getOutput() instanceof ParserOutput) {
$this->setLastError($contentParser->getErrors());
return false;
}
$parserData = $this->applicationFactory->newParserData($this->getTitle(), $contentParser->getOutput());
return $this->updateStore($parserData);
}