19 declare(strict_types=1);
37 protected string $resource_version,
38 protected bool $append_resource_version =
false,
39 protected bool $strip_queries =
true,
40 protected bool $allow_external =
false,
41 protected bool $allow_non_existing =
false,
50 protected function isURI(
string $content): bool
52 if (realpath($content) !==
false) {
66 if (!$this->
isURI($content)) {
71 if ((
new URI(
$url))->getHost() !== (
new URI(ILIAS_HTTP_PATH))->getHost()) {
86 foreach ($this->items as
$path => $item) {
96 if (!$this->append_resource_version && !$this->strip_queries) {
106 $content_array = explode(
'?', $content);
107 if ($this->strip_queries) {
108 $content = $content_array[0] ?? $content;
110 if ($this->append_resource_version) {
112 $content = rtrim($content,
"&") .
"&version=" . $this->resource_version;
114 $content = rtrim($content,
"?") .
"?version=" . $this->resource_version;
118 return $media->withContent($content);
126 return (
bool) preg_match(
'/^(data:)([a-z\/]*)((;base64)?)(,?)([A-z0-9=\/\+]*)$/', $content);
131 return (str_contains($content,
"?"));
139 return iterator_to_array($this->
getItems());
148 if (str_contains($path,
'?')) {
149 return parse_url($path, PHP_URL_PATH);
handleParameters(AbstractMedia $media)
__construct(protected string $resource_version, protected bool $append_resource_version=false, protected bool $strip_queries=true, protected bool $allow_external=false, protected bool $allow_non_existing=false,)
hasContentParameters(string $content)
getItemsInOrderOfDelivery()
isExternalURI(string $content)
isContentDataUri(string $content)