/** * Many loaded references typically point to the same Title, cache those instead * of generating a bunch of duplicate title classes. */ public static function makeTitle($namespace, $title) { try { return Workflow::getFromTitleCache(wfWikiId(), $namespace, $title); } catch (InvalidInputException $e) { // duplicate Title::makeTitleSafe which returns null on failure, // but only for InvalidInputException return null; } }
protected function processParam($event, $param, $message, $user) { $extra = $event->getExtra(); if ($param === 'subject') { if (isset($extra['topic-title']) && $extra['topic-title']) { $this->processParamEscaped($message, trim($extra['topic-title'])); } else { $message->params(''); } } elseif ($param === 'commentText') { if (isset($extra['content']) && $extra['content']) { // @todo assumes content is html, make explicit $message->params(Utils::htmlToPlaintext($extra['content'], 200)); } else { $message->params(''); } } elseif ($param === 'post-permalink') { $anchor = $this->getPostLinkAnchor($event, $user); if ($anchor) { $message->params($anchor->getFullUrl()); } else { $message->params(''); } } elseif ($param === 'topic-permalink') { // link to individual new-topic if (isset($extra['topic-workflow'])) { $title = Workflow::getFromTitleCache(wfWikiId(), NS_TOPIC, $extra['topic-workflow']->getAlphadecimal()); } else { $title = $event->getTitle(); } $anchor = $this->getUrlGenerator()->workflowLink($title, $extra['topic-workflow']); $anchor->query['fromnotif'] = 1; $message->params($anchor->getFullUrl()); } elseif ($param === 'new-topics-permalink') { // link to board sorted by newest topics $anchor = $this->getUrlGenerator()->boardLink($event->getTitle(), 'newest'); $anchor->query['fromnotif'] = 1; $message->params($anchor->getFullUrl()); } elseif ($param == 'flow-title') { $title = $event->getTitle(); if ($title) { $formatted = $this->formatTitle($title); } else { $formatted = $this->getMessage('echo-no-title')->text(); } $message->params($formatted); } elseif ($param == 'old-subject') { $this->processParamEscaped($message, trim($extra['old-subject'])); } elseif ($param == 'new-subject') { $this->processParamEscaped($message, trim($extra['new-subject'])); } else { parent::processParam($event, $param, $message, $user); } }