Cms\Helpers\File

Overview

File defines some file-system helpers for the CMS system


Public Methods

public static validateExtension()

public static validateExtension(
    string $fileName,
    array $allowedExtensions,
    boolean $allowEmpty = true
): boolean 

Validates whether a file has an allowed extension.

public static validateInTheme()

public static validateInTheme($theme, $filePath): bool 

validateInTheme checks object lives within the theme directory

public static validateName()

public static validateName(string $fileName): boolean 

Validates a CMS object file or directory name. CMS object file names can contain only alphanumeric symbols, dashes, underscores and dots. Name can also begin with a component name, eg: MyComponent::filename.

public static validatePath()

public static validatePath(
    string $filePath,
    integer $maxNesting = 2
): bool 

validatePath of a CMS object. CMS object directory and file names can contain only alphanumeric symbols, dashes and dots. CMS objects support only a single level of subdirectories.