Table of Contents

DownloadSettings

Layer: Utility · Source: lib/utility/download-settings.php:16 (lines 16–302)


class DownloadSettings

Manages download configuration settings

Docblock Metadata

Tag Value
@category Utility Class
@author M.Noermoehammad
@license MIT
@version 1.0
@since Since Release 1.0

Inheritance

No parent, interface or trait. This is a root type.

Constants (8)

Visibility Name Value Line
- DEFAULT_MIME_TYPES [ 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument… 18
- DEFAULT_EXPIRY_HOURS 8; 46
- KEY_ALLOWED_MIME_TYPES 'download_allowed_mime_types'; 48
- KEY_EXPIRY_HOURS 'download_expiry_hours'; 49
- KEY_HOTLINK_PROTECTION 'download_hotlink_protection'; 50
- KEY_ALLOWED_DOMAINS 'download_allowed_domains'; 51
- KEY_SUPPORT_URL 'download_support_url'; 52
- KEY_SUPPORT_LABEL 'download_support_label'; 53

Properties (0)

None declared.

Methods (16)

Visibility Method Summary Line
public static getAllowedMimeTypes() Get allowed MIME types from settings 60
public static setAllowedMimeTypes() Set allowed MIME types 78
public static getDownloadExpiry() Get download expiry hours 88
public static setDownloadExpiry() Set download expiry hours 100
public static isHotlinkProtectionEnabled() Check if hotlink protection is enabled 110
public static setHotlinkProtection() Set hotlink protection 122
public static getAllowedDomains() Get allowed domains for hotlink protection 132
public static setAllowedDomains() Set allowed domains 150
public static getSupportUrl() Get support URL 160
public static setSupportUrl() Set support URL 171
public static getSupportLabel() Get support label 181
public static setSupportLabel() Set support label 192
public static getAllSettings() Get all settings as array 202
public static saveSettings() Save all settings at once 220
private static getSetting() Get a single setting from database 257
private static saveSetting() Save a single setting to database 281

getAllowedMimeTypes()

public static function getAllowedMimeTypes()

lines 60–70 (11)

Get allowed MIME types from settings

Takes no parameters.

Returns: (none declared) — array

setAllowedMimeTypes()

public static function setAllowedMimeTypes($types)

lines 78–81 (4)

Set allowed MIME types

Parameter Type Default Description
$types (untyped) required none

Returns: (none declared) — bool

getDownloadExpiry()

public static function getDownloadExpiry()

lines 88–92 (5)

Get download expiry hours

Takes no parameters.

Returns: (none declared) — int

setDownloadExpiry()

public static function setDownloadExpiry($hours)

lines 100–103 (4)

Set download expiry hours

Parameter Type Default Description
$hours (untyped) required none

Returns: (none declared) — bool

isHotlinkProtectionEnabled()

public static function isHotlinkProtectionEnabled()

lines 110–114 (5)

Check if hotlink protection is enabled

Takes no parameters.

Returns: (none declared) — bool

setHotlinkProtection()

public static function setHotlinkProtection($enabled)

lines 122–125 (4)

Set hotlink protection

Parameter Type Default Description
$enabled (untyped) required none

Returns: (none declared) — bool

getAllowedDomains()

public static function getAllowedDomains()

lines 132–142 (11)

Get allowed domains for hotlink protection

Takes no parameters.

Returns: (none declared) — array

setAllowedDomains()

public static function setAllowedDomains($domains)

lines 150–153 (4)

Set allowed domains

Parameter Type Default Description
$domains (untyped) required none

Returns: (none declared) — bool

getSupportUrl()

public static function getSupportUrl()

lines 160–163 (4)

Get support URL

Takes no parameters.

Returns: (none declared) — string

setSupportUrl()

public static function setSupportUrl($url)

lines 171–174 (4)

Set support URL

Parameter Type Default Description
$url (untyped) required none

Returns: (none declared) — bool

getSupportLabel()

public static function getSupportLabel()

lines 181–184 (4)

Get support label

Takes no parameters.

Returns: (none declared) — string

setSupportLabel()

public static function setSupportLabel($label)

lines 192–195 (4)

Set support label

Parameter Type Default Description
$label (untyped) required none

Returns: (none declared) — bool

getAllSettings()

public static function getAllSettings()

lines 202–212 (11)

Get all settings as array

Takes no parameters.

Returns: (none declared) — array

saveSettings()

public static function saveSettings($settings)

lines 220–249 (30)

Save all settings at once

Parameter Type Default Description
$settings (untyped) required none

Returns: (none declared) — bool

getSetting()

private static function getSetting($key)

lines 257–272 (16)

Get a single setting from database

Parameter Type Default Description
$key (untyped) required none

Returns: (none declared) — string|null

saveSetting()

private static function saveSetting($key, $value)

lines 281–301 (21)

Save a single setting to database

Parameter Type Default Description
$key (untyped) required none
$value (untyped) required none

Returns: (none declared) — bool


This page is generated from source by 'tools/gendoc'. Edits will be overwritten.