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
private
array<string|int, mixed>
$_configuration
$_defaults
default configuration
private
static array<string|int, mixed>
$_defaults
= array(
'main' => array('name' => 'PrivateBin', 'basepath' => '', 'discussion' => true, 'opendiscussion' => false, 'discussiondatedisplay' => true, 'password' => true, 'fileupload' => false, 'burnafterreadingselected' => false, 'defaultformatter' => 'plaintext', 'syntaxhighlightingtheme' => '', 'sizelimit' => 10485760, 'template' => 'bootstrap', 'info' => 'More information on the <a href=\'https://privatebin.info/\'>project page</a>.', 'notice' => '', 'languageselection' => false, 'languagedefault' => '', 'urlshortener' => '', 'qrcode' => true, 'email' => true, 'icon' => 'identicon', 'cspheader' => 'default-src \'none\'; base-uri \'self\'; form-action \'none\'; manifest-src \'self\'; connect-src * blob:; script-src \'self\' \'unsafe-eval\'; style-src \'self\'; font-src \'self\'; frame-ancestors \'none\'; img-src \'self\' data: blob:; media-src blob:; object-src blob:; sandbox allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-downloads', 'zerobincompatibility' => false, 'httpwarning' => true, 'compression' => 'zlib'),
'expire' => array('default' => '1week'),
'expire_options' => array('5min' => 300, '10min' => 600, '1hour' => 3600, '1day' => 86400, '1week' => 604800, '1month' => 2592000, '1year' => 31536000, 'never' => 0),
'formatter_options' => array('plaintext' => 'Plain Text', 'syntaxhighlighting' => 'Source Code', 'markdown' => 'Markdown'),
'traffic' => array('limit' => 10, 'header' => '', 'exempted' => '', 'creators' => ''),
'purge' => array('limit' => 300, 'batchsize' => 10),
'model' => array('class' => 'Filesystem'),
'model_options' => array('dir' => 'data'),
'yourls' => array('signature' => '', 'apiurl' => ''),
// update this array when adding/changing/removing js files
'sri' => array('js/base-x-4.0.0.js' => 'sha512-nNPg5IGCwwrveZ8cA/yMGr5HiRS5Ps2H+s0J/mKTPjCPWUgFGGw7M5nqdnPD3VsRwCVysUh3Y8OWjeSKGkEQJQ==', 'js/base64-1.7.js' => 'sha512-JdwsSP3GyHR+jaCkns9CL9NTt4JUJqm/BsODGmYhBcj5EAPKcHYh+OiMfyHbcDLECe17TL0hjXADFkusAqiYgA==', 'js/bootstrap-3.4.1.js' => 'sha512-oBTprMeNEKCnqfuqKd6sbvFzmFQtlXS3e0C/RGFV0hD6QzhHV+ODfaQbAlmY6/q0ubbwlAM/nCJjkrgA3waLzg==', 'js/bootstrap-5.3.3.js' => 'sha512-in2rcOpLTdJ7/pw5qjF4LWHFRtgoBDxXCy49H4YGOcVdGiPaQucGIbOqxt1JvmpvOpq3J/C7VTa0FlioakB2gQ==', 'js/dark-mode-switch.js' => 'sha512-CCbdHdeWDbDO7aqFFmhgnvFESzaILHbUYmbhNjTpcjyO/XYdouQ9Pw8W9rpV8oJT1TsK5FbwSHU1oazmnb7BWA==', 'js/jquery-3.7.1.js' => 'sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==', 'js/kjua-0.9.0.js' => 'sha512-CVn7af+vTMBd9RjoS4QM5fpLFEOtBCoB0zPtaqIDC7sF4F8qgUSRFQQpIyEDGsr6yrjbuOLzdf20tkHHmpaqwQ==', 'js/legacy.js' => 'sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', 'js/privatebin.js' => 'sha512-JUj/Sbl/bMHlIoIUT1U9e89JU33fDBxCxLSGxwwaeydBFXOBHyfdF7hwSIjgbPxb4d9CO7CSe4meouTIRMy8Vg==', 'js/purify-3.1.7.js' => 'sha512-LegvqULiMtOfboJZw9MpETN/b+xnLRXZI90gG7oIFHW+yAeHmKvRtEUbiMFx2WvUqQoL9XB3gwU+hWXUT0X+8A==', 'js/rawinflate-0.3.js' => 'sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.1.js' => 'sha512-Z90oppVx/mn0DG2k9airjFVQuliELlXLeT3SRiO6MLiUSbhGlAq+UFwmYbG4i9mwW87dkG8fgJPapGwnUq7Osg=='),
)
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