1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
UrlCollection.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Entity\Url;
4
5use Bitrix\Im\V2\Entity\EntityCollection;
6use Bitrix\Main\UrlPreview\UrlPreview;
7
13{
17 public function __construct(?array $urls = null)
18 {
19 parent::__construct();
20
21 if ($urls != null)
22 {
23 foreach ($urls as $url)
24 {
25 $this[] = new UrlItem($url);
26 }
27 }
28 }
29
30 public static function getRestEntityName(): string
31 {
32 return 'urls';
33 }
34
39 public static function initByPreviewUrlsIds(array $previewUrlsIds, bool $withHtml = true): self
40 {
41 $urlCollection = new static();
42
43 if (empty($previewUrlsIds))
44 {
45 return $urlCollection;
46 }
47
48 if ($withHtml)
49 {
50 $previews = UrlPreview::getMetadataAndHtmlByIds($previewUrlsIds);
51 }
52 else
53 {
54 $previews = UrlPreview::getMetadataByIds($previewUrlsIds);
55 }
56
57 if ($previews === false)
58 {
59 return $urlCollection;
60 }
61
62 foreach ($previews as $preview)
63 {
64 $urlCollection[] = UrlItem::initByMetadata($preview);
65 }
66
67 return $urlCollection;
68 }
69
70 public static function initByMessage(\Bitrix\Im\V2\Message $message): self
71 {
72 $urls = UrlItem::getUrlsFromText($message->getMessage());
73
74 return new static($urls);
75 }
76}
static initByPreviewUrlsIds(array $previewUrlsIds, bool $withHtml=true)
Определения UrlCollection.php:39
static initByMessage(\Bitrix\Im\V2\Message $message)
Определения UrlCollection.php:70
__construct(?array $urls=null)
Определения UrlCollection.php:17
static initByMetadata(array $metadata)
Определения UrlItem.php:55
static getUrlsFromText(?string $text)
Определения UrlItem.php:82
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения Uuid.php:3
Определения ActionUuid.php:3
$message
Определения payment.php:8
$url
Определения iframe.php:7