mybb/mybb — pull request #1128 by frostschutz (2014-08-06 16:10:40+00:00)
Title: smilie parser using strtr()

I promised I'd send a pull request here: https://github.com/mybb/mybb/issues/970 (which originated here http://community.mybb.com/thread-156157-post-1086924.html#pid1086924 )

It's an experimental change to the smilie parser which uses `strtr()` (a very efficient mass string replacement function) instead of calling `preg_replace()` dozens of times. This should make smilie parsing faster especially for forums that offer lots of smilies. It also includes a few other optimizations, like a faster method to revert the `` placeholders.

`strtr()` has the property of parsing longest strings first, which resolves issues with overlapping smilies or parentheses, although that alone could have been done with a single line change at the end of the smilie cache function:

`uksort($this->smilies_cache, create_function('$a,$b', 'return strlen($b)-strlen($a);'));`

If you decide to not use `strtr()`, it would be nice to at least do that single line change.