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


PHP ParserOptions::newFromuser方法代码示例

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


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

示例1: __construct

 public function __construct($title, $revId = 0, $rcid = 0)
 {
     parent::__construct();
     $this->allowedVars = array_merge($this->allowedVars, array('mTitle', 'mRevId', 'mRCid', 'mArticle'));
     $this->mTitle = $title;
     $this->mRevId = $revId;
     $this->mRCid = $rcid;
     $this->mArticle = new Article($this->mTitle);
     $this->mArticle->fetchContent($this->mRevId);
     $this->publishTime = wfTimestamp(TS_UNIX, $this->mArticle->getTimestamp());
     $this->title = $this->mTitle->getFullText();
     if ($rcid == 0) {
         $this->guid = $this->mTitle->getFullURL();
     } else {
         $this->guid = $this->mTitle->escapeFullURL("oldid={$this->mRevId}");
     }
     $this->linkSelf = $this->_guid;
     $this->linkAlternate = $this->mTitle->getFullURL();
     $author = array();
     $author['name'] = $this->mArticle->getUserText();
     if ($u = User::newFromName($author['name'])) {
         $author['email'] = $u->getEmail();
         $userPage = $u->getUserPage();
         $author['uri'] = $userPage->getFullURL();
     }
     $this->_vars['authors'][] = $author;
     //create a new default user to invoke the parser
     $u = new User();
     global $wgParser;
     $output = $wgParser->parse($this->mArticle->getContent(false), $this->mTitle, ParserOptions::newFromuser($u));
     $text = $output->mText;
     //$this->_content = html_entity_decode($text);
     $this->content = $text;
     $categories = $this->mTitle->getParentCategories();
     if (is_array($categories)) {
         foreach ($categories as $c => $v) {
             $categoryTitle = Title::newFromText($c);
             $this->_vars['categories'][] = $categoryTitle->getText();
         }
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:41,代码来源:SpecialWikiFeeds.php


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