concrete/src/Conversation/Editor/Editor.php
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']);
            $result = htmLawed($cnvMessageBody, $conf);
        } else {
            $result = $cnvMessageBody;
        }
        if (isset($config['mention']) && $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>";
            }

            $result = str_ireplace($needle, $haystack, $result);
        }

        // Replace any potential XSS
        $result = $this->removeJavascriptLinks($result);
        return $result;
    }
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']);
            $result = htmLawed($cnvMessageBody, $conf);
        } else {
            $result = $cnvMessageBody;
        }
        if (isset($config['mention']) && $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>";
            }

            $result = str_ireplace($needle, $haystack, $result);
        }

        // Replace any potential XSS
        $result = $this->removeJavascriptLinks($result);
        return $result;
    }
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' ] ) ; $ result = htmLawed ( $ cnvMessageBody , $ conf ) ; } else { $ result = $ cnvMessageBody ; } if ( isset ( $ config [ 'mention' ] ) && $ 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>" ; } $ result = str_ireplace ( $ needle , $ haystack , $ result ) ; } // Replace any potential XSS $ result = $ this -> removeJavascriptLinks ( $ result ) ; return $ result ; }
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
Returns a formatted conversation message body string based on configuration options supplied .