/** * Get the section title for a talk page post * @param $event EchoEvent * @param $user User * @return string */ protected function getSectionTitle($event, $user) { $extra = $event->getExtra(); if (!empty($extra['section-title'])) { if ($event->userCan(Revision::DELETED_TEXT, $user)) { return EchoDiscussionParser::getTextSnippet($extra['section-title'], 30); } else { return $this->getMessage('echo-rev-deleted-text-view')->text(); } } return ''; }
/** * Extract the comment left by a user on a talk page from the event. * @param $event EchoEvent The event to format the comment of * @param $user User The user to format content for * @return string Up to the first 200 characters of the comment */ protected function formatCommentText(EchoEvent $event, $user) { if (!$event->userCan(Revision::DELETED_TEXT, $user)) { return $this->getMessage('echo-rev-deleted-text-view')->text(); } $extra = $event->getExtra(); if (!isset($extra['content'])) { return ''; } $content = EchoDiscussionParser::stripHeader($extra['content']); $content = EchoDiscussionParser::stripSignature($content); $content = EchoDiscussionParser::stripIndents($content); return EchoDiscussionParser::getTextSnippet($content, 200); }