Nextcloud PHP API (master)

FeaturePolicy extends EmptyFeaturePolicy
in package

Class FeaturePolicy is a simple helper which allows applications to modify the Feature-Policy sent by Nextcloud. Per default only autoplay is allowed from the same domain and full screen as well from the same domain.

Even if a value gets modified above defaults will still get appended. Please notice that Nextcloud ships already with sensible defaults and those policies should require no modification at all for most use-cases.

Tags
since
17.0.0

Table of Contents

Properties

$autoplayDomains  : array<string|int, string>
$cameraDomains  : array<string|int, string>
$fullscreenDomains  : array<string|int, string>
$geolocationDomains  : array<string|int, string>
$microphoneDomains  : array<string|int, string>
$paymentDomains  : array<string|int, string>

Methods

addAllowedAutoplayDomain()  : $this
Allows to use autoplay from a specific domain. Use * to allow from all domains.
addAllowedCameraDomain()  : $this
Allows to use the camera on a specific domain. Use * to allow from all domains
addAllowedFullScreenDomain()  : $this
Allows the full screen functionality to be used on a specific domain. Use * to allow from all domains
addAllowedGeoLocationDomain()  : $this
Allows to use the geolocation on a specific domain. Use * to allow from all domains
addAllowedMicrophoneDomain()  : $this
Allows to use the microphone on a specific domain. Use * to allow from all domains
addAllowedPaymentDomain()  : $this
Allows to use the payment API on a specific domain. Use * to allow from all domains
buildPolicy()  : string
Get the generated Feature-Policy as a string

Properties

$autoplayDomains

protected array<string|int, string> $autoplayDomains = ['\'self\'']

of allowed domains to autoplay media

$cameraDomains

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

of allowed domains that can access the camera

$fullscreenDomains

protected array<string|int, string> $fullscreenDomains = ['\'self\'']

of allowed domains that can use fullscreen

$geolocationDomains

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

of allowed domains that can use the geolocation of the device

$microphoneDomains

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

of allowed domains that can use the microphone

$paymentDomains

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

of allowed domains that can use the payment API

Methods

addAllowedAutoplayDomain()

Allows to use autoplay from a specific domain. Use * to allow from all domains.

public addAllowedAutoplayDomain(string $domain) : $this
Parameters
$domain : string

Domain to whitelist. Any passed value needs to be properly sanitized.

Tags
since
17.0.0
Return values
$this

addAllowedCameraDomain()

Allows to use the camera on a specific domain. Use * to allow from all domains

public addAllowedCameraDomain(string $domain) : $this
Parameters
$domain : string

Domain to whitelist. Any passed value needs to be properly sanitized.

Tags
since
17.0.0
Return values
$this

addAllowedFullScreenDomain()

Allows the full screen functionality to be used on a specific domain. Use * to allow from all domains

public addAllowedFullScreenDomain(string $domain) : $this
Parameters
$domain : string

Domain to whitelist. Any passed value needs to be properly sanitized.

Tags
since
17.0.0
Return values
$this

addAllowedGeoLocationDomain()

Allows to use the geolocation on a specific domain. Use * to allow from all domains

public addAllowedGeoLocationDomain(string $domain) : $this
Parameters
$domain : string

Domain to whitelist. Any passed value needs to be properly sanitized.

Tags
since
17.0.0
Return values
$this

addAllowedMicrophoneDomain()

Allows to use the microphone on a specific domain. Use * to allow from all domains

public addAllowedMicrophoneDomain(string $domain) : $this
Parameters
$domain : string

Domain to whitelist. Any passed value needs to be properly sanitized.

Tags
since
17.0.0
Return values
$this

addAllowedPaymentDomain()

Allows to use the payment API on a specific domain. Use * to allow from all domains

public addAllowedPaymentDomain(string $domain) : $this
Parameters
$domain : string

Domain to whitelist. Any passed value needs to be properly sanitized.

Tags
since
17.0.0
Return values
$this

buildPolicy()

Get the generated Feature-Policy as a string

public buildPolicy() : string
Tags
since
17.0.0
Return values
string

        
On this page

Search results