ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilWACPath Class Reference

Class ilWACPath. More...

+ Collaboration diagram for ilWACPath:

Public Member Functions

 __construct ($path)
 ilWACPath constructor. More...
 
 getDirName ()
 
 isImage ()
 
 isVideo ()
 
 isAudio ()
 
 isStreamable ()
 
 fileExists ()
 
 hasToken ()
 
 hasTimestamp ()
 
 hasTTL ()
 
 getToken ()
 
 setToken ($token)
 
 getTimestamp ()
 
 setTimestamp ($timestamp)
 
 getTTL ()
 
 setTTL ($ttl)
 
 getClient ()
 
 setClient ($client)
 
 getSecurePathId ()
 
 setSecurePathId ($secure_path_id)
 
 getPath ()
 
 setPath ($path)
 
 getSuffix ()
 
 setSuffix ($suffix)
 
 getQuery ()
 
 setQuery ($query)
 
 getParameters ()
 
 setParameters ($parameters)
 
 getFileName ()
 
 setFileName ($file_name)
 
 getOriginalRequest ()
 
 setOriginalRequest ($original_request)
 
 getPathWithoutQuery ()
 
 setPathWithoutQuery ($path_without_query)
 
 getSecurePath ()
 
 setSecurePath ($secure_path)
 
 isInSecFolder ()
 
 setInSecFolder ($in_sec_folder)
 

Static Public Member Functions

static getImageSuffixes ()
 
static setImageSuffixes ($image_suffixes)
 
static getVideoSuffixes ()
 
static setVideoSuffixes ($video_suffixes)
 

Data Fields

const DIR_DATA = "data"
 
const DIR_SEC = "sec"
 

Protected Member Functions

 handleParameters ()
 

Protected Attributes

 $client = ''
 
 $secure_path_id = ''
 
 $secure_path = ''
 
 $path = ''
 
 $suffix = ''
 
 $query = ''
 
 $parameters = array()
 
 $file_name = ''
 
 $original_request = ''
 
 $path_without_query = ''
 
 $in_sec_folder = false
 
 $token = ''
 
 $timestamp = 0
 
 $ttl = 0
 

Static Protected Attributes

static $image_suffixes
 
static $video_suffixes
 
static $audio_suffixes
 

Detailed Description

Class ilWACPath.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 9 of file class.ilWACPath.php.

Constructor & Destructor Documentation

◆ __construct()

ilWACPath::__construct (   $path)

ilWACPath constructor.

Parameters
string$path

Definition at line 105 of file class.ilWACPath.php.

105 {
107
108 $regex_client = "[\\w-\\.]*";
109
110 preg_match("/\\/" . self::DIR_DATA . "\\/({$regex_client})\\/(" . self::DIR_SEC . "\\/|)([\\w]*)\\/(.*)/ui", $path, $results);
111 preg_match("/(\\/" . self::DIR_DATA . "\\/{$regex_client}\\/[\\w]*\\/.*)\\?/ui", $path, $results2);
112 $this->setPathWithoutQuery(isset($results2[1]) ? '.' . $results2[1] : '.' . $results[0]);
113 $this->setPath('.' . $results[0]);
114 $this->setClient($results[1]);
115 $this->setInSecFolder($results[2] == 'sec/');
116 $this->setSecurePathId($results[3]);
117 $parts = parse_url($path);
118 $this->setFileName(basename($parts['path']));
119 if (isset($parts['query'])) {
120 $parts_query = $parts['query'];
121 $this->setQuery($parts_query);
122 parse_str($parts_query, $query);
123 $this->setParameters($query);
124 }
125 $this->setSuffix(pathinfo($parts['path'], PATHINFO_EXTENSION));
126 preg_match("/\\/" . self::DIR_DATA . "\\/({$regex_client})\\/(" . self::DIR_SEC
127 . "\\/[\\w]*\\/[\\d]*\\/|[\\w]*\\/)([\\w]*)\\//ui", $path, $results3);
128 $this->setSecurePath(isset($results3[0]) ? '.' . $results3[0] : null);
129 $this->handleParameters();
130 }
setOriginalRequest($original_request)
setSecurePathId($secure_path_id)
setParameters($parameters)
setClient($client)
setQuery($query)
setInSecFolder($in_sec_folder)
setSuffix($suffix)
setSecurePath($secure_path)
setFileName($file_name)
setPathWithoutQuery($path_without_query)
$results

