19declare(strict_types=1);
45 protected string $resource_version,
46 protected bool $append_resource_version =
false,
47 protected bool $strip_queries =
true,
48 protected bool $allow_external =
false,
49 protected bool $allow_non_existing =
false,
59 $this->version_parameter_filters[] = $filter;
67 protected function isURI(
string $content): bool
69 if (realpath($content) !==
false) {
76 }
catch (\Throwable) {
83 if (!$this->
isURI($content)) {
88 if ((
new URI($content))->getHost() !== (
new URI(ILIAS_HTTP_PATH))->getHost()) {
91 }
catch (\Throwable) {
103 foreach ($this->items as
$path => $item) {
113 if (!$this->append_resource_version && !$this->strip_queries) {
123 $content_array = explode(
'?', $content);
124 if ($this->strip_queries) {
125 $content = $content_array[0] ?? $content;
129 $content = rtrim($content,
"&") .
"&" . self::VERSION_PARAMETER .
"=" . $this->resource_version;
131 $content = rtrim($content,
"?") .
"?" . self::VERSION_PARAMETER .
"=" . $this->resource_version;
135 return $media->withContent($content);
143 return (
bool) preg_match(
'/^(data:)([a-z\/]*)((;base64)?)(,?)([A-z0-9=\/\+]*)$/', $content);
148 return (str_contains($content,
"?"));
153 foreach ($this->version_parameter_filters as $filter) {
154 if (!$filter->shouldAppend($content)) {
166 return iterator_to_array($this->
getItems());
171 if (str_contains(
$path,
'?')) {
172 return parse_url(
$path, PHP_URL_PATH);
The scope of this class is split ilias-conform URI's into components.
hasContentParameters(string $content)
isExternalURI(string $content)
__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, array $version_parameter_filters=[],)
getItemsInOrderOfDelivery()
array $version_parameter_filters
addVersionParameterFilter(VersionParameterFilter $filter)
isContentDataUri(string $content)
handleParameters(AbstractMedia $media)
passesVersionParameterFilters(string $content)
Decides whether the resource version parameter (see {.