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


PHP ParserOutput::getLanguageLinks方法代码示例

本文整理汇总了PHP中ParserOutput::getLanguageLinks方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::getLanguageLinks方法的具体用法?PHP ParserOutput::getLanguageLinks怎么用?PHP ParserOutput::getLanguageLinks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParserOutput的用法示例。


在下文中一共展示了ParserOutput::getLanguageLinks方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: LinksUpdate

 /**
  * Constructor
  *
  * @param Title $title Title of the page we're updating
  * @param ParserOutput $parserOutput Output from a full parse of this page
  * @param bool $recursive Queue jobs for recursive updates?
  */
 function LinksUpdate($title, $parserOutput, $recursive = true)
 {
     global $wgAntiLockFlags;
     if ($wgAntiLockFlags & ALF_NO_LINK_LOCK) {
         $this->mOptions = array();
     } else {
         $this->mOptions = array('FOR UPDATE');
     }
     $this->mDb = wfGetDB(DB_MASTER);
     if (!is_object($title)) {
         throw new MWException("The calling convention to LinksUpdate::LinksUpdate() has changed. " . "Please see Article::editUpdates() for an invocation example.\n");
     }
     $this->mTitle = $title;
     $this->mId = $title->getArticleID();
     $this->mParserOutput = $parserOutput;
     $this->mLinks = $parserOutput->getLinks();
     $this->mImages = $parserOutput->getImages();
     $this->mTemplates = $parserOutput->getTemplates();
     $this->mExternals = $parserOutput->getExternalLinks();
     $this->mCategories = $parserOutput->getCategories();
     $this->mProperties = $parserOutput->getProperties();
     # Convert the format of the interlanguage links
     # I didn't want to change it in the ParserOutput, because that array is passed all
     # the way back to the skin, so either a skin API break would be required, or an
     # inefficient back-conversion.
     $ill = $parserOutput->getLanguageLinks();
     $this->mInterlangs = array();
     foreach ($ill as $link) {
         list($key, $title) = explode(':', $link, 2);
         $this->mInterlangs[$key] = $title;
     }
     $this->mRecursive = $recursive;
     $this->mTouchTmplLinks = false;
     wfRunHooks('LinksUpdateConstructed', array(&$this));
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:42,代码来源:LinksUpdate.php

示例2: addParserOutputMetadata

 /**
  * Add all metadata associated with a ParserOutput object, but without the actual HTML. This
  * includes categories, language links, ResourceLoader modules, effects of certain magic words,
  * and so on.
  *
  * @since 1.24
  * @param ParserOutput $parserOutput
  */
 public function addParserOutputMetadata($parserOutput)
 {
     $this->mLanguageLinks += $parserOutput->getLanguageLinks();
     $this->addCategoryLinks($parserOutput->getCategories());
     $this->setIndicators($parserOutput->getIndicators());
     $this->mNewSectionLink = $parserOutput->getNewSection();
     $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
     $this->mParseWarnings = $parserOutput->getWarnings();
     if (!$parserOutput->isCacheable()) {
         $this->enableClientCache(false);
     }
     $this->mNoGallery = $parserOutput->getNoGallery();
     $this->mHeadItems = array_merge($this->mHeadItems, $parserOutput->getHeadItems());
     $this->addModules($parserOutput->getModules());
     $this->addModuleScripts($parserOutput->getModuleScripts());
     $this->addModuleStyles($parserOutput->getModuleStyles());
     $this->addJsConfigVars($parserOutput->getJsConfigVars());
     $this->mPreventClickjacking = $this->mPreventClickjacking || $parserOutput->preventClickjacking();
     // Template versioning...
     foreach ((array) $parserOutput->getTemplateIds() as $ns => $dbks) {
         if (isset($this->mTemplateIds[$ns])) {
             $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
         } else {
             $this->mTemplateIds[$ns] = $dbks;
         }
     }
     // File versioning...
     foreach ((array) $parserOutput->getFileSearchOptions() as $dbk => $data) {
         $this->mImageTimeKeys[$dbk] = $data;
     }
     // Hooks registered in the object
     $parserOutputHooks = $this->getConfig()->get('ParserOutputHooks');
     foreach ($parserOutput->getOutputHooks() as $hookInfo) {
         list($hookName, $data) = $hookInfo;
         if (isset($parserOutputHooks[$hookName])) {
             call_user_func($parserOutputHooks[$hookName], $this, $parserOutput, $data);
         }
     }
     // Link flags are ignored for now, but may in the future be
     // used to mark individual language links.
     $linkFlags = array();
     Hooks::run('LanguageLinks', array($this->getTitle(), &$this->mLanguageLinks, &$linkFlags));
     Hooks::run('OutputPageParserOutput', array(&$this, $parserOutput));
 }
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:52,代码来源:OutputPage.php

示例3: MWException

 /**
  * Constructor
  *
  * @param Title $title Title of the page we're updating
  * @param ParserOutput $parserOutput Output from a full parse of this page
  * @param bool $recursive Queue jobs for recursive updates?
  * @throws MWException
  */
 function __construct($title, $parserOutput, $recursive = true)
 {
     parent::__construct(false);
     // no implicit transaction
     if (!$title instanceof Title) {
         throw new MWException("The calling convention to LinksUpdate::LinksUpdate() has changed. " . "Please see Article::editUpdates() for an invocation example.\n");
     }
     if (!$parserOutput instanceof ParserOutput) {
         throw new MWException("The calling convention to LinksUpdate::__construct() has changed. " . "Please see WikiPage::doEditUpdates() for an invocation example.\n");
     }
     $this->mTitle = $title;
     $this->mId = $title->getArticleID();
     if (!$this->mId) {
         throw new MWException("The Title object did not provide an article " . "ID. Perhaps the page doesn't exist?");
     }
     $this->mParserOutput = $parserOutput;
     $this->mLinks = $parserOutput->getLinks();
     $this->mImages = $parserOutput->getImages();
     $this->mTemplates = $parserOutput->getTemplates();
     $this->mExternals = $parserOutput->getExternalLinks();
     $this->mCategories = $parserOutput->getCategories();
     $this->mProperties = $parserOutput->getProperties();
     $this->mInterwikis = $parserOutput->getInterwikiLinks();
     # Convert the format of the interlanguage links
     # I didn't want to change it in the ParserOutput, because that array is passed all
     # the way back to the skin, so either a skin API break would be required, or an
     # inefficient back-conversion.
     $ill = $parserOutput->getLanguageLinks();
     $this->mInterlangs = array();
     foreach ($ill as $link) {
         list($key, $title) = explode(':', $link, 2);
         $this->mInterlangs[$key] = $title;
     }
     foreach ($this->mCategories as &$sortkey) {
         # If the sortkey is longer then 255 bytes,
         # it truncated by DB, and then doesn't get
         # matched when comparing existing vs current
         # categories, causing bug 25254.
         # Also. substr behaves weird when given "".
         if ($sortkey !== '') {
             $sortkey = substr($sortkey, 0, 255);
         }
     }
     $this->mRecursive = $recursive;
     Hooks::run('LinksUpdateConstructed', array(&$this));
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:54,代码来源:LinksUpdate.php

示例4: InvalidArgumentException

 /**
  * Constructor
  *
  * @param Title $title Title of the page we're updating
  * @param ParserOutput $parserOutput Output from a full parse of this page
  * @param bool $recursive Queue jobs for recursive updates?
  * @throws MWException
  */
 function __construct(Title $title, ParserOutput $parserOutput, $recursive = true)
 {
     parent::__construct(false);
     // no implicit transaction
     $this->mTitle = $title;
     $this->mId = $title->getArticleID(Title::GAID_FOR_UPDATE);
     if (!$this->mId) {
         throw new InvalidArgumentException("The Title object yields no ID. Perhaps the page doesn't exist?");
     }
     $this->mParserOutput = $parserOutput;
     $this->mLinks = $parserOutput->getLinks();
     $this->mImages = $parserOutput->getImages();
     $this->mTemplates = $parserOutput->getTemplates();
     $this->mExternals = $parserOutput->getExternalLinks();
     $this->mCategories = $parserOutput->getCategories();
     $this->mProperties = $parserOutput->getProperties();
     $this->mInterwikis = $parserOutput->getInterwikiLinks();
     # Convert the format of the interlanguage links
     # I didn't want to change it in the ParserOutput, because that array is passed all
     # the way back to the skin, so either a skin API break would be required, or an
     # inefficient back-conversion.
     $ill = $parserOutput->getLanguageLinks();
     $this->mInterlangs = array();
     foreach ($ill as $link) {
         list($key, $title) = explode(':', $link, 2);
         $this->mInterlangs[$key] = $title;
     }
     foreach ($this->mCategories as &$sortkey) {
         # If the sortkey is longer then 255 bytes,
         # it truncated by DB, and then doesn't get
         # matched when comparing existing vs current
         # categories, causing bug 25254.
         # Also. substr behaves weird when given "".
         if ($sortkey !== '') {
             $sortkey = substr($sortkey, 0, 255);
         }
     }
     $this->mRecursive = $recursive;
     Hooks::run('LinksUpdateConstructed', array(&$this));
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:48,代码来源:LinksUpdate.php

示例5: execute


//.........这里部分代码省略.........
                 $result_array['wikitext'] = array();
                 $result->setContent($result_array['wikitext'], $this->text);
             }
             $result->addValue(null, $this->getModuleName(), $result_array);
             return;
         }
         // Not cached (save or load)
         $p_result = $wgParser->parse($params['pst'] ? $this->pstText : $this->text, $titleObj, $popts);
     }
     $result_array = array();
     $result_array['title'] = $titleObj->getPrefixedText();
     if (!is_null($oldid)) {
         $result_array['revid'] = intval($oldid);
     }
     if ($params['redirects'] && !is_null($redirValues)) {
         $result_array['redirects'] = $redirValues;
     }
     /* Wikia Change Starts */
     if (!$p_result instanceof ParserOutput) {
         \Wikia\Logger\WikiaLogger::instance()->error('ApiParse no ParserOutput', ['pageTitle' => $title]);
         // generate empty parser output to support code working on it
         $p_result = new ParserOutput('');
     }
     /* Wikia Change Ends */
     if (isset($prop['text'])) {
         $result_array['text'] = array();
         $result->setContent($result_array['text'], $p_result->getText());
     }
     if (!is_null($params['summary'])) {
         $result_array['parsedsummary'] = array();
         $result->setContent($result_array['parsedsummary'], Linker::formatComment($params['summary'], $titleObj));
     }
     if (isset($prop['langlinks'])) {
         $result_array['langlinks'] = $this->formatLangLinks($p_result->getLanguageLinks());
     }
     if (isset($prop['languageshtml'])) {
         $languagesHtml = $this->languagesHtml($p_result->getLanguageLinks());
         $result_array['languageshtml'] = array();
         $result->setContent($result_array['languageshtml'], $languagesHtml);
     }
     if (isset($prop['categories'])) {
         $result_array['categories'] = $this->formatCategoryLinks($p_result->getCategories());
     }
     if (isset($prop['categorieshtml'])) {
         $categoriesHtml = $this->categoriesHtml($p_result->getCategories());
         $result_array['categorieshtml'] = array();
         $result->setContent($result_array['categorieshtml'], $categoriesHtml);
     }
     if (isset($prop['links'])) {
         $result_array['links'] = $this->formatLinks($p_result->getLinks());
     }
     if (isset($prop['templates'])) {
         $result_array['templates'] = $this->formatLinks($p_result->getTemplates());
     }
     if (isset($prop['images'])) {
         $result_array['images'] = array_keys($p_result->getImages());
     }
     if (isset($prop['externallinks'])) {
         $result_array['externallinks'] = array_keys($p_result->getExternalLinks());
     }
     if (isset($prop['sections'])) {
         $result_array['sections'] = $p_result->getSections();
     }
     if (isset($prop['displaytitle'])) {
         $result_array['displaytitle'] = $p_result->getDisplayTitle() ? $p_result->getDisplayTitle() : $titleObj->getPrefixedText();
     }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:67,代码来源:ApiParse.php


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