ar\loader

Contains methods to access loader specific functionality. Every loader type must implement the following methods but the implementation may differ or even do nothing.

methods

(bool) cache Sends client side cache headers. Returns false if headers could not be sent.
(void) configure Allows you to configure some settings for the ar_loader module.
(bool) content Sends content-type and size headers. Returns false if headers could not be sent.
(bool) disableCache Disables client side caching. Returns false if headers could not be sent.
(mixed) getvar Returns the named request parameter.
(bool) header Sends the specified header. Returns false if headers could not be sent.
(string) makeURL Returns a valid URL for the given path, using information from the current site.
(bool) redirect Sends a 301 redirect header. Returns false if headers could not be sent.

cache

(bool) ar('loader')->cache( $expires = 0, $modified = false )

(int) $expires The time in seconds untill the client side cache should expire.
(int) $modified The unix timestamp for when the content was last modified, or false to skip the Last-Modified header.

Sends the necessary headers to instruct the client to cache the result of the current request for the specified time. 

The HTTP loader uses ar('http/headers')->cache()

configure

(void) ar('loader')->configure( $option, $value )

(string) $option The name of the option to configure.
(mixed) $value The value for the option.

The ar_loader module supports the following options:

(bool) makeLocalURL Default: false. When true, any URL generated by makeURL will use the domain name of the current request.

content

(bool) ar('loader')->content( $contentType, $size = 0 )

(string) $contentType The mimetype for the content sent in the current request, e.g. 'text/html' or 'image/jpeg'.
(int) $size The size of the content sent in the current request, or 0 to skip the Content-Length header.

Sends the Content-Type and optionally Content-Length headers. Returns true if the headers are sent succesfully, false otherwise.

The HTTP loader uses ar('http/headers')->content().

disableCache

(bool) ar('loader')->disableCache()

Sends the necessary headers to instruct the client to not cache the result of the current request.

The HTTP Loader uses ar_http_headers::disableCache().

getvar

(mixed) ar('loader')->getvar( $name = null, $method = null )

(string) $name The name of the request parameter.
(string) $method The request method to check. May be ignored by some loaders.

Searches the request parameters for the named parameter and returns it.

For the HTTP loader the ar('http')->getvar() method is used.

header

(bool) ar('loader')->header( $header )

(string) $header The header to send.

Sends the given header. For the HTTP loader the ar('http/headers')->header() method is used.

makeURL

(string) ar('loader')->makeURL( $path = '', $nls = false, $session = true, $https = null )

(string) $path The path to generate the URL for.
(bool) $nls Whether or not to include language (nls) information.
(bool) $session Whether or not to include session informatin.
(bool) $https Whether or not to generate a HTTPS url. If not set or null, it will generate a URL with the same protocol as the current request.

Returns a URL based on the given path and its nearest site. If there is no parent site for the given path or the makeLocalURL setting is set to true, it will generate an valid Ariadne URL for the domain name used in the current request.

redirect

(bool)  ar('loader')->redirect( $url )

(string) $url The URL to redirect to.

Sends a redirect header. For the HTTP loader the ar('http/headers')->redirect() method is used.