FeaturePolicy extends EmptyFeaturePolicy
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
Table of Contents
- $autoplayDomains : string[]
- $cameraDomains : string[]
- $fullscreenDomains : string[]
- $geolocationDomains : string[]
- $microphoneDomains : string[]
- $paymentDomains : string[]
- 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
string[]
$autoplayDomains
= [''self'']
$cameraDomains
protected
string[]
$cameraDomains
= []
$fullscreenDomains
protected
string[]
$fullscreenDomains
= [''self'']
$geolocationDomains
protected
string[]
$geolocationDomains
= []
$microphoneDomains
protected
string[]
$microphoneDomains
= []
$paymentDomains
protected
string[]
$paymentDomains
= []
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
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
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
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
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
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
Return values
$this —buildPolicy()
Get the generated Feature-Policy as a string
public
buildPolicy() : string