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


PHP ParserOptions::setUserLang方法代码示例

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


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

示例1: getFeedItem

 /**
  *
  * @param int $date
  * @return FeaturedFeedItem
  */
 public function getFeedItem($date)
 {
     self::$parserOptions->setTimestamp($date);
     self::$parserOptions->setUserLang($this->language);
     $titleText = self::$parser->transformMsg($this->page, self::$parserOptions);
     $title = Title::newFromText($titleText);
     if (!$title) {
         return false;
     }
     $rev = Revision::newFromTitle($title);
     if (!$rev) {
         return false;
         // page does not exist
     }
     $text = $rev->getText();
     if (!$text) {
         return false;
     }
     $text = self::$parser->parse($text, $title, self::$parserOptions)->getText();
     $url = SpecialPage::getTitleFor('FeedItem', $this->name . '/' . wfTimestamp(TS_MW, $date) . '/' . $this->language->getCode())->getFullURL();
     return new FeaturedFeedItem(self::$parser->transformMsg($this->entryName, self::$parserOptions), wfExpandUrl($url), $text, $date);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:27,代码来源:FeaturedFeeds.body.php

示例2: setParserLanguage

 /**
  * ParserOptions are constructed before we determined the language, so fix it
  *
  * @param $lang Language
  */
 public function setParserLanguage($lang)
 {
     $this->parserOptions->setTargetLanguage($lang);
     $this->parserOptions->setUserLang($lang);
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:10,代码来源:Installer.php

示例3: getParserOptions

 /**
  * Get parser options suitable for rendering the primary article wikitext
  * @param $canonical boolean Determines that the generated options must not depend on user preferences (see bug 14404)
  * @return mixed ParserOptions object or boolean false
  */
 public function getParserOptions($canonical = false)
 {
     global $wgUser, $wgLanguageCode;
     if (!$this->mParserOptions || $canonical) {
         $user = !$canonical ? $wgUser : new User();
         $parserOptions = new ParserOptions($user);
         $parserOptions->setTidy(true);
         $parserOptions->enableLimitReport();
         if ($canonical) {
             $parserOptions->setUserLang($wgLanguageCode);
             # Must be set explicitely
             return $parserOptions;
         }
         $this->mParserOptions = $parserOptions;
     }
     // Clone to allow modifications of the return value without affecting cache
     return clone $this->mParserOptions;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:23,代码来源:WikiPage.php


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