Methods Summary | ||
---|---|---|
public static
|
#
getMentionsByContent( string $content_type , int $content_id , array $members = array ( ) )
Returns mentions for a specific content
staticaccess |
|
public static
|
#
insertMentions( string $content_type , int $content_id , array $members , int $id_member )
Inserts mentioned members
staticaccess |
|
public static
|
||
public static
|
#
getMentionedMembers( string $body )
Takes a piece of text and finds all the mentioned members in it
staticaccess |
|
protected static
|
#
getPossibleMentions( string $body )
Parses a body in order to see if there are any mentions, returns possible mention names
Names are tagged by "@<username>" format in post, but they can contain
any type of character up to 60 characters length. So we extract, starting from @
up to 60 characters in length (or if we encounter a line break) and make
several combination of strings after splitting it by anything that's not a word and join
by having the first word, first and second word, first, second and third word and so on and
search every name.
One potential problem with this is something like "@Admin Space" can match
"Admin Space" as well as "Admin", so we sort by length in descending order.
One disadvantage of this is that we can only match by one column, hence I've chosen
real_name since it's the most obvious.
If there's an @ symbol within the name, it is counted in the ongoing string and a new
combination string is started from it as well in order to account for all the possibilities.
This makes the @ symbol to not be required to be escaped
staticaccess |
Properties Summary | ||
---|---|---|
protected static
|
$char
|
#
'@'
|