File
in package
Defines some file-system helpers for the CMS system.
Tags
Table of Contents
- validateExtension() : bool
- Validates whether a file has an allowed extension.
- validateName() : bool
- Validates a CMS object file or directory name.
- validatePath() : bool
- Validates a CMS object path.
Methods
validateExtension()
Validates whether a file has an allowed extension.
public
static validateExtension(string $fileName, array<string|int, mixed> $allowedExtensions[, bool $allowEmpty = true ]) : bool
Parameters
- $fileName : string
-
Specifies a path to validate
- $allowedExtensions : array<string|int, mixed>
-
A list of allowed file extensions
- $allowEmpty : bool = true
-
Determines whether the file extension could be empty.
Return values
bool —Returns true if the file extension is valid. Otherwise returns false.
validateName()
Validates a CMS object file or directory name.
public
static validateName(string $fileName) : bool
CMS object file names can contain only alphanumeric symbols, dashes, underscores and dots. Name can also begin with a component name, eg: MyComponent::filename.
Parameters
- $fileName : string
-
Specifies a path to validate
Return values
bool —Returns true if the file name is valid. Otherwise returns false.
validatePath()
Validates a CMS object path.
public
static validatePath(string $filePath[, int $maxNesting = 2 ]) : bool
CMS object directory and file names can contain only alphanumeric symbols, dashes and dots. CMS objects support only a single level of subdirectories.
Parameters
- $filePath : string
-
Specifies a path to validate
- $maxNesting : int = 2
-
Specifies the maximum allowed nesting level
Return values
bool —Returns true if the file name is valid. Otherwise returns false.