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