1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
urlmetadata.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\UrlPreview;
4
5use Bitrix\Main;
6use Bitrix\Main\Text\Emoji;
7use Bitrix\Main\ORM\Event;
8use Bitrix\Main\ORM\Data\DataManager;
9use Bitrix\Main\ORM\Fields;
10
28{
29 const TYPE_STATIC = 'S';
30 const TYPE_DYNAMIC = 'D';
31 const TYPE_TEMPORARY = 'T';
32 const TYPE_FILE = 'F';
33
39 public static function getTableName()
40 {
41 return 'b_urlpreview_metadata';
42 }
43
49 public static function getMap()
50 {
51 return array(
52 'ID' => new Fields\IntegerField('ID', array(
53 'primary' => true,
54 'autocomplete' => true,
55 )),
56 'URL' => new Fields\StringField('URL', array(
57 'required' => true,
58 )),
59 'TYPE' => new Fields\StringField('TYPE', array(
60 'required' => true,
61 )),
62 'TITLE' => new Fields\StringField('TITLE', [
63 'save_data_modification' => [Emoji::class, 'getSaveModificator'],
64 'fetch_data_modification' => [Emoji::class, 'getFetchModificator'],
65 ]),
66 'DESCRIPTION' => new Fields\TextField('DESCRIPTION', [
67 'save_data_modification' => [Emoji::class, 'getSaveModificator'],
68 'fetch_data_modification' => [Emoji::class, 'getFetchModificator'],
69 ]),
70 'IMAGE_ID' => new Fields\IntegerField('IMAGE_ID'),
71 'IMAGE' => new Fields\StringField('IMAGE'),
72 'EMBED' => new Fields\TextField('EMBED', [
73 'save_data_modification' => [Emoji::class, 'getSaveModificator'],
74 'fetch_data_modification' => [Emoji::class, 'getFetchModificator'],
75 ]),
76 'EXTRA' => new Fields\TextField('EXTRA', array(
77 'serialized' => true,
78 )),
79 'DATE_INSERT' => new Fields\DatetimeField('DATE_INSERT', array(
80 'default_value' => new Main\Type\DateTime(),
81 )),
82 'DATE_EXPIRE' => new Fields\DatetimeField('DATE_EXPIRE')
83 );
84 }
85
93 public static function getByUrl($url)
94 {
95 $parameters = [
96 'select' => ['*'],
97 'filter' => [
98 '=URL' => $url,
99 ],
100 'order' => [
101 'ID' => 'desc'
102 ],
103 'limit' => 1
104 ];
105
106 return static::getList($parameters)->fetch();
107 }
108
109 public static function onUpdate(Event $event)
110 {
111 $parameters = $event->getParameters();
112
113 if (!empty($parameters['fields']))
114 {
115 if (array_key_exists('IMAGE_ID', $parameters['fields']))
116 {
117 $currentValues = static::getList([
118 'select' => ['IMAGE_ID'],
119 'filter' => ['=ID' => $parameters['id']],
120 ])->fetch();
121
122 if ($currentValues['IMAGE_ID'] > 0 && $currentValues['IMAGE_ID'] != $parameters['fields']['IMAGE_ID'])
123 {
124 \CFile::Delete($currentValues['IMAGE_ID']);
125 }
126 }
127 }
128 }
129
130 public static function onDelete(Event $event)
131 {
132 $parameters = $event->getParameters();
133
134 $currentValues = static::getList([
135 'select' => ['IMAGE_ID'],
136 'filter' => ['=ID' => $parameters['id']],
137 ])->fetch();
138
139 if ($currentValues['IMAGE_ID'] > 0)
140 {
141 \CFile::Delete($currentValues['IMAGE_ID']);
142 }
143 }
144}
Определения event.php:5
static onDelete(Event $event)
Определения urlmetadata.php:130
static onUpdate(Event $event)
Определения urlmetadata.php:109
static getByUrl($url)
Определения urlmetadata.php:93
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if($request->isPost() && $currentAction !==null &&check_bitrix_sessid()) $currentValues
Определения options.php:198
Определения collection.php:2
$event
Определения prolog_after.php:141
$url
Определения iframe.php:7