ILIAS
trunk Revision v12.0_alpha-1221-g4e438232683
◀ ilDoc Overview
ShortFilePayload.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\FileDelivery\Token\Signer\Payload
;
22
23
use
ILIAS\FileDelivery\Setup\BaseDirObjective
;
24
28
class
ShortFilePayload
extends
StructuredPayload
29
{
30
protected
string
$mime_type
=
''
;
31
protected
string
$disposition
=
''
;
32
protected
int
$user_id
= 0;
33
34
public
function
__construct
(
35
private
string
$uri,
36
private
string
$file_name
37
) {
38
$modification_time = @filemtime($uri);
39
// try to shorten uri
40
$base =
BaseDirObjective::get
();
41
if
($base !==
null
) {
42
$uri = str_replace($base,
''
, $uri);
43
}
44
45
parent::__construct
([
46
'p'
=> $uri,
47
'n'
=> $file_name,
48
'mt'
=> $modification_time,
49
]);
50
}
51
52
public
static
function
fromArray
(array $raw_payload): self
53
{
54
return
new
self
(
55
$raw_payload[
'p'
],
56
$raw_payload[
'n'
],
57
$raw_payload[
'mt'
] ?? false
58
);
59
}
60
61
public
function
getUri
(): string
62
{
63
$uri = $this->uri;
64
// try to expand uri
65
$base =
BaseDirObjective::get
();
66
if
($base !==
null
) {
67
return
$base . $uri;
68
}
69
70
return
$uri;
71
}
72
73
public
function
getMimeType
(): string
74
{
75
return
$this->mime_type
;
76
}
77
78
public
function
getFileName
(): string
79
{
80
return
$this->file_name;
81
}
82
83
public
function
getDisposition
(): string
84
{
85
return
$this->disposition
;
86
}
87
88
public
function
getUserId
():
int
89
{
90
return
$this->user_id
;
91
}
92
}
ILIAS\FileDelivery\Setup\BaseDirObjective
Definition:
BaseDirObjective.php:31
ILIAS\FileDelivery\Setup\BaseDirObjective\get
static get()
Definition:
BaseDirObjective.php:73
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload
Definition:
ShortFilePayload.php:29
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\getFileName
getFileName()
Definition:
ShortFilePayload.php:78
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\getUserId
getUserId()
Definition:
ShortFilePayload.php:88
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\$user_id
int $user_id
Definition:
ShortFilePayload.php:32
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\$disposition
string $disposition
Definition:
ShortFilePayload.php:31
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\__construct
__construct(private string $uri, private string $file_name)
Definition:
ShortFilePayload.php:34
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\getMimeType
getMimeType()
Definition:
ShortFilePayload.php:73
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\$mime_type
string $mime_type
Definition:
ShortFilePayload.php:30
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\fromArray
static fromArray(array $raw_payload)
Definition:
ShortFilePayload.php:52
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\getDisposition
getDisposition()
Definition:
ShortFilePayload.php:83
ILIAS\FileDelivery\Token\Signer\Payload\ShortFilePayload\getUri
getUri()
Definition:
ShortFilePayload.php:61
ILIAS\FileDelivery\Token\Signer\Payload\StructuredPayload
Definition:
StructuredPayload.php:27
ILIAS\FileDelivery\Token\Signer\Payload
Definition:
BadPayload.php:21
ILIAS\GlobalScreen\Provider\__construct
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Definition:
PluginProviderHelper.php:38
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
components
ILIAS
FileDelivery
src
Token
Signer
Payload
ShortFilePayload.php
Generated on Sun Apr 5 2026 23:03:00 for ILIAS by
1.9.4 (using
Doxyfile
)