mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
Added the ability to add 'strong' and 'span' tags in chat's system messages
This commit is contained in:
parent
4e69fc957d
commit
678f54ca0c
@ -87,23 +87,29 @@ function post_message($threadid, $kind, $message, $from = null, $agentid = null)
|
||||
return $id;
|
||||
}
|
||||
|
||||
function prepare_html_message($text)
|
||||
function prepare_html_message($text, $allow_formating)
|
||||
{
|
||||
$escaped_text = htmlspecialchars($text);
|
||||
$text_w_links = preg_replace('/(https?|ftp):\/\/\S*/', '<a href="$0" target="_blank">$0</a>', $escaped_text);
|
||||
$multiline = str_replace("\n", "<br/>", $text_w_links);
|
||||
return $multiline;
|
||||
if (! $allow_formating) {
|
||||
return $multiline;
|
||||
}
|
||||
$formated = preg_replace('/<(span|strong)>(.*)<\/\1>/U', '<$1>$2</$1>', $multiline);
|
||||
$formated = preg_replace('/<span class="(.*)">(.*)<\/span>/U', '<span class="$1">$2</span>', $formated);
|
||||
return $formated;
|
||||
}
|
||||
|
||||
function message_to_html($msg)
|
||||
{
|
||||
global $kind_to_string, $kind_avatar;
|
||||
global $kind_to_string, $kind_user, $kind_agent, $kind_avatar;
|
||||
if ($msg['ikind'] == $kind_avatar) return "";
|
||||
$message = "<span>" . date("H:i:s", $msg['created']) . "</span> ";
|
||||
$kind = $kind_to_string{$msg['ikind']};
|
||||
if ($msg['tname'])
|
||||
$message .= "<span class='n$kind'>" . htmlspecialchars($msg['tname']) . "</span>: ";
|
||||
$message .= "<span class='m$kind'>" . prepare_html_message($msg['tmessage']) . "</span><br/>";
|
||||
$allow_formating = ($msg['ikind'] != $kind_user && $msg['ikind'] != $kind_agent);
|
||||
$message .= "<span class='m$kind'>" . prepare_html_message($msg['tmessage'], $allow_formating) . "</span><br/>";
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
@ -63,13 +63,13 @@ chat.redirected.closewindow=Click to close the window
|
||||
chat.redirected.content=The visitor has been placed in the priorty queue of the operator {0}.
|
||||
chat.redirected.group.content=The visitor has been placed in a priorty queue of the group {0}.
|
||||
chat.redirected.title=The visitor has been redirected to another operator
|
||||
chat.status.operator.changed=Operator {0} changed operator {1}
|
||||
chat.status.operator.changed=Operator <strong>{0}</strong> changed operator <strong>{1}</strong>
|
||||
chat.status.operator.dead=Your operator has connection issues. We have moved you to a priorty position in the queue. Sorry for keeping you waiting.
|
||||
chat.status.operator.joined=Operator {0} joined the chat
|
||||
chat.status.operator.left=Operator {0} left the chat
|
||||
chat.status.operator.redirect=Operator {0} redirected you to another operator. Please wait a while.
|
||||
chat.status.operator.returned=Operator {0} is back
|
||||
chat.status.user.changedname=The visitor changed their name {0} to {1}
|
||||
chat.status.user.changedname=The visitor changed their name <strong>{0}</strong> to <strong>{1}</strong>
|
||||
chat.status.user.dead=Visitor closed chat window
|
||||
chat.status.user.left=Visitor {0} left the chat
|
||||
chat.status.user.reopenedthread=Visitor joined chat again
|
||||
|
@ -63,13 +63,13 @@ chat.redirected.closewindow=
|
||||
chat.redirected.content=Посетитель помещен в привелегированную очередь оператора {0}.
|
||||
chat.redirected.group.content=Посетитель помещен в привелегированную очередь группы {0}.
|
||||
chat.redirected.title=Посетитель переведен другому оператору
|
||||
chat.status.operator.changed=Îïåðàòîð {0} ñìåíèë îïåðàòîðà {1}
|
||||
chat.status.operator.changed=Îïåðàòîð <strong>{0}</strong> ñìåíèë îïåðàòîðà <strong>{1}</strong>
|
||||
chat.status.operator.dead=У оператора возникли проблемы со связью, мы временно перевели Вас в приоритетную очередь. Приносим извинения за Ваше ожидание.
|
||||
chat.status.operator.joined=Оператор {0} включился в разговор
|
||||
chat.status.operator.left=Оператор {0} покинул диалог
|
||||
chat.status.operator.redirect=Оператор {0} переключил Вас на другого оператора, пожалуйста, подождите немного
|
||||
chat.status.operator.returned=Оператор {0} вернулся в диалог
|
||||
chat.status.user.changedname=Ïîñåòèòåëü ñìåíèë èìÿ {0} íà {1}
|
||||
chat.status.user.changedname=Ïîñåòèòåëü ñìåíèë èìÿ <strong>{0}</strong> íà <strong>{1}</strong>
|
||||
chat.status.user.dead=Посетитель закрыл окно диалога
|
||||
chat.status.user.left=Посетитель {0} покинул диалог
|
||||
chat.status.user.reopenedthread=Посетитель заново вошел в диалог
|
||||
|
Loading…
Reference in New Issue
Block a user