2 declare(strict_types=1);
3 namespace wcf\system\message\embedded\object;
4 use wcf\data\user\UserList;
5 use wcf\system\cache\runtime\UserProfileRuntimeCache;
6 use wcf\system\html\input\HtmlInputProcessor;
7 use wcf\util\StringUtil;
10 * IMessageEmbeddedObjectHandler implementation for quotes.
13 * @copyright 2001-2018 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\Message\Embedded\Object
17 class QuoteMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObjectHandler {
21 public function parse(HtmlInputProcessor $htmlInputProcessor, array $embeddedData) {
24 /** @var \DOMElement $element */
25 foreach ($htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('woltlab-quote') as $element) {
26 $username = StringUtil::trim($element->getAttribute('data-author'));
27 if (!empty($username) && !in_array($username, $usernames)) {
28 $usernames[] = $username;
32 if (!empty($usernames)) {
33 $userList = new UserList();
34 $userList->getConditionBuilder()->add("user_table.username IN (?)", [$usernames]);
35 $userList->readObjectIDs();
36 return $userList->getObjectIDs();
45 public function loadObjects(array $objectIDs) {
46 return UserProfileRuntimeCache::getInstance()->getObjects($objectIDs);