class Paths

Class Paths

Constants

DEFAULT_URL

DEFAULT_PATH

Methods

__construct()

Class constructor.

register(string $name, callable $factory)

Register a new URL/file path mapping.

mixed
getVariable(string $name, string $attr)

No description

bool
hasVariable(string $name)

Does the variable exist.

mixed|string
getPath(string $value)

Determine the absolute path to a file, given that the file is most likely in a given particular variable.

mixed|string
getUrl(string $value, string $preferFormat = 'relative', bool|NULL $ssl = NULL)

Determine the URL to a file.

Details

at line 32
__construct()

Class constructor.

at line 66
Paths register(string $name, callable $factory)

Register a new URL/file path mapping.

Parameters

string $name The name of the variable.
callable $factory Function which returns an array with keys: - path: string. - url: string.

Return Value

Paths

at line 78
mixed getVariable(string $name, string $attr)

Parameters

string $name Ex: 'civicrm.root'.
string $attr Ex: 'url', 'path'.

Return Value

mixed

at line 95
bool hasVariable(string $name)

Does the variable exist.

Parameters

string $name

Return Value

bool

at line 109
mixed|string getPath(string $value)

Determine the absolute path to a file, given that the file is most likely in a given particular variable.

Parameters

string $value The file path. Use "." to reference to default file root. Values may begin with a variable, e.g. "[civicrm.files]/upload".

Return Value

mixed|string

at line 138
mixed|string getUrl(string $value, string $preferFormat = 'relative', bool|NULL $ssl = NULL)

Determine the URL to a file.

Parameters

string $value The file path. The path may begin with a variable, e.g. "[civicrm.files]/upload".
string $preferFormat The preferred format ('absolute', 'relative'). The result data may not meet the preference -- if the setting refers to an external domain, then the result will be absolute (regardless of preference).
bool|NULL $ssl NULL to autodetect. TRUE to force to SSL.

Return Value

mixed|string