/** * Return formatted comment given the wall item */ public static function formatComment($wall) { $config = CFactory::getConfig(); $my = CFactory::getUser(); $actModel = CFactory::getModel('activities'); $like = new CLike(); $likeCount = $like->getLikeCount('comment', $wall->id); $isLiked = $like->userLiked('comment', $wall->id, $my->id); $user = CFactory::getUser($wall->post_by); // Censor if the user is banned if ($user->block) { $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED'); } else { // strip out the comment data $CComment = new CComment(); $wall->comment = $CComment->stripCommentData($wall->comment); // Need to perform basic formatting here // 1. support nl to br, // 2. auto-link text $CTemplate = new CTemplate(); $wall->comment = $origComment = $CTemplate->escape($wall->comment); $wall->comment = CStringHelper::autoLink($wall->comment); } $commentsHTML = ''; $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>'; $date = new JDate($wall->date); $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> '; $commentsHTML .= $wall->comment; $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date); $cid = isset($wall->contentid) ? $wall->contentid : null; $activity = $actModel->getActivity($cid); $ownPost = $my->id == $wall->post_by; $allowRemove = $my->authorise('community.delete', 'walls', $wall); $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin(); // only poster can edit if ($allowRemove) { $commentsHTML .= ' <span class="wall-coc-remove-link">• <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>'; } $commentsHTML .= '</span>'; $commentsHTML .= '</div>'; $editHTML = ''; if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) { $editHTML .= '<a href="javascript:" class="joms-button--edit">'; $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>'; $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>'; $editHTML .= '</a>'; } $removeHTML = ''; if ($allowRemove) { $removeHTML .= '<a href="javascript:" class="joms-button--remove">'; $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>'; $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>'; $removeHTML .= '</a>'; } $removeTagHTML = ''; if (CActivitiesHelper::hasTag($my->id, $wall->comment)) { $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>'; } /* user deleted */ if ($user->guest == 1) { $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> '; } else { $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> '; } $params = $wall->params; $paramsHTML = ''; $image = (array) $params->get('image'); $photoThumbnail = false; if ($params->get('attached_photo_id') > 0) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($params->get('attached_photo_id')); $photoThumbnail = $photo->getThumbURI(); $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>'; } else { if ($params->get('title')) { $video = self::detectVideo($params->get('url')); if (is_object($video)) { $paramsHTML .= '<div class="joms-media--video joms-js--video"'; $paramsHTML .= ' data-type="' . $video->type . '"'; $paramsHTML .= ' data-id="' . $video->id . '"'; $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"'; $paramsHTML .= ' style="margin-top:10px;">'; $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<img src="' . $video->getThumbnail() . '">'; $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">'; $paramsHTML .= '<div class="mejs-overlay-button"></div>'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>'; $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>'; $paramsHTML .= '</div>'; $paramsHTML .= '</div>'; } else { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">'; if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) { $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>'; } if ($params->get('image')) { $paramsHTML .= $params->get('link'); $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">'; $paramsHTML .= '<img src="' . array_shift($image) . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $url = $params->get('url') ? $params->get('url') : '#'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<a href="' . $url . '">'; $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>'; $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>'; if ($params->get('link')) { $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>'; } $paramsHTML .= '</a></div></div>'; } } } if (!$params->get('title') && $params->get('url')) { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album">'; $paramsHTML .= '<a href="' . $params->get('url') . '">'; $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $wall->comment = nl2br($wall->comment); $wall->comment = CUserHelper::replaceAliasURL($wall->comment); $wall->comment = CStringHelper::getEmoticon($wall->comment); $wall->comment = CStringHelper::converttagtolink($wall->comment); // convert to hashtag $template = new CTemplate(); $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML); $commentsHTML = $template->fetch('stream/single-comment'); return $commentsHTML; }
public function ajaxRemoveUserTag($id, $type = 'comment') { $my = CFactory::getUser(); if ($my->id == 0) { $this->ajaxBlockUnregister(); } // Remove tag. $updatedMessage = CApiActivities::removeUserTag($id, $type); $origValue = $updatedMessage; $value = CStringHelper::autoLink($origValue); $value = nl2br($value); $value = CUserHelper::replaceAliasURL($value); $value = CStringHelper::getEmoticon($value); $json = array('success' => true, 'unparsed' => $origValue, 'data' => $value); die(json_encode($json)); }
/** * Add reply via ajax * @todo: check permission and message ownership */ public function ajaxAddReply($msgId, $reply, $photoId = 0) { $filter = JFilterInput::getInstance(); $msgId = $filter->clean($msgId, 'int'); //$reply = $filter->clean($reply, 'string'); $photoId = $filter->clean($photoId, 'int'); $my = CFactory::getUser(); $model = $this->getModel('inbox'); $message = $model->getMessage($msgId); $messageRecipient = $model->getParticipantsID($msgId, $my->id); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } // Block users $getBlockStatus = new blockUser(); $userModel = CFactory::getModel('User'); $bannedList = $userModel->getBannedUser(); $newRecipient = array(); foreach ($messageRecipient as $recipient) { if ($getBlockStatus->isUserBlocked($recipient, 'inbox')) { continue; } $newRecipient[] = $recipient; } $messageRecipient = $newRecipient; // @rule: Spam checks if ($this->_isSpam($my, $reply)) { $json = array('error' => JText::_('COM_COMMUNITY_INBOX_MESSAGE_MARKED_SPAM')); die(json_encode($json)); } if (empty($reply) && $photoId == 0) { $json = array('error' => JText::_('COM_COMMUNITY_INBOX_MESSAGE_CANNOT_BE_EMPTY')); die(json_encode($json)); } if (empty($messageRecipient)) { $json = array('error' => JText::_('COM_COMMUNITY_INBOX_MESSAGE_CANNOT_FIND_RECIPIENT')); die(json_encode($json)); } // make sure we can only reply to message that belogn to current user if (!$model->canReply($my->id, $msgId)) { $json = array('error' => JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING')); die(json_encode($json)); } if (in_array($messageRecipient[0], $bannedList)) { $json = array('error' => JText::_('COM_COMMUNITY_USER_BANNED')); die(json_encode($json)); } $date = JFactory::getDate(); //get the time without any offset! $obj = new stdClass(); $obj->id = null; $obj->from = $my->id; $obj->posted_on = $date->toSql(); $obj->from_name = $my->name; $obj->subject = 'RE:' . $message->subject; $obj->body = $reply; $body = new JRegistry(); $body->set('content', $obj->body); // photo attachment if ($photoId > 0) { //lets check if the photo belongs to the uploader $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($photoId); if ($photo->creator == $my->id && $photo->albumid == '-1') { $body->set('attached_photo_id', $photoId); //sets the status to ready so that it wont be deleted on cron run $photo->status = 'ready'; $photo->store(); } } /** * @since 3.2.1 * Message URL fetching */ if (preg_match("/\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9+&@#\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]/i", $obj->body)) { $graphObject = CParsers::linkFetch($obj->body); if ($graphObject) { $graphObject->merge($body); $obj->body = $graphObject->toString(); } } else { $obj->body = $body->toString(); } $model->sendReply($obj, $msgId); $deleteLink = CRoute::_('index.php?option=com_community&view=inbox&task=remove&msgid=' . $obj->id); $authorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id); //add user points CUserPoints::assignPoint('inbox.message.reply'); // Add notification foreach ($messageRecipient as $row) { $params = new CParameter(''); $params->set('message', $reply); $params->set('title', $obj->subject); $params->set('url', 'index.php?option=com_community&view=inbox&task=read&msgid=' . $msgId); $params->set('msg_url', 'index.php?option=com_community&view=inbox&task=read&msgid=' . $msgId); $params->set('msg', JText::_('COM_COMMUNITY_PRIVATE_MESSAGE')); $params->set('msg', JText::_('COM_COMMUNITY_PRIVATE_MESSAGE')); CNotificationLibrary::add('inbox_create_message', $my->id, $row, JText::_('COM_COMMUNITY_SENT_YOU_MESSAGE'), '', 'inbox.sent', $params); } // onMessageDisplay Event trigger $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $args = array(); $args[] = $obj; $appsLib->triggerEvent('onMessageDisplay', $args); $params = new JRegistry($obj->body); // Escape content $content = $originalContent = $params->get('content'); $content = CTemplate::escape($content); $content = CStringHelper::autoLink($content); $content = nl2br($content); $content = CStringHelper::getEmoticon($content); $content = CStringHelper::converttagtolink($content); //get thumbnail if available $photoThumbnail = ''; if ($params->get('attached_photo_id')) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($params->get('attached_photo_id')); $photoThumbnail = $photo->getThumbURI(); } $tmpl = new CTemplate(); $tmpl->set('user', CFactory::getUser($obj->from)); $tmpl->set('msg', $obj); $tmpl->set('originalContent', $originalContent); $tmpl->set('content', $content); $tmpl->set('params', $params); $tmpl->set('removeLink', $deleteLink); $tmpl->set('authorLink', $authorLink); $tmpl->set('photoThumbnail', $photoThumbnail); $html = $tmpl->fetch('inbox.message'); $json = array('success' => true, 'html' => $html); die(json_encode($json)); }
public function ajaxeditComment($id, $value, $photoId = 0) { $config = CFactory::getConfig(); $my = CFactory::getUser(); $actModel = CFactory::getModel('activities'); $objResponse = new JAXResponse(); $json = array(); if ($my->id == 0) { $this->blockUnregister(); } $wall = JTable::getInstance('wall', 'CTable'); $wall->load($id); $cid = isset($wall->contentid) ? $wall->contentid : null; $activity = $actModel->getActivity($cid); $ownPost = $my->id == $wall->post_by; $targetPost = $activity->target == $my->id; $allowEdit = COwnerHelper::isCommunityAdmin() || ($ownPost || $targetPost) && !empty($my->id); $value = trim($value); if (empty($value)) { $json['error'] = JText::_('COM_COMMUNITY_CANNOT_EDIT_COMMENT_ERROR'); } else { if ($config->get('wallediting') && $allowEdit) { $params = new CParameter($wall->params); //if photo id is not 0, this wall is appended with a picture if ($photoId > 0 && $params->get('attached_photo_id') != $photoId) { //lets check if the photo belongs to the uploader $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($photoId); if ($photo->creator == $my->id && $photo->albumid == '-1') { $params->set('attached_photo_id', $photoId); //sets the status to ready so that it wont be deleted on cron run $photo->status = 'ready'; $photo->store(); } } else { if ($photoId == -1) { //if there is nothing, remove the param if applicable //delete from db and files $photoModel = CFactory::getModel('photos'); $photoTable = $photoModel->getPhoto($params->get('attached_photo_id')); $photoTable->delete(); $params->set('attached_photo_id', 0); } } $wall->params = $params->toString(); $wall->comment = $value; $wall->store(); $CComment = new CComment(); $value = $CComment->stripCommentData($value); // Need to perform basic formatting here // 1. support nl to br, // 2. auto-link text $CTemplate = new CTemplate(); $value = $origValue = $CTemplate->escape($value); $value = CStringHelper::autoLink($value); $value = nl2br($value); $value = CUserHelper::replaceAliasURL($value); $value = CStringHelper::getEmoticon($value); $json['comment'] = $value; $json['originalComment'] = $origValue; // $objResponse->addScriptCall("joms.jQuery('div[data-commentid=" . $id . "] .cStream-Content span.comment').html", $value); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").val', $origValue); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").removeData', 'initialized'); // if ($photoId == -1) { // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', ''); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "none").attr("data-no_thumb", 1);'); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail").html', '<img/>'); // } else if ($photoId != 0) { // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-fetch-wrapper").remove', ''); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', ''); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-content] .cStream-Meta").before', '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . JUri::root(true) ."/". $photo->thumbnail . '" /></div>'); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "block").removeAttr("data-no_thumb");'); // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail img").attr("src", "' . JUri::root(true) ."/". $photo->thumbnail . '").attr("data-photo_id", "0").data("photo_id", 0);'); // } } else { $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT'); } } if (!isset($json['error'])) { $json['success'] = true; } die(json_encode($json)); }
/** * Show the message reading window */ public function read($data) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; if (!$this->accessAllowed('registered')) { return; } $config = CFactory::getConfig(); if (!$config->get('enablepm')) { echo JText::_('COM_COMMUNITY_PRIVATE_MESSAGING_DISABLED'); return; } //page title $document = JFactory::getDocument(); $inboxModel = CFactory::getModel('inbox'); $my = CFactory::getUser(); $msgid = $jinput->request->get('msgid', 0, 'INT'); if (!$inboxModel->canRead($my->id, $msgid)) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING'), 'error'); return; } $pathway = $mainframe->getPathway(); $pathway->addItem($this->escape(JText::_('COM_COMMUNITY_INBOX_TITLE')), CRoute::_('index.php?option=com_community&view=inbox')); $parentData = ''; $html = ''; $messageHeading = ''; $recipient = array(); $parentData = $inboxModel->getMessage($msgid); if (!empty($data->messages)) { $document = JFactory::getDocument(); $pathway->addItem($this->escape(htmlspecialchars_decode($parentData->subject))); $document->setTitle(htmlspecialchars_decode($parentData->subject)); require_once COMMUNITY_COM_PATH . '/libraries/apps.php'; $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $config = CFactory::getConfig(); $pagination = intval($config->get('stream_default_comments', 5)); $count = count($data->messages); $hide = true; foreach ($data->messages as $row) { $count--; if ($count < $pagination) { $hide = false; } // onMessageDisplay Event trigger $args = array(); $originalBodyContent = $row->body; $row->body = new JRegistry($row->body); if ($row->body == '{}') { //backward compatibility, save the old data into content parameter if needed $newParam = new CParameter(); $newParam->set('content', $originalBodyContent); $table = JTable::getInstance('Message', 'CTable'); $table->load($row->id); $table->body = $newParam->toString(); $table->store(); $row->body = new CParameter($table->body); } // Escape content $content = $originalContent = $row->body->get('content'); $content = CTemplate::escape($content); $content = CStringHelper::autoLink($content); $content = nl2br($content); $content = CStringHelper::getEmoticon($content); $content = CStringHelper::converttagtolink($content); $content = CUserHelper::replaceAliasURL($content); $params = $row->body; $args[] = $row; $appsLib->triggerEvent('onMessageDisplay', $args); $user = CFactory::getUser($row->from); //construct the delete link $deleteLink = CRoute::_('index.php?option=com_community&view=inbox&task=remove&msgid=' . $row->id); $authorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); //get thumbnail if available $photoThumbnail = ''; if ($params->get('attached_photo_id')) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($params->get('attached_photo_id')); $photoThumbnail = $photo->getThumbURI(); } $tmpl = new CTemplate(); $html .= $tmpl->set('user', $user)->set('msg', $row)->set('hide', $hide)->set('originalContent', $originalContent)->set('content', $content)->set('params', $params)->set('isMine', COwnerHelper::isMine($my->id, $user->id))->set('removeLink', $deleteLink)->set('authorLink', $authorLink)->set('photoThumbnail', $photoThumbnail)->fetch('inbox.message'); } $myLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id); $recipient = $inboxModel->getRecepientMessage($msgid); $recepientCount = count($recipient); $textOther = $recepientCount > 1 ? 'COM_COMMUNITY_MSG_OTHER' : 'COM_COMMUNITY_MSG_OTHER_SINGULAR'; $messageHeading = JText::sprintf('COM_COMMUNITY_MSG_BETWEEN_YOU_AND_USER', $myLink, '#', JText::sprintf($textOther, $recepientCount)); } else { $html = '<div class="text">' . JText::_('COM_COMMUNITY_INBOX_MESSAGE_EMPTY') . '</div>'; } //end if $tmplMain = new CTemplate(); echo $tmplMain->set('messageHeading', $messageHeading)->set('recipient', $recipient)->set('limit', $pagination)->set('messages', $data->messages)->set('parentData', $parentData)->set('htmlContent', $html)->set('my', $my)->set('submenu', $this->showSubmenu(false))->fetch('inbox.read'); }
</a> </span> <span class="joms-stream__time"> <small> <?php echo $discussion['created_interval']; ?> </small> </span> </div> </div> <div class="joms-stream__body"> <?php // Escape content $discussion['comment'] = CTemplate::escape($discussion['comment']); $discussion['comment'] = CStringHelper::autoLink($discussion['comment']); $discussion['comment'] = nl2br($discussion['comment']); $discussion['comment'] = CStringHelper::getEmoticon($discussion['comment']); $discussion['comment'] = CStringHelper::converttagtolink($discussion['comment']); $discussion['comment'] = CUserHelper::replaceAliasURL($discussion['comment']); echo substr($discussion['comment'], 0, 250); if (strlen($discussion['comment']) > 250) { echo ' ...'; } // @TODO: DRY $video = JTable::getInstance('Video', 'CTable'); if ($video->init($params->get('url'))) { $video->isValid(); } else { $video = false; }
/** * General purpose stream formatting function */ public static function format($str, $mood = null) { // Some database actually already stored some URL already linked! Such as @mention format // To handle this, we strip to to the base format. and apply the linking later $str = preg_replace('|@<a href="(.*?)".*>(.*)</a>|', '@${2}', $str); //Strip html href tag $str = preg_replace('|<a href="(.*?)".*>(.*)</a>|', '${1}', $str); // Escape it first $str = CStringHelper::escape(rtrim(str_replace(' ', '', $str))); $str = str_replace('&quot;', '"', $str); // Autolink url $str = CStringHelper::autoLink($str); // Nl2Br $str = nl2br($str); // Autolinked username $str = CUserHelper::replaceAliasURL($str); $str = CStringHelper::getEmoticon($str); $str = CStringHelper::getMood($str, $mood); $str = CStringHelper::converttagtolink($str); return $str; }
/** * General purpose stream formatting function */ public static function format($str, $mood = null) { // Some database actually already stored some URL already linked! Such as @mention format // To handle this, we strip to to the base format. and apply the linking later $str = preg_replace('|@<a href="(.*?)".*>(.*)</a>|', '@${2}', $str); //Strip html href tag $str = preg_replace('|<a href="(.*?)".*>(.*)</a>|', '${1}', $str); // Escape it first $str = CStringHelper::escape(rtrim(str_replace(' ', '', $str))); $str = str_replace('&quot;', '"', $str); // Autolink url $str = CStringHelper::autoLink($str); // Nl2Br $str = nl2br($str); // Autolinked username $str = CUserHelper::replaceAliasURL($str); $str = CStringHelper::getEmoticon($str); $str = CStringHelper::getMood($str, $mood); $str = CStringHelper::converttagtolink($str); //onstream comment filter // onMessageDisplay Event trigger if ($str) { $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $strObj = new stdClass(); $strObj->body = $str; $arg[] = $strObj; $appsLib->triggerEvent('onFormatConversion', $arg); $str = $arg[0]->body; // reassign back to string } return $str; }