]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/libraries/MOBIClass/Settings.php
4 * Description of Settings
10 * Values of the settings
16 * Construct a Settings object with the default settings. If necessary,
17 * those settings can be extended with additional settings
18 * @param array $additionalSettings Additional settings to add (should
19 * be added with a key/value pair format.
21 public function __construct($additionalSettings = array()) {
22 // Most values shouldn't be changed (the result will be an invalid file)
23 $this->values
= array(
26 "creationTime"=>time()+
94694400,
27 "modificationTime"=>time()+
94694400,
29 "modificationNumber"=>0,
34 "uniqueIDSeed"=>rand(),
35 "nextRecordListID"=>0,
36 "recordAttributes"=>0,
37 "compression"=>NO_COMPRESSION
,
38 "recordSize"=>RECORD_SIZE
,
39 "encryptionType"=>NO_ENCRYPTION
,
40 "mobiIdentifier"=>"MOBI",
41 "mobiHeaderLength"=>0xe8,
42 "mobiType"=>MOBIPOCKET_BOOK
,
50 "huffmanRecordOffset"=>0,
51 "huffmanRecordCount"=>0,
53 "drmOffset"=>0xFFFFFFFF,
58 "exthIdentifier"=>"EXTH",
59 // These can be changed without any risk
60 "title"=>"Unknown title",
61 "author"=>"Unknown author",
62 "subject"=>"Unknown subject"
65 foreach($additionalSettings as $key=>$value){
66 $this->values
[$key] = $value;
71 * Get a value from the settings
72 * @param string $key Key of the setting
73 * @return mixed The value of the setting
75 public function get($key){
76 return $this->values
[$key];
80 * Checks if a value is set
81 * @param string $key Key of the setting
82 * @return bool True if the value exists
84 public function exists($key){
85 return isset($this->values
[$key]);
88 public function __toString() {
89 $out = "Settings: {\n";
90 foreach($this->values
as $key=>$value){
91 $out .= "\t".$key.": ".$value."\n";