Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
bfile.php
1
<?php
2
3
namespace
Bitrix\Main\Engine\Response
;
4
5
6
use
Bitrix\Main
;
7
8
class
BFile
extends
File
9
{
10
protected
$file
;
11
12
public
function
__construct
(array
$file
,
$name
=
null
)
13
{
14
$this->file =
$file
;
15
if
(
$name
===
null
)
16
{
17
$name
= $this->file[
'ORIGINAL_NAME'
];
18
}
19
20
parent::__construct(
null
,
$name
, $this->file[
'CONTENT_TYPE'
]);
21
}
22
23
public
static
function
createByFileData
(array
$file
,
$name
=
null
)
24
{
25
return
new
self
(
$file
,
$name
);
26
}
27
28
public
static
function
createByFileId
($fileId,
$name
=
null
)
29
{
30
$file
= \CFile::getFileArray($fileId);
31
if
(!
$file
)
32
{
33
throw
new
Main\ObjectNotFoundException
(
"Could not find file ({$fileId})"
);
34
}
35
36
return
new
self
(
$file
,
$name
);
37
}
38
42
public
function
getFile
()
43
{
44
return
$this->file
;
45
}
46
50
protected
function
prepareFile
()
51
{
52
return
$this->
getFile
();
53
}
54
55
protected
function
prepareOptions
()
56
{
57
return
[
58
'force_download'
=> !$this->
isShowInline
(),
59
'cache_time'
=> $this->
getCacheTime
(),
60
'attachment_name'
=> $this->
getName
(),
61
'content_type'
=> $this->
getContentType
(),
62
];
63
}
64
}
Bitrix\Main\Engine\Response\BFile
Definition
bfile.php:9
Bitrix\Main\Engine\Response\BFile\createByFileData
static createByFileData(array $file, $name=null)
Definition
bfile.php:23
Bitrix\Main\Engine\Response\BFile\createByFileId
static createByFileId($fileId, $name=null)
Definition
bfile.php:28
Bitrix\Main\Engine\Response\BFile\prepareFile
prepareFile()
Definition
bfile.php:50
Bitrix\Main\Engine\Response\BFile\prepareOptions
prepareOptions()
Definition
bfile.php:55
Bitrix\Main\Engine\Response\BFile\$file
$file
Definition
bfile.php:10
Bitrix\Main\Engine\Response\BFile\getFile
getFile()
Definition
bfile.php:42
Bitrix\Main\Engine\Response\BFile\__construct
__construct(array $file, $name=null)
Definition
bfile.php:12
Bitrix\Main\Engine\Response\File
Definition
file.php:9
Bitrix\Main\Engine\Response\File\getName
getName()
Definition
file.php:60
Bitrix\Main\Engine\Response\File\isShowInline
isShowInline()
Definition
file.php:100
Bitrix\Main\Engine\Response\File\getContentType
getContentType()
Definition
file.php:80
Bitrix\Main\Engine\Response\File\$name
$name
Definition
file.php:14
Bitrix\Main\Engine\Response\File\getCacheTime
getCacheTime()
Definition
file.php:120
Bitrix\Main\ObjectNotFoundException
Definition
exception.php:203
Bitrix\Main\Engine\Response
Definition
ajaxjson.php:3
Bitrix\Main
modules
main
lib
engine
response
bfile.php
Создано системой
1.10.0