4873dcd003438546c86e86851186a75bfa49a2ff
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\message\embedded\object;
3 use wcf\system\cache\runtime\UserProfileRuntimeCache;
4 use wcf\system\html\input\HtmlInputProcessor;
5
6 /**
7 * Parses embedded users.
8 *
9 * @author Alexander Ebert
10 * @copyright 2001-2016 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package WoltLabSuite\Core\System\Message\Embedded\Object
13 */
14 class UserMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObjectHandler {
15 /**
16 * @inheritDoc
17 */
18 public function parse(HtmlInputProcessor $htmlInputProcessor, array $embeddedData) {
19 $objectIDs = [];
20 if (!empty($embeddedData['user'])) {
21 for ($i = 0, $length = count($embeddedData['user']); $i < $length; $i++) {
22 $objectIDs[] = intval($embeddedData['user'][$i][0]);
23 }
24 }
25
26 return array_unique($objectIDs);
27 }
28
29 /**
30 * @inheritDoc
31 */
32 public function loadObjects(array $objectIDs) {
33 return UserProfileRuntimeCache::getInstance()->getObjects($objectIDs);
34 }
35 }