]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/libraries/send2kindle/MOBIClass/Settings.php
add pdf and mobi libraries
[github/wallabag/wallabag.git] / inc / 3rdparty / libraries / send2kindle / MOBIClass / Settings.php
CommitLineData
4188f38a 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 $this->values = array(
23 "attributes"=>0,
24 "version"=>0,
25 "creationTime"=>time()+94694400,
26 "modificationTime"=>time()+94694400,
27 "backupTime"=>0,
28 "modificationNumber"=>0,
29 "appInfoID"=>0,
30 "sortInfoID"=>0,
31 "prcType"=>"BOOK",
32 "creator"=>"MOBI",
33 "uniqueIDSeed"=>rand(),
34 "nextRecordListID"=>0,
35 "recordAttributes"=>0,
36 "compression"=>NO_COMPRESSION,
37 "recordSize"=>RECORD_SIZE,
38 "encryptionType"=>NO_ENCRYPTION,
39 "mobiIdentifier"=>"MOBI",
40 "mobiHeaderLength"=>0xe8,
41 "mobiType"=>MOBIPOCKET_BOOK,
42 "textEncoding"=>UTF8,
43 "uniqueID"=>rand(),
44 "fileVersion"=>6,
45 "locale"=>0x09,
46 "inputLanguage"=>0,
47 "outputLanguage"=>0,
48 "minimumVersion"=>6,
49 "huffmanRecordOffset"=>0,
50 "huffmanRecordCount"=>0,
51 "exthFlags"=>0x50,
52 "drmOffset"=>0xFFFFFFFF,
53 "drmCount"=>0xFFFFFFFF,
54 "drmSize"=>0,
55 "drmFlags"=>0,
56 "extraDataFlags"=>0,
57 "exthIdentifier"=>"EXTH",
58 "title"=>"Unknown title",
59 "author"=>"Unknown author",
60 "subject"=>"Unknown subject"
61 );
62
63 foreach($additionalSettings as $key=>$value){
64 $this->values[$key] = $value;
65 }
66 }
67
68 /**
69 * Get a value from the settings
70 * @param string $key Key of the setting
71 * @return mixed The value of the setting
72 */
73 public function get($key){
74 return $this->values[$key];
75 }
76
77 /**
78 * Checks if a value is set
79 * @param string $key Key of the setting
80 * @return bool True if the value exists
81 */
82 public function exists($key){
83 return isset($this->values[$key]);
84 }
85
86 public function __toString() {
87 $out = "Settings: {\n";
88 foreach($this->values as $key=>$value){
89 $out .= "\t".$key.": ".$value."\n";
90 }
91 $out .= "}";
92 return $out;
93 }
94}
95?>