1
0
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:
lavigor
2018-06-08 13:18:44 +03:00
committed by Marc Alexander
parent 9eef103e75
commit c70ac7eb62
10 changed files with 245 additions and 2 deletions

View File

@@ -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;
}
}