aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/MOBIClass/Settings.php
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2014-12-22 14:33:01 +0100
committerThomas Citharel <tcit@tcit.fr>2014-12-22 14:33:01 +0100
commitf3917b1ee4bba812e82da57dd181f50d62926db4 (patch)
treecb4b04931e97e4a69500bf9d7aa5c21985cab59e /inc/3rdparty/libraries/MOBIClass/Settings.php
parent311baf86befde0557faea614ca4d13bb2bd2cc66 (diff)
parent9254b6cf460edec3a59e9ccc19873481a1d19c90 (diff)
downloadwallabag-f3917b1ee4bba812e82da57dd181f50d62926db4.tar.gz
wallabag-f3917b1ee4bba812e82da57dd181f50d62926db4.tar.zst
wallabag-f3917b1ee4bba812e82da57dd181f50d62926db4.zip
Merge branch 'dev' into randomarticle
Diffstat (limited to 'inc/3rdparty/libraries/MOBIClass/Settings.php')
-rw-r--r--inc/3rdparty/libraries/MOBIClass/Settings.php97
1 files changed, 97 insertions, 0 deletions
diff --git a/inc/3rdparty/libraries/MOBIClass/Settings.php b/inc/3rdparty/libraries/MOBIClass/Settings.php
new file mode 100644
index 00000000..ddcf2054
--- /dev/null
+++ b/inc/3rdparty/libraries/MOBIClass/Settings.php
@@ -0,0 +1,97 @@
1<?php
2
3/**
4 * Description of Settings
5 *
6 * @author Sander
7 */
8class Settings {
9 /**
10 * Values of the settings
11 * @var array
12 */
13 public $values;
14
15 /**
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.
20 */
21 public function __construct($additionalSettings = array()) {
22 // Most values shouldn't be changed (the result will be an invalid file)
23 $this->values = array(
24 "attributes"=>0,
25 "version"=>0,
26 "creationTime"=>time()+94694400,
27 "modificationTime"=>time()+94694400,
28 "backupTime"=>0,
29 "modificationNumber"=>0,
30 "appInfoID"=>0,
31 "sortInfoID"=>0,
32 "prcType"=>"BOOK",
33 "creator"=>"MOBI",
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,
43 "textEncoding"=>UTF8,
44 "uniqueID"=>rand(),
45 "fileVersion"=>6,
46 "locale"=>0x09,
47 "inputLanguage"=>0,
48 "outputLanguage"=>0,
49 "minimumVersion"=>6,
50 "huffmanRecordOffset"=>0,
51 "huffmanRecordCount"=>0,
52 "exthFlags"=>0x40,
53 "drmOffset"=>0xFFFFFFFF,
54 "drmCount"=>0,
55 "drmSize"=>0,
56 "drmFlags"=>0,
57 "extraDataFlags"=>0,
58 "exthIdentifier"=>"EXTH",
59 // These can be changed without any risk
60 "title"=>"Unknown title",
61 "author"=>"Unknown author",
62 "subject"=>"Unknown subject"
63 );
64
65 foreach($additionalSettings as $key=>$value){
66 $this->values[$key] = $value;
67 }
68 }
69
70 /**
71 * Get a value from the settings
72 * @param string $key Key of the setting
73 * @return mixed The value of the setting
74 */
75 public function get($key){
76 return $this->values[$key];
77 }
78
79 /**
80 * Checks if a value is set
81 * @param string $key Key of the setting
82 * @return bool True if the value exists
83 */
84 public function exists($key){
85 return isset($this->values[$key]);
86 }
87
88 public function __toString() {
89 $out = "Settings: {\n";
90 foreach($this->values as $key=>$value){
91 $out .= "\t".$key.": ".$value."\n";
92 }
93 $out .= "}";
94 return $out;
95 }
96}
97?>