Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
rutube.php
1<?php
2
4
8
9class RuTube extends OpenGraph
10{
11 public function handle(HtmlDocument $document)
12 {
13 parent::handle($document);
14
15 $video = $document->getExtraField('VIDEO');
16 if (!empty($video) && $document->getExtraField('VIDEO_TYPE') === 'text/html')
17 {
18 $width = $document->getExtraField('VIDEO_WIDTH');
19 if (!$width || $width > UrlPreview::IFRAME_MAX_WIDTH)
20 {
22 $document->setExtraField('VIDEO_WIDTH', $width);
23 }
24 $height = $document->getExtraField('VIDEO_HEIGHT');
25 if (!$height || $height > UrlPreview::IFRAME_MAX_HEIGHT)
26 {
28 $document->setExtraField('VIDEO_HEIGHT', $height);
29 }
30 $iframe = '<iframe src="'.$video.'" allowfullscreen="" width="'.$width.'" height="'.$height.'" frameborder="0"></iframe>';
31 $document->setEmbed($iframe);
32 }
33 }
34}
setExtraField($fieldName, $fieldValue)
handle(HtmlDocument $document)
Definition rutube.php:11