milesj / decoda

A lightweight lexical string parser for BBCode styled markup.
MIT License
196 stars 52 forks source link

Parse emoticons last #96

Closed serpro closed 9 years ago

serpro commented 9 years ago

I have this issue when I type a text like check this:[size:"14"]blah blah[/size] :[ is converted into an emoticon so it breaks the rest of the bbcode

milesj commented 9 years ago

How are you adding the hooks? You can simply add the emoticon hook last.

serpro commented 9 years ago

I just changed on line 79 (EmoticonHook.php)

    public function beforeParse($content) {

with

    public function afterParse($content) {

and it worked fine.

alquerci commented 9 years ago

@serpro we need to know your Decoda configuration to dump a test case.

serpro commented 9 years ago

This is a simplified version of my viewHelper

$emoticonsConfig = array(
            'path' => '/images/emoticons/',
            'extension' => array( 'gif', 'png' )
);
$bbcode = new Decoda($text);
$bbcode->defaults();
$bbcode->removeHook('Censor');
$bbcode->addHook(new EmoticonHook($emoticonsConfig));
$bbcode->setLineBreaks(true);
return $bbcode->parse();
alquerci commented 9 years ago

@serpro you have an old Decoda version try to upgrade it. The EmoticonHook has been changed since version 6.6.0.

milesj commented 9 years ago

Yeah, updating to the latest should fix the problem. If not, we can look at it.