/** * Returns a formatted conversation message body string, based on configuration options supplied. * * @param \Concrete\Core\Conversation\Conversation $cnv * @param string $cnvMessageBody * @param array $config * * @return string */ public function formatConversationMessageBody($cnv, $cnvMessageBody, $config = array()) { /** @var \Concrete\Core\Html\Service\Html $htmlHelper */ $htmlHelper = Core::make('helper/html'); $cnvMessageBody = $htmlHelper->noFollowHref($cnvMessageBody); if (isset($config['htmlawed'])) { $default = array('safe' => 1, 'elements' => 'p, br, strong, em, strike, a'); $conf = array_merge($default, (array) $config['htmlawed']); $lawed = htmLawed($cnvMessageBody, $conf); } else { $lawed = $cnvMessageBody; } if ($config['mention'] !== false) { $users = $cnv->getConversationMessageUsers(); $needle = array(); $haystack = array(); foreach ($users as $user) { $needle[] = "@" . $user->getUserName(); $haystack[] = "<a href='" . $user->getUserPublicProfileURL() . "'>'@" . $user->getUserName() . "</a>"; } return str_ireplace($needle, $haystack, $lawed); } return $lawed; }
/** * @return \Concrete\Core\User\UserInfo[] */ public function getConversationMessageUsers() { return parent::getConversationMessageUsers(); }