mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 05:20:56 +02:00
[ticket/13713] Introduce notifications for mentions
PHPBB3-13713
This commit is contained in:
@@ -149,4 +149,30 @@ class mention_helper
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of mentioned users
|
||||
* TODO: decide what to do with groups
|
||||
*
|
||||
* @param string $xml Parsed text
|
||||
* @return int[] List of user IDs
|
||||
*/
|
||||
public function get_mentioned_users($xml)
|
||||
{
|
||||
$user_ids = array();
|
||||
if (strpos($xml, '<MENTION ') === false)
|
||||
{
|
||||
return $user_ids;
|
||||
}
|
||||
|
||||
$dom = new \DOMDocument;
|
||||
$dom->loadXML($xml);
|
||||
$xpath = new \DOMXPath($dom);
|
||||
foreach ($xpath->query('//MENTION/@user_id') as $user_id)
|
||||
{
|
||||
$user_ids[] = (int) $user_id->textContent;
|
||||
}
|
||||
|
||||
return $user_ids;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user