Documentation

Multi extends SiteAction
in package

Provide support for a nested static page structure

Tags
psalm-suppress

UnusedClass

Table of Contents

$maxage  : int
checketag()  : bool
Check an etag to see if we need to send the page again or not.
checkmodtime()  : bool
Check a timestamp to see if we need to send the page again or not.
checkRest()  : array<string|int, string>
Validate the number of fields in the rest of the URL
exists()  : bool
Returns true of the request would generate a page.
handle()  : string
Handles static pages that are nested in depth /multi/level/page
ifmodcheck()  : void
Look to see if there are any IF... headers, and deal with them. Exit if a 304 or 412 is generated.
lastmodified()  : int
Get a last modified time for the page
makeetag()  : string
Make an etag for an item
makemaxage()  : int
Make a max age value for an item
makemod()  : string
Format a time suitable for Last-Modified header
set304Cache()  : void
Set any cache headers that are wanted on a 304 response
setCache()  : void
Set any cache headers that are wanted for a normal page delivery
setCSP()  : void
Set up any CSP headers for a page
etagmatched()  : void
We have a matched etag - check request method and send the appropriate header.

Properties

Methods

checketag()

Check an etag to see if we need to send the page again or not.

public checketag(Context $context, string $tag) : bool
Parameters
$context : Context

The context object for the site

$tag : string

The etag value to check

Return values
bool

checkmodtime()

Check a timestamp to see if we need to send the page again or not.

public checkmodtime(Context $context, string $time) : bool

This always returns FALSE, indicating that we need to send the page again. The assumption is that pages that implement etags will override this function appropriately to do actual value checking.

Parameters
$context : Context

The context object for the site

$time : string

The time value to check

Tags
psalm-suppress

PossiblyUnusedParam

phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
bool

checkRest()

Validate the number of fields in the rest of the URL

public checkRest(array<string|int, string> $rest, int $start, int $num[, array<string|int, string> $format = [] ]) : array<string|int, string>
Parameters
$rest : array<string|int, string>
$start : int

The element to start at

$num : int

The number of params required

$format : array<string|int, string> = []

Currently not used

Tags
todo

This function could do a lot moreabout checking things....

throws
ParameterCount
phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
array<string|int, string>

exists()

Returns true of the request would generate a page.

public exists(Context $context) : bool

This needs to be overridden if it is to be used. Currently returns TRUE, thus assuming that pages always exist....

Parameters
$context : Context

The context object for the site

Tags
psalm-suppress

PossiblyUnusedParam

phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
bool

handle()

Handles static pages that are nested in depth /multi/level/page

public handle(Context $context) : string
Parameters
$context : Context

The context object for the site

Return values
string

A template name

ifmodcheck()

Look to see if there are any IF... headers, and deal with them. Exit if a 304 or 412 is generated.

public ifmodcheck(Context $context) : void
Parameters
$context : Context
Tags
link

This should be used in page classes where there is some way of determining page freshness (ETags, last modified etc.), otherwise it need not be called.

The actual ways of determining page freshness will be page specific and you may need to override some of the other methods that this method calls in order to make things work!

The Data class provides (or will in the future...) an example of how to use this code when dealing with file data.

Return values
void

lastmodified()

Get a last modified time for the page

public lastmodified(Context $context) : int

By default this returns the current time. For pages that need to use this in anger, then this function may need to be overridden.

Parameters
$context : Context

The context object for the site

Tags
psalm-suppress

PossiblyUnusedParam

phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
int

makeetag()

Make an etag for an item

public makeetag(Context $context) : string

This needs to be overridden by pages that can generate etags

Parameters
$context : Context

The context object for the site

Tags
psalm-suppress

PossiblyUnusedParam

phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
string

makemaxage()

Make a max age value for an item

public makemaxage(Context $context) : int

This needs to be overridden by pages that want to use this

Parameters
$context : Context

The context object for the site

Tags
psalm-suppress

PossiblyUnusedParam

phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
int

makemod()

Format a time suitable for Last-Modified header

public makemod(int $time) : string
Parameters
$time : int

The last modified time

Return values
string

set304Cache()

Set any cache headers that are wanted on a 304 response

public set304Cache(Context $context) : void
Parameters
$context : Context

The context object for the site

Tags
phpcsSuppress

NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff

Return values
void

setCache()

Set any cache headers that are wanted for a normal page delivery

public setCache(Context $context) : void
Parameters
$context : Context

The context object

Tags
psalm-suppress

PossiblyUnusedMethod

phpcsSuppress

NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff

Return values
void

setCSP()

Set up any CSP headers for a page

public setCSP() : void

There will be a basic set of default CSP permissions for the site to function, but individual pages may wish to extend or restrict these.

Tags
phpcsSuppress

NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff

Return values
void

Search results