class SimpleResourceURLGenerator implements ResourceURLGenerator (View source)

Generate URLs assuming that BASE_PATH is also the webroot Standard SilverStripe 3 operation

Properties

Methods

public
getNonceStyle()

No description

public
setNonceStyle($nonceStyle)

No description

public
string
urlForResource(string|ModuleResource $relativePath)

Return the URL for a resource, prefixing with Director::baseURL() and suffixing with a nonce

protected
array
resolveModuleResource(ModuleResource $resource)

Update relative path for a module resource

protected
array
resolveUnsecuredResource(string $relativePath) deprecated

Resolve resource in the absence of a public/ folder

protected
bool
inferPublicResourceRequired(string $relativePath)

Determine if the requested $relativePath requires a public-only resource.

protected
array
resolvePublicResource(string $relativePath)

Resolve a resource that may either exist in a public/ folder, or be exposed from the base path to public/_resources/

Details

getNonceStyle()

No description

setNonceStyle($nonceStyle)

No description

Parameters

$nonceStyle

string urlForResource(string|ModuleResource $relativePath)

Return the URL for a resource, prefixing with Director::baseURL() and suffixing with a nonce

Parameters

string|ModuleResource $relativePath

File or directory path relative to BASE_PATH

Return Value

string

URL, either domain-relative (starting with /) or absolute

Exceptions

InvalidArgumentException

protected array resolveModuleResource(ModuleResource $resource)

Update relative path for a module resource

Parameters

ModuleResource $resource

Return Value

array

List of [$exists, $absolutePath, $relativePath]

protected array resolveUnsecuredResource(string $relativePath) deprecated

deprecated 4.1.0 Will be removed without equivalent functionality when public/ folder becomes mandatory

Resolve resource in the absence of a public/ folder

Parameters

string $relativePath

Return Value

array

List of [$exists, $absolutePath, $relativePath]

protected bool inferPublicResourceRequired(string $relativePath)

Determine if the requested $relativePath requires a public-only resource.

An error will occur if this file isn't immediately available in the public/ assets folder.

Parameters

string $relativePath

Requested relative path which may have a public/ prefix. This prefix will be removed if exists. This path will also be normalised to match DIRECTORY_SEPARATOR

Return Value

bool

True if the resource must be a public resource

protected array resolvePublicResource(string $relativePath)

Resolve a resource that may either exist in a public/ folder, or be exposed from the base path to public/_resources/

Parameters

string $relativePath

Return Value

array

List of [$exists, $absolutePath, $relativePath]