ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
trait.ilObjFileSecureString.php File Reference

Go to the source code of this file.

Functions

 extractSuffixFromFilename (string $filename)
 
 stripSuffix (string $title, ?string $suffix=null)
 
 ensureSuffix (string $title, ?string $suffix=null)
 
 ensureSuffixInBrackets (string $title, ?string $suffix=null)
 

Variables

trait ilObjFileSecureString
 Trait ilObjFileSecureString. More...
 

Function Documentation

◆ ensureSuffix()

ensureSuffix ( string  $title,
?string  $suffix = null 
)
protected

Definition at line 48 of file trait.ilObjFileSecureString.php.

48 : string
49 {
50 $title = $this->stripSuffix($title, $suffix);
51 $suffix ??= $this->extractSuffixFromFilename($title);
52
53 if ($suffix !== null && strrpos((string) $title, "." . $suffix) === false) {
54 $title .= "." . $suffix;
55 }
56
57 return $this->secure(rtrim((string) $title, "."));
58 }
stripSuffix(string $title, ?string $suffix=null)
extractSuffixFromFilename(string $filename)

References extractSuffixFromFilename(), and stripSuffix().

Referenced by ilObjFile\appendStream(), ilObjFile\appendSuffixToTitle(), ilObjFile\beforeUpdate(), ilDAVContainer\createFile(), ilCollectFilesJob\getFileDirs(), ilDAVFile\getName(), ilObjFile\handleChangedObjectTitle(), ilDAVFile\put(), ilFileVersionFormGUI\saveObject(), ilDAVFile\setName(), and ilObjFile\updateObjectFromRevision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureSuffixInBrackets()

ensureSuffixInBrackets ( string  $title,
?string  $suffix = null 
)
protected

Definition at line 60 of file trait.ilObjFileSecureString.php.

60 : string
61 {
62 $title = $this->stripSuffix($title, $suffix);
63 $suffix ??= $this->extractSuffixFromFilename($title);
64
65 if ($suffix !== null && strrpos((string) $title, "." . $suffix) === false) {
66 $title .= " (" . $suffix . ")";
67 }
68
69 return $this->secure($title);
70 }

References extractSuffixFromFilename(), and stripSuffix().

+ Here is the call graph for this function:

◆ extractSuffixFromFilename()

extractSuffixFromFilename ( string  $filename)
protected

Definition at line 29 of file trait.ilObjFileSecureString.php.

29 : string
30 {
31 if (!preg_match('/^(.+?)(?<!\s)\.([^.]*$|$)/', $filename, $matches)) {
32 return '';
33 }
34 return $this->secure($matches[2]);
35 }
$filename
Definition: buildRTE.php:78

References $filename.

Referenced by ilObjFile\appendStream(), ilObjFile\appendSuffixToTitle(), ilObjFile\beforeUpdate(), ilDAVContainer\createFile(), ensureSuffix(), ensureSuffixInBrackets(), ilDAVFile\getName(), ilDAVFile\put(), ilDAVFile\setName(), and stripSuffix().

+ Here is the caller graph for this function:

◆ stripSuffix()

stripSuffix ( string  $title,
?string  $suffix = null 
)
protected

Definition at line 37 of file trait.ilObjFileSecureString.php.

37 : string
38 {
39 $suffix ??= $this->extractSuffixFromFilename($title);
40
41 if ($suffix !== null && ($length = strrpos($title, "." . $suffix)) > 0) {
42 $title = substr($title, 0, $length);
43 }
44
45 return $this->secure($title);
46 }

References extractSuffixFromFilename().

Referenced by ensureSuffix(), ensureSuffixInBrackets(), ilObjFileInfo\getHeaderTitle(), and ilObjFileInfo\getListTitle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ ilObjFileSecureString

trait ilObjFileSecureString
Initial value:
{
use SecureString

Trait ilObjFileSecureString.

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 25 of file trait.ilObjFileSecureString.php.