I'm using the chatbox2 which is a (old) replacement for the default chatbox that I have updated to work with e107 v2
I realized a few days ago that :
when I put a single emoticon/smiley in a message, it's works ok, the bbcode is replaced by the expected image
but when I add some text after, the first emoticon isn't replaced and its bbcode is displayed
How to Reproduce
I think that the problem exist also with the default chat, so create a new message with:
an emoticon and " ."
and send it
Expected Behavior
to have the bbcode of the emoticon replaced by its image
Additional Information
The issue is in ~/e107_handlers/e_parse_class.php
function filterEmotes($text)
{
if(empty($text))
{
return '';
}
if(!empty($this->singleSearch) && (strlen($text) < 12) && in_array($text, $this->singleSearch)) // just one emoticon with no space, line-break or html tags around it.
{
return str_replace($this->singleSearch,$this->singleReplace,$text);
}
return str_replace($this->search, $this->replace, $text);
}
array "$this->singleSearch" contain just the list of bbcode
array "$this->search" contain some variations of the bbcode : with a space, a ">" or a "newline" (\n) in front, but not the bbcode alone, so when the emoticon is at the beginning of the message with some characters after, this array is used and the bbcode isn't replaced
2° add the bbcode alone in array "$this->search"
3° don't use "$this->search" but "$this->singleSearch" , only ..... but there is probably a reason for the "formatting" of array "$this->search" that I don't see !
Bug Description
I'm using the chatbox2 which is a (old) replacement for the default chatbox that I have updated to work with e107 v2 I realized a few days ago that : when I put a single emoticon/smiley in a message, it's works ok, the bbcode is replaced by the expected image but when I add some text after, the first emoticon isn't replaced and its bbcode is displayed
How to Reproduce
I think that the problem exist also with the default chat, so create a new message with: an emoticon and " ." and send it
Expected Behavior
to have the bbcode of the emoticon replaced by its image
Additional Information
The issue is in ~/e107_handlers/e_parse_class.php
array "$this->singleSearch" contain just the list of bbcode array "$this->search" contain some variations of the bbcode : with a space, a ">" or a "newline" (\n) in front, but not the bbcode alone, so when the emoticon is at the beginning of the message with some characters after, this array is used and the bbcode isn't replaced
Proposed solution
1°
2° add the bbcode alone in array "$this->search" 3° don't use "$this->search" but "$this->singleSearch" , only ..... but there is probably a reason for the "formatting" of array "$this->search" that I don't see !