Handle emojis with all the other BBcode

Previously, emojis were being handled specially in the personal message
code and the Display template. Aside from being a duplication of code,
this was done incorrectly in the case of the Display template;
$bodyChanged would be set to true for the first post on a page, and all
subsequent posts would have their [emoji] tags left in place.

This patch moves the emoji logic into the BBcode function. Apart from
fixing the broken behaviour described above, this also reduces the diff
against SMF by deduplicating this code and allows emoji parsing to be
cached just the same way as ordinary BBcode.

I originally wanted to make [emoji] a BBcode tag proper, but the way
Tapatalk does emojis is incompatible with the way SMF does BBcode, so a
preg_replace call is still necessary.