References $path, $query, $results, handleParameters(), setClient(), setFileName(), setInSecFolder(), setOriginalRequest(), setParameters(), setPath(), setPathWithoutQuery(), setQuery(), setSecurePath(), setSecurePathId(), and setSuffix().

+ Here is the call graph for this function:

Member Function Documentation

◆ fileExists()

ilWACPath::fileExists ( )
Returns
bool

Definition at line 190 of file class.ilWACPath.php.

190 {
191 return is_file($this->getPathWithoutQuery());
192 }

References getPathWithoutQuery().

+ Here is the call graph for this function:

◆ getClient()

ilWACPath::getClient ( )
Returns
string

Definition at line 273 of file class.ilWACPath.php.

273 {
274 return $this->client;
275 }

References $client.

◆ getDirName()

ilWACPath::getDirName ( )
Returns
string

Definition at line 150 of file class.ilWACPath.php.

150 {
151 return dirname($this->getPathWithoutQuery());
152 }

References getPathWithoutQuery().

+ Here is the call graph for this function:

◆ getFileName()

ilWACPath::getFileName ( )
Returns
string

Definition at line 369 of file class.ilWACPath.php.

369 {
370 return $this->file_name;
371 }

References $file_name.

Referenced by ilObjUserAccess\canBeDelivered().

+ Here is the caller graph for this function:

◆ getImageSuffixes()

static ilWACPath::getImageSuffixes ( )
static
Returns
array

Definition at line 401 of file class.ilWACPath.php.

401 {
403 }
static $image_suffixes

References $image_suffixes.

◆ getOriginalRequest()

ilWACPath::getOriginalRequest ( )
Returns
string

Definition at line 385 of file class.ilWACPath.php.

385 {
387 }

References $original_request.

◆ getParameters()

ilWACPath::getParameters ( )
Returns
array

Definition at line 353 of file class.ilWACPath.php.

353 {
354 return $this->parameters;
355 }

References $parameters.

Referenced by handleParameters().

+ Here is the caller graph for this function:

◆ getPath()

ilWACPath::getPath ( )

◆ getPathWithoutQuery()

ilWACPath::getPathWithoutQuery ( )
Returns
string

Definition at line 433 of file class.ilWACPath.php.

433 {
435 }

References $path_without_query.

Referenced by fileExists(), and getDirName().

+ Here is the caller graph for this function:

◆ getQuery()

ilWACPath::getQuery ( )
Returns
string

Definition at line 337 of file class.ilWACPath.php.

337 {
338 return $this->query;
339 }

References $query.

◆ getSecurePath()

ilWACPath::getSecurePath ( )
Returns
string

Definition at line 449 of file class.ilWACPath.php.

449 {
450 return $this->secure_path;
451 }

References $secure_path.

◆ getSecurePathId()

ilWACPath::getSecurePathId ( )
Returns
string

Definition at line 289 of file class.ilWACPath.php.

289 {
291 }

References $secure_path_id.

Referenced by ilObjFileAccess\canBeDelivered().

+ Here is the caller graph for this function:

◆ getSuffix()

ilWACPath::getSuffix ( )
Returns
string

Definition at line 321 of file class.ilWACPath.php.

321 {
322 return $this->suffix;
323 }

References $suffix.

Referenced by isAudio(), isImage(), and isVideo().

+ Here is the caller graph for this function:

