Rasmus Vind
Well-known member
For historical reasons I have a [highlight=language] tag. I think @digitalpoint made it back in the day. Possibly for vBulletin back then. I recently received a bug report where a user was highlighting code for a language full of @ symbols which did not have the desired effect. Random old users were @-mentioned instead.
Here is the code in XenForo_Model_UserTagging that does this:
As you can see, it is hard-coded to a specific list of BB codes where user-tagging is not being done. I would very much like to be able to have this as a setting in my own custom BB code admin interface.
Here is the code in XenForo_Model_UserTagging that does this:
PHP:
public function getTaggedUsersInMessage($message, &$newMessage, $replaceStyle = 'bb')
{
// always set this for early returns
$newMessage = $message;
$filteredMessage = $message;
$this->_plainReplacements = null;
if ($replaceStyle == 'bb')
{
$this->_plainReplacements = array();
$filteredMessage = preg_replace_callback(
'#\[(code|php|html|plain|media|url|img|user|quote)(=[^\]]*)?](.*)\[/\\1]#siU',
array($this, '_plainReplaceHandler'),
$filteredMessage
);
}
else if ($replaceStyle == 'text')
{
$this->_plainReplacements = array();
$filteredMessage = preg_replace_callback(
'#(?<=^|\s|[\](,]|--|@)@\[(\d+):(\'|"|"|)(.*)\\2\]#iU',
array($this, '_plainReplaceHandler'),
$filteredMessage
);
}
// [...]
Upvote
1