Configuration
in package
Configuration
parses configuration file, ensures default values present
Table of Contents
Properties
- $_configuration : array<string|int, mixed>
- parsed configuration
- $_defaults : array<string|int, mixed>
- default configuration
Methods
- __construct() : mixed
- parse configuration file and ensure default configuration values are present
- get() : array<string|int, mixed>
- get configuration as array
- getDefaults() : array<string|int, mixed>
- get default configuration as array
- getKey() : mixed
- get a key from the configuration, typically the main section or all keys
- getSection() : mixed
- get a section from the configuration, must exist
Properties
$_configuration
parsed configuration
protected
array<string|int, mixed>
$_configuration
$_defaults
default configuration
private
static array<string|int, mixed>
$_defaults
= [
'main' => ['name' => 'PrivateBin', 'basepath' => '', 'discussion' => true, 'opendiscussion' => false, 'discussiondatedisplay' => true, 'password' => true, 'fileupload' => false, 'burnafterreadingselected' => false, 'defaultformatter' => 'plaintext', 'syntaxhighlightingtheme' => '', 'sizelimit' => 10485760, 'templateselection' => false, 'template' => 'bootstrap5', 'availabletemplates' => ['bootstrap5', 'bootstrap', 'bootstrap-page', 'bootstrap-dark', 'bootstrap-dark-page', 'bootstrap-compact', 'bootstrap-compact-page'], 'info' => 'More information on the <a href=\'https://privatebin.info/\'>project page</a>.', 'notice' => '', 'languageselection' => false, 'languagedefault' => '', 'urlshortener' => '', 'shortenbydefault' => false, 'qrcode' => true, 'email' => true, 'icon' => 'jdenticon', 'cspheader' => 'default-src \'none\'; base-uri \'self\'; form-action \'none\'; manifest-src \'self\'; connect-src * blob:; script-src \'self\' \'wasm-unsafe-eval\'; style-src \'self\'; font-src \'self\'; frame-ancestors \'none\'; frame-src blob:; img-src \'self\' data: blob:; media-src blob:; object-src blob:; sandbox allow-same-origin allow-scripts allow-forms allow-modals allow-downloads', 'httpwarning' => true, 'compression' => 'zlib'],
'expire' => ['default' => '1week'],
'expire_options' => ['5min' => 300, '10min' => 600, '1hour' => 3600, '1day' => 86400, '1week' => 604800, '1month' => 2592000, '1year' => 31536000, 'never' => 0],
'formatter_options' => ['plaintext' => 'Plain Text', 'syntaxhighlighting' => 'Source Code', 'markdown' => 'Markdown'],
'traffic' => ['limit' => 10, 'header' => '', 'exempted' => '', 'creators' => ''],
'purge' => ['limit' => 300, 'batchsize' => 10],
'model' => ['class' => 'Filesystem'],
'model_options' => ['dir' => 'data'],
'yourls' => ['signature' => '', 'apiurl' => ''],
'shlink' => ['apikey' => '', 'apiurl' => ''],
// update this array when adding/changing/removing js files
'sri' => ['js/base-x-5.0.1.js' => 'sha512-FmhlnjIxQyxkkxQmzf0l6IRGsGbgyCdgqPxypFsEtHMF1naRqaLLo6mcyN5rEaT16nKx1PeJ4g7+07D6gnk/Tg==', 'js/bootstrap-3.4.1.js' => 'sha512-oBTprMeNEKCnqfuqKd6sbvFzmFQtlXS3e0C/RGFV0hD6QzhHV+ODfaQbAlmY6/q0ubbwlAM/nCJjkrgA3waLzg==', 'js/bootstrap-5.3.8.js' => 'sha512-BkZvJ5rZ3zbDCod5seWHpRGg+PRd6ZgE8Nua/OMtcxqm8Wtg0PqwhUUXK5bqvl3oclMt5O+3zjRVX0L+L2j7fA==', 'js/dark-mode-switch.js' => 'sha512-BhY7dNU14aDN5L+muoUmA66x0CkYUWkQT0nxhKBLP/o2d7jE025+dvWJa4OiYffBGEFgmhrD/Sp+QMkxGMTz2g==', 'js/jquery-3.7.1.js' => 'sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==', 'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==', 'js/legacy.js' => 'sha512-RQEo1hxpNc37i+jz/D9/JiAZhG8GFx3+SNxjYnI7jUgirDIqrCSj6QPAAZeaidditcWzsJ3jxfEj5lVm7ZwTRQ==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', 'js/privatebin.js' => 'sha512-Glin+fKxs+Ur9ZSwv9AlU0c+CAId7+WZLXTDjncbTLAuTC8VMMwQH/M+Yx4+2FeLK67GCtKJr2MZ8VQdIm39uA==', 'js/purify-3.4.12.js' => 'sha512-Akf6HnAJZm0sWWWI4gp2GYff0NDnHUB02XJE5S7Hdq/Z5xtMjkuFacsDA8ZtViv1gi+onBxMhEMIaGyQeGxBng==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.2.js' => 'sha512-RAhJgxg9siMIA8ky4c10Rc2zUgnK80olHB8Tt1IOYWY4Eh1WmrviQkDn+sgBlb38ZHq3tzufGC41kP360gmosQ==', 'js/zlib.js' => 'sha512-QOaEwssHqHRRcWJ2Un3Kl2Zhyprzl7T8zmsKN2FppFxW3VR+8UChYOx2iuL0HbXK42fuBWJm5PNQJxufulrt/w=='],
]
Methods
__construct()
parse configuration file and ensure default configuration values are present
public
__construct() : mixed
Tags
get()
get configuration as array
public
get() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaults()
get default configuration as array
public
static getDefaults() : array<string|int, mixed>
Return values
array<string|int, mixed>getKey()
get a key from the configuration, typically the main section or all keys
public
getKey(string $key[, string $section = 'main' ]) : mixed
Parameters
- $key : string
- $section : string = 'main'
-
defaults to main
Tags
getSection()
get a section from the configuration, must exist
public
getSection(string $section) : mixed
Parameters
- $section : string