class FileUtils (View source)

A collection of file utilities.

Methods

static array
allowedFileTypes()

Return an array with the allowed file types.

static string
caption(string $file)

Read a file's caption file and render contained markdown syntax.

static array
fileDeclaration(string $str, Page $Page, bool $stripBaseDir = false)

Parse a file declaration string where multiple glob patterns or URLs can be separated by a comma and return an array with the resolved/downloaded file paths.

static bool
fileIsImage(string $file)

Parse a filename to check whether a file is an image or not.

Details

static array allowedFileTypes()

Return an array with the allowed file types.

Return Value

array An array of file types

static string caption(string $file)

Read a file's caption file and render contained markdown syntax.

The caption filename is build out of the actual filename with the appended ".caption" extension, like "image.jpg.caption".

Parameters

string $file

Return Value

string The caption string

static array fileDeclaration(string $str, Page $Page, bool $stripBaseDir = false)

Parse a file declaration string where multiple glob patterns or URLs can be separated by a comma and return an array with the resolved/downloaded file paths.

If $stripBaseDir is true, the base directory will be stripped from the path and each path gets resolved to be relative to the Automad installation directory.

Parameters

string $str
Page $Page
bool $stripBaseDir

Return Value

array An array with resolved file paths

static bool fileIsImage(string $file)

Parse a filename to check whether a file is an image or not.

Parameters

string $file

Return Value

bool True if $file is an image file