◆ getTimestamp()

ilWACPath::getTimestamp ( )
Returns
int

Definition at line 239 of file class.ilWACPath.php.

239 {
240 return $this->timestamp;
241 }

References $timestamp.

◆ getToken()

ilWACPath::getToken ( )
Returns
string

Definition at line 222 of file class.ilWACPath.php.

222 {
223 return $this->token;
224 }

References $token.

◆ getTTL()

ilWACPath::getTTL ( )
Returns
int

Definition at line 256 of file class.ilWACPath.php.

256 {
257 return $this->ttl;
258 }

References $ttl.

◆ getVideoSuffixes()

static ilWACPath::getVideoSuffixes ( )
static
Returns
array

Definition at line 417 of file class.ilWACPath.php.

417 {
419 }
static $video_suffixes

References $video_suffixes.

◆ handleParameters()

ilWACPath::handleParameters ( )
protected

Definition at line 133 of file class.ilWACPath.php.

133 {
134 $param = $this->getParameters();
135 if (isset($param[ilWACSignedPath::WAC_TOKEN_ID])) {
137 }
138 if (isset($param[ilWACSignedPath::WAC_TIMESTAMP_ID])) {
140 }
141 if (isset($param[ilWACSignedPath::WAC_TTL_ID])) {
142 $this->setTTL($param[ilWACSignedPath::WAC_TTL_ID]);
143 }
144 }
setToken($token)
setTimestamp($timestamp)

References getParameters(), setTimestamp(), setToken(), setTTL(), ilWACSignedPath\WAC_TIMESTAMP_ID, ilWACSignedPath\WAC_TOKEN_ID, and ilWACSignedPath\WAC_TTL_ID.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasTimestamp()

ilWACPath::hasTimestamp ( )
Returns
bool

Definition at line 206 of file class.ilWACPath.php.

206 {
207 return ($this->timestamp != 0);
208 }

◆ hasToken()

ilWACPath::hasToken ( )
Returns
bool

Definition at line 198 of file class.ilWACPath.php.

198 {
199 return ($this->token != '');
200 }

◆ hasTTL()

ilWACPath::hasTTL ( )
Returns
bool

Definition at line 214 of file class.ilWACPath.php.

214 {
215 return ($this->ttl != 0);
216 }

◆ isAudio()

ilWACPath::isAudio ( )
Returns
bool

Definition at line 174 of file class.ilWACPath.php.

174 {
175 return in_array(strtolower($this->getSuffix()), self::$audio_suffixes);
176 }

References getSuffix().

Referenced by isStreamable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isImage()

ilWACPath::isImage ( )
Returns
bool

Definition at line 158 of file class.ilWACPath.php.

158 {
159 return in_array(strtolower($this->getSuffix()), self::$image_suffixes);
160 }

References getSuffix().

+ Here is the call graph for this function:

◆ isInSecFolder()

ilWACPath::isInSecFolder ( )
Returns
boolean

Definition at line 465 of file class.ilWACPath.php.

465 {
467 }

References $in_sec_folder.

◆ isStreamable()

ilWACPath::isStreamable ( )
Returns
bool

Definition at line 182 of file class.ilWACPath.php.

182 {
183 return ($this->isAudio() || $this->isVideo());
184 }

References isAudio(), and isVideo().

+ Here is the call graph for this function:

◆ isVideo()

ilWACPath::isVideo ( )
Returns
bool

Definition at line 166 of file class.ilWACPath.php.

166 {
167 return in_array(strtolower($this->getSuffix()), self::$video_suffixes);
168 }

References getSuffix().

Referenced by isStreamable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setClient()

ilWACPath::setClient (   $client)
Parameters
string$client

Definition at line 281 of file class.ilWACPath.php.

281 {
282 $this->client = $client;
283 }

References $client.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setFileName()

ilWACPath::setFileName (   $file_name)
Parameters
string$file_name

