当前位置: 首页>>代码示例>>PHP>>正文


PHP ApplicationFactory::newContentParser方法代码示例

本文整理汇总了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;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:12,代码来源:LinksUpdateConstructed.php

示例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;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:25,代码来源:LinksUpdateConstructed.php

示例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);
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:12,代码来源:UpdateJob.php

示例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);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:17,代码来源:UpdateJob.php


注:本文中的SMW\ApplicationFactory::newContentParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。