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(); } } }