Definition at line 377 of file class.ilWACPath.php.

377 {
378 $this->file_name = $file_name;
379 }

References $file_name.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setImageSuffixes()

static ilWACPath::setImageSuffixes (   $image_suffixes)
static
Parameters
array$image_suffixes

Definition at line 409 of file class.ilWACPath.php.

409 {
410 self::$image_suffixes = $image_suffixes;
411 }

References $image_suffixes.

◆ setInSecFolder()

ilWACPath::setInSecFolder (   $in_sec_folder)
Parameters
boolean$in_sec_folder

Definition at line 473 of file class.ilWACPath.php.

473 {
474 $this->in_sec_folder = $in_sec_folder;
475 }

References $in_sec_folder.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setOriginalRequest()

ilWACPath::setOriginalRequest (   $original_request)
Parameters
string$original_request

Definition at line 393 of file class.ilWACPath.php.

393 {
394 $this->original_request = $original_request;
395 }

References $original_request.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setParameters()

ilWACPath::setParameters (   $parameters)
Parameters
array$parameters

Definition at line 361 of file class.ilWACPath.php.

361 {
362 $this->parameters = $parameters;
363 }

References $parameters.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setPath()

ilWACPath::setPath (   $path)
Parameters
string$path

Definition at line 313 of file class.ilWACPath.php.

313 {
314 $this->path = $path;
315 }

References $path.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setPathWithoutQuery()

ilWACPath::setPathWithoutQuery (   $path_without_query)
Parameters
string$path_without_query

Definition at line 441 of file class.ilWACPath.php.

441 {
442 $this->path_without_query = $path_without_query;
443 }

References $path_without_query.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setQuery()

ilWACPath::setQuery (   $query)
Parameters
string$query

Definition at line 345 of file class.ilWACPath.php.

345 {
346 $this->query = $query;
347 }

References $query.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSecurePath()

ilWACPath::setSecurePath (   $secure_path)
Parameters
string$secure_path

Definition at line 457 of file class.ilWACPath.php.

457 {
458 $this->secure_path = $secure_path;
459 }

References $secure_path.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSecurePathId()

ilWACPath::setSecurePathId (   $secure_path_id)
Parameters
string$secure_path_id

Definition at line 297 of file class.ilWACPath.php.

297 {
298 $this->secure_path_id = $secure_path_id;
299 }

References $secure_path_id.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSuffix()

ilWACPath::setSuffix (   $suffix)
Parameters
string$suffix

Definition at line 329 of file class.ilWACPath.php.

329 {
330 $this->suffix = $suffix;
331 }

References $suffix.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setTimestamp()

ilWACPath::setTimestamp (   $timestamp)
Parameters
$timestamp

Definition at line 247 of file class.ilWACPath.php.

247 {
249 $this->timestamp = $timestamp;
250 }

References $timestamp, and ilWACSignedPath\WAC_TIMESTAMP_ID.

Referenced by handleParameters().

+ Here is the caller graph for this function:

◆ setToken()

ilWACPath::setToken (   $token)
Parameters
$token

Definition at line 230 of file class.ilWACPath.php.

230 {
231 $this->parameters[ilWACSignedPath::WAC_TOKEN_ID] = $token;
232 $this->token = $token;
233 }

References $token, and ilWACSignedPath\WAC_TOKEN_ID.

Referenced by handleParameters().

+ Here is the caller graph for this function:

◆ setTTL()

ilWACPath::setTTL (   $ttl)
Parameters
int$ttl

Definition at line 264 of file class.ilWACPath.php.

264 {
265 $this->parameters[ilWACSignedPath::WAC_TTL_ID] = $ttl;
266 $this->ttl = $ttl;
267 }

References $ttl, and ilWACSignedPath\WAC_TTL_ID.

Referenced by handleParameters().

+ Here is the caller graph for this function:

◆ setVideoSuffixes()

