31 const REGEX =
"(?<prefix>.*?)(?<path>(?<path_without_query>(?<secure_path_id>(?<module_path>\/data\/(?<client>[\w\-\.]*)\/(?<sec>sec\/|)(?<module_type>.*?)\/(?<module_identifier>.*\/|)))(?<appendix>[^\?\n]*)).*)";
147 assert(is_string(
$path));
149 $re =
'/' . self::REGEX .
'/';
152 $url_parts = parse_url(
$path);
153 $result[
'path_without_query'] = $url_parts[
'path'];
155 foreach (
$result as $k => $v) {
156 if (is_numeric($k)) {
161 $moduleId = strstr(is_null(
$result[
'module_identifier']) ?
'' :
$result[
'module_identifier'],
"/",
true);
162 $moduleId = $moduleId ===
false ?
'' : $moduleId;
174 $modulePath =
'.' . ($modulePath ===
false ?
'' : $modulePath);
176 $modulePath = (
'.' . (is_null(
$result[
'module_path']) ?
'' :
$result[
'module_path']));
182 . (is_null(
$result[
'path_without_query']) ?
'' :
$result[
'path_without_query']));
185 . (is_null(
$result[
'secure_path_id']) ?
'' :
$result[
'secure_path_id']));
188 $parts = parse_url(
$path);
190 if (isset($parts[
'query'])) {
191 $parts_query = $parts[
'query'];
193 parse_str($parts_query,
$query);
196 $this->
setSuffix(pathinfo($parts[
'path'], PATHINFO_EXTENSION));
378 return (
bool) in_array(strtolower($this->
getSuffix()), self::$image_suffixes);
415 return (
bool) in_array(strtolower($this->
getSuffix()), self::$audio_suffixes);
424 return (
bool) in_array(strtolower($this->
getSuffix()), self::$video_suffixes);
442 return (
bool) ($this->token !==
'');
451 return (
bool) ($this->timestamp !== 0);
460 return (
bool) ($this->ttl !== 0);
478 assert(is_string(
$token));
579 return $path_to_file;
588 assert(is_string(
$path));
607 assert(is_string(
$query));
An exception for terminatinating execution or to throw for unit testing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOriginalRequest($original_request)
setSecurePathId($secure_path_id)
static getAudioSuffixes()
static getImageSuffixes()
static setAudioSuffixes(array $audio_suffixes)
getCleanURLdecodedPath()
Returns a clean (everything behind ? is removed and rawurldecoded path.
setModuleIdentifier($module_identifier)
setModulePath($module_path)
static setVideoSuffixes(array $video_suffixes)
const REGEX
Copy this without to regex101.com and test with some URL of files.
setModuleType($module_type)
__construct($path)
ilWACPath constructor.
setInSecFolder($in_sec_folder)
setSecurePath($secure_path)
setParameters(array $parameters)
static setImageSuffixes(array $image_suffixes)
setPathWithoutQuery($path_without_query)
static getVideoSuffixes()