Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
rutube.php
1
<?php
2
3
namespace
Bitrix\Main\UrlPreview\Parser
;
4
5
use
Bitrix\Main\UrlPreview\HtmlDocument
;
6
use
Bitrix\Main\UrlPreview\UrlPreview
;
7
use
Bitrix\Main\Web\HttpClient
;
8
9
class
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
{
21
$width =
UrlPreview::IFRAME_MAX_WIDTH
;
22
$document->
setExtraField
(
'VIDEO_WIDTH'
, $width);
23
}
24
$height = $document->
getExtraField
(
'VIDEO_HEIGHT'
);
25
if
(!$height || $height >
UrlPreview::IFRAME_MAX_HEIGHT
)
26
{
27
$height =
UrlPreview::IFRAME_MAX_HEIGHT
;
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
}
Bitrix\Main\UrlPreview\HtmlDocument
Definition
htmldocument.php:13
Bitrix\Main\UrlPreview\HtmlDocument\getExtraField
getExtraField($fieldName)
Definition
htmldocument.php:246
Bitrix\Main\UrlPreview\HtmlDocument\setExtraField
setExtraField($fieldName, $fieldValue)
Definition
htmldocument.php:209
Bitrix\Main\UrlPreview\HtmlDocument\setEmbed
setEmbed($embed)
Definition
htmldocument.php:192
Bitrix\Main\UrlPreview\Parser\OpenGraph
Definition
opengraph.php:9
Bitrix\Main\UrlPreview\Parser\RuTube
Definition
rutube.php:10
Bitrix\Main\UrlPreview\Parser\RuTube\handle
handle(HtmlDocument $document)
Definition
rutube.php:11
Bitrix\Main\UrlPreview\UrlPreview
Definition
urlpreview.php:18
Bitrix\Main\UrlPreview\UrlPreview\IFRAME_MAX_HEIGHT
const IFRAME_MAX_HEIGHT
Definition
urlpreview.php:29
Bitrix\Main\UrlPreview\UrlPreview\IFRAME_MAX_WIDTH
const IFRAME_MAX_WIDTH
Definition
urlpreview.php:28
Bitrix\Main\Web\HttpClient
Definition
httpclient.php:24
Bitrix\Main\UrlPreview\Parser
Definition
applemaps.php:2
modules
main
lib
urlpreview
parser
rutube.php
Создано системой
1.10.0