/** * Gets the content of the article with the provided page name, * or an empty string when there is no such article. * * @since 0.1 * * @param string $pageName * * @return string */ public static function getParsedArticleContent($pageName) { $title = Title::newFromText($pageName); if (is_null($title)) { return ''; } $article = new Article($title, 0); global $wgParser, $wgContestEmailParse; $wgContestEmailParse = true; $text = $wgParser->parse($article->fetchContent(), $article->getTitle(), $article->getParserOptions())->getText(); $wgContestEmailParse = false; return $text; }
public function index($wallMessagesPerPage = null) { wfProfileIn(__METHOD__); $this->addAsset(); $title = $this->request->getVal('title', $this->app->wg->Title); $page = $this->request->getVal('page', 1); /* for some reason nirvana passes null to this function we need to force default value */ if (empty($wallMessagesPerPage)) { $wallMessagesPerPage = self::DEFAULT_MESSAGES_PER_PAGE; } $this->getThreads($title, $page, $wallMessagesPerPage); $this->response->setVal('type', 'Board'); $this->response->setVal('showNewMessage', true); $this->response->setVal('condenseMessage', true); $this->response->setVal('renderUserTalkArchiveAnchor', $this->request->getVal('dontRenderUserTalkArchiveAnchor', false) != true); $greeting = Title::newFromText($title->getText(), NS_USER_WALL_MESSAGE_GREETING); $greetingText = ''; if (!empty($greeting) && $greeting->exists()) { $article = new Article($greeting); $article->getParserOptions(); $article->mParserOptions->setIsPreview(true); // create parser option $article->mParserOptions->setEditSection(false); $greetingText = $article->getParserOutput()->getText(); } wfRunHooks('WallGreetingContent', array(&$greetingText)); // used by SWM to add messages to Wall in monobook $this->response->setVal('greeting', $greetingText); $this->response->setVal('sortingOptions', $this->getSortingOptions()); $this->response->setVal('sortingSelected', $this->getSortingSelectedText()); $this->response->setVal('title', $title); $this->response->setVal('totalItems', $this->countComments); $this->response->setVal('itemsPerPage', $wallMessagesPerPage); $this->response->setVal('showPager', $this->countComments > $wallMessagesPerPage); $this->response->setVal('currentPage', $page); Transaction::setSizeCategoryByDistributionOffset($this->countComments, 0, self::DEFAULT_MESSAGES_PER_PAGE); // TODO: keep the varnish cache and do purging on post $this->response->setCacheValidity(WikiaResponse::CACHE_DISABLED); wfProfileOut(__METHOD__); }