static ilWACPath::setVideoSuffixes (   $video_suffixes)
static
Parameters
array$video_suffixes

Definition at line 425 of file class.ilWACPath.php.

425 {
426 self::$video_suffixes = $video_suffixes;
427 }

References $video_suffixes.

Field Documentation

◆ $audio_suffixes

ilWACPath::$audio_suffixes
staticprotected
Initial value:
= array(
'mp3',
'aiff',
'aif',
'wav',
)

Definition at line 92 of file class.ilWACPath.php.

◆ $client

ilWACPath::$client = ''
protected

Definition at line 16 of file class.ilWACPath.php.

Referenced by getClient(), and setClient().

◆ $file_name

ilWACPath::$file_name = ''
protected

Definition at line 44 of file class.ilWACPath.php.

Referenced by getFileName(), and setFileName().

◆ $image_suffixes

ilWACPath::$image_suffixes
staticprotected
Initial value:
= array(
'png',
'jpg',
'jpeg',
'gif',
'svg',
)

Definition at line 72 of file class.ilWACPath.php.

Referenced by getImageSuffixes(), and setImageSuffixes().

◆ $in_sec_folder

ilWACPath::$in_sec_folder = false
protected

Definition at line 56 of file class.ilWACPath.php.

Referenced by isInSecFolder(), and setInSecFolder().

◆ $original_request

ilWACPath::$original_request = ''
protected

Definition at line 48 of file class.ilWACPath.php.

Referenced by getOriginalRequest(), and setOriginalRequest().

◆ $parameters

ilWACPath::$parameters = array()
protected

Definition at line 40 of file class.ilWACPath.php.

Referenced by getParameters(), and setParameters().

◆ $path

ilWACPath::$path = ''
protected

Definition at line 28 of file class.ilWACPath.php.

Referenced by __construct(), getPath(), and setPath().

◆ $path_without_query

ilWACPath::$path_without_query = ''
protected

Definition at line 52 of file class.ilWACPath.php.

Referenced by getPathWithoutQuery(), and setPathWithoutQuery().

◆ $query

ilWACPath::$query = ''
protected

Definition at line 36 of file class.ilWACPath.php.

Referenced by __construct(), getQuery(), and setQuery().

◆ $secure_path

ilWACPath::$secure_path = ''
protected

Definition at line 24 of file class.ilWACPath.php.

Referenced by getSecurePath(), and setSecurePath().

◆ $secure_path_id

ilWACPath::$secure_path_id = ''
protected

Definition at line 20 of file class.ilWACPath.php.

Referenced by getSecurePathId(), and setSecurePathId().

◆ $suffix

ilWACPath::$suffix = ''
protected

Definition at line 32 of file class.ilWACPath.php.

Referenced by getSuffix(), and setSuffix().

◆ $timestamp

ilWACPath::$timestamp = 0
protected

Definition at line 64 of file class.ilWACPath.php.

Referenced by getTimestamp(), and setTimestamp().

◆ $token

ilWACPath::$token = ''
protected

Definition at line 60 of file class.ilWACPath.php.

Referenced by getToken(), and setToken().

◆ $ttl

ilWACPath::$ttl = 0
protected

Definition at line 68 of file class.ilWACPath.php.

Referenced by getTTL(), and setTTL().

◆ $video_suffixes

ilWACPath::$video_suffixes
staticprotected
Initial value:
= array(
'mp4',
'm4v',
'mov',
'wmv',
'webm',
)

Definition at line 82 of file class.ilWACPath.php.

Referenced by getVideoSuffixes(), and setVideoSuffixes().

◆ DIR_DATA

const ilWACPath::DIR_DATA = "data"

Definition at line 11 of file class.ilWACPath.php.

◆ DIR_SEC

const ilWACPath::DIR_SEC = "sec"

Definition at line 12 of file class.ilWACPath.php.


The documentation for this class was generated from the following file: