HumHub Documentation (unofficial)

FeaturePolicy
in package
implements HeaderInterface

Feature Policy (based on Editor’s Draft, 28 November 2019)

Tags
link
https://w3c.github.io/webappsec-feature-policy/

Table of Contents

Interfaces

HeaderInterface
Interface for HTTP Header classes.

Properties

$directives  : array<string|int, mixed>
The directives defined for this policy
$validDirectiveNames  : array<string|int, string>
Valid directive names

Methods

fromString()  : static
Create Feature Policy header from a given header line
getDirectives()  : array<string|int, mixed>
Get the list of defined directives
getFieldName()  : string
Get the header name
getFieldValue()  : string
Get the header value
setDirective()  : $this
Sets the directive to consist of the source list
toString()  : string
Return the header as a string

Properties

$directives

The directives defined for this policy

protected array<string|int, mixed> $directives = []

$validDirectiveNames

Valid directive names

protected array<string|int, string> $validDirectiveNames = [ // Standardized Features 'accelerometer', 'ambient-light-sensor', 'autoplay', 'battery', 'camera', 'display-capture', 'document-domain', 'fullscreen', 'execution-while-not-rendered', 'execution-while-out-of-viewport', 'gyroscope', 'magnetometer', 'microphone', 'midi', 'payment', 'picture-in-picture', 'sync-xhr', 'usb', 'wake-lock', 'xr', // Proposed Features 'encrypted-media', 'geolocation', 'speaker', // Experimental Features 'document-write', 'font-display-late-swap', 'layout-animations', 'loading-frame-default-eager', 'loading-image-default-eager', 'legacy-image-formats', 'oversized-images', 'sync-script', 'unoptimized-lossy-images', 'unoptimized-lossless-images', 'unsized-media', 'vertical-scroll', 'serial', ]
Tags
see
https://github.com/w3c/webappsec-feature-policy/blob/master/features.md

Methods

fromString()

Create Feature Policy header from a given header line

public static fromString(string $headerLine) : static
Parameters
$headerLine : string

The header line to parse.

Tags
throws
InvalidArgumentException

If the name field in the given header line does not match.

Return values
static

getDirectives()

Get the list of defined directives

public getDirectives() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFieldName()

Get the header name

public getFieldName() : string
Return values
string

getFieldValue()

Get the header value

public getFieldValue() : string
Return values
string

setDirective()

Sets the directive to consist of the source list

public setDirective(string $name, array<string|int, string> $sources) : $this
Parameters
$name : string

The directive name.

$sources : array<string|int, string>

The source list.

Tags
throws
InvalidArgumentException

If the name is not a valid directive name.

Return values
$this

toString()

Return the header as a string

public toString() : string
Return values
string

        
On this page

Search results