37 private $use_cookie =
true;
66 $this->expires = strtotime($expires);
78 if (!in_array($disposition, [self::ATTACHMENT, self::INLINE])) {
79 throw new DomainException(
"Disposition {$disposition} is not supported in " . __CLASS__);
82 $this->disposition = $disposition;
93 $this->use_cookie = $use_cookie;
103 if (!$this->file->exists()) {
104 elgg_log(
'Unable to resolve resource URL for a file that does not exist on filestore');
111 if (str_starts_with(
$path, $root_prefix)) {
115 if (!$relative_path) {
116 elgg_log(
'Unable to resolve relative path of the file on the filestore');
120 if (
preg_match(
'~[^a-zA-Z0-9_\./ ]~', $relative_path)) {
127 'expires' => $this->expires ?? 0,
128 'last_updated' => filemtime($this->file->getFilenameOnFilestore()),
129 'disposition' => $this->disposition === self::INLINE ?
'i' :
'a',
130 'path' => $relative_path,
133 if ($this->use_cookie) {
135 if (empty(
$data[
'cookie'])) {
139 $data[
'use_cookie'] = 1;
141 $data[
'use_cookie'] = 0;
149 "e{$data['expires']}",
150 "l{$data['last_updated']}",
151 "d{$data['disposition']}",
152 "c{$data['use_cookie']}",
setDisposition(string $disposition=self::ATTACHMENT)
Sets content disposition.
bindSession(bool $use_cookie=true)
Bind URL to current user session.
setExpires(string $expires= '+2 hours')
Sets URL expiration.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Exception thrown if a value does not adhere to a defined valid data domain.
if(!$entity instanceof\ElggUser) $data
getFile()
Returns file object.
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
setFile(\ElggFile $file)
Set file object.
static sanitize($path, $append_slash=true)
Sanitize file paths ensuring that they begin and end with slashes etc.
_elgg_services()
Get the global service provider.
elgg_normalize_url(string $url)
getURL()
Returns publicly accessible URL.
static encode($bytes)
Encode base 64 URL.