mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/13713] Remove unneeded code in helper
PHPBB3-13713
This commit is contained in:
parent
d91e3bd66a
commit
89d65f5da0
2 changed files with 10 additions and 26 deletions
|
@ -75,7 +75,7 @@ class mention extends \phpbb\notification\type\post
|
|||
'ignore_users' => array(),
|
||||
), $options);
|
||||
|
||||
$user_ids = $this->helper->get_mentioned_ids($post['post_text']);
|
||||
$user_ids = $this->helper->get_mentioned_user_ids($post['post_text']);
|
||||
|
||||
$user_ids = array_unique($user_ids);
|
||||
|
||||
|
|
|
@ -242,14 +242,12 @@ class mention_helper
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a list of mentioned names
|
||||
* Get a list of mentioned user IDs
|
||||
*
|
||||
* @param string $xml Parsed text
|
||||
* @param string $type Name type ('u' for users, 'g' for groups,
|
||||
* 'ug' for usernames mentioned separately or as group members)
|
||||
* @return int[] List of IDs
|
||||
* @return int[] List of user IDs
|
||||
*/
|
||||
public function get_mentioned_ids($xml, $type = 'ug')
|
||||
public function get_mentioned_user_ids($xml)
|
||||
{
|
||||
$ids = array();
|
||||
if (strpos($xml, '<MENTION ') === false)
|
||||
|
@ -261,8 +259,6 @@ class mention_helper
|
|||
$dom->loadXML($xml);
|
||||
$xpath = new \DOMXPath($dom);
|
||||
|
||||
if ($type === 'ug')
|
||||
{
|
||||
/** @var \DOMElement $mention */
|
||||
foreach ($xpath->query('//MENTION') as $mention)
|
||||
{
|
||||
|
@ -275,18 +271,6 @@ class mention_helper
|
|||
$this->get_user_ids_for_group($ids, (int) $mention->getAttribute('id'));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @var \DOMElement $mention */
|
||||
foreach ($xpath->query('//MENTION') as $mention)
|
||||
{
|
||||
if ($mention->getAttribute('type') === $type)
|
||||
{
|
||||
$ids[] = (int) $mention->getAttribute('id');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue