本文整理汇总了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();
}
}
}