ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWebDAVCheckValidTitleTrait.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21trait ilWebDAVCheckValidTitleTrait
22{
23 protected function isDAVableObjTitle(string $title): bool
24 {
25 return !$this->hasTitleForbiddenChars($title) && !$this->isHiddenFile($title);
26 }
27
28 protected function hasTitleForbiddenChars(string $title): bool
29 {
30 foreach (str_split('\\<>/:*?"|#') as $forbidden_character) {
31 if (str_contains($title, $forbidden_character)) {
32 return true;
33 }
34 }
35
36 return false;
37 }
38
39 protected function isHiddenFile(string $title): bool
40 {
41 $prefix = substr($title, 0, 1);
42 return $prefix === '.';
43 }
44
45 protected function hasValidFileExtension(string $title): bool
46 {
47 return $title === ilFileUtils::getValidFilename($title);
48 }
49}
static getValidFilename(string $a_filename)