From fb9df0c269f36703909b8b259abbdbed29881ecd Mon Sep 17 00:00:00 2001 From: tcit Date: Thu, 24 Jul 2014 21:56:04 +0200 Subject: use directly MOBIClass --- inc/3rdparty/libraries/MOBIClass/Settings.php | 97 +++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 inc/3rdparty/libraries/MOBIClass/Settings.php (limited to 'inc/3rdparty/libraries/MOBIClass/Settings.php') 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 @@ +values = array( + "attributes"=>0, + "version"=>0, + "creationTime"=>time()+94694400, + "modificationTime"=>time()+94694400, + "backupTime"=>0, + "modificationNumber"=>0, + "appInfoID"=>0, + "sortInfoID"=>0, + "prcType"=>"BOOK", + "creator"=>"MOBI", + "uniqueIDSeed"=>rand(), + "nextRecordListID"=>0, + "recordAttributes"=>0, + "compression"=>NO_COMPRESSION, + "recordSize"=>RECORD_SIZE, + "encryptionType"=>NO_ENCRYPTION, + "mobiIdentifier"=>"MOBI", + "mobiHeaderLength"=>0xe8, + "mobiType"=>MOBIPOCKET_BOOK, + "textEncoding"=>UTF8, + "uniqueID"=>rand(), + "fileVersion"=>6, + "locale"=>0x09, + "inputLanguage"=>0, + "outputLanguage"=>0, + "minimumVersion"=>6, + "huffmanRecordOffset"=>0, + "huffmanRecordCount"=>0, + "exthFlags"=>0x40, + "drmOffset"=>0xFFFFFFFF, + "drmCount"=>0, + "drmSize"=>0, + "drmFlags"=>0, + "extraDataFlags"=>0, + "exthIdentifier"=>"EXTH", + // These can be changed without any risk + "title"=>"Unknown title", + "author"=>"Unknown author", + "subject"=>"Unknown subject" + ); + + foreach($additionalSettings as $key=>$value){ + $this->values[$key] = $value; + } + } + + /** + * Get a value from the settings + * @param string $key Key of the setting + * @return mixed The value of the setting + */ + public function get($key){ + return $this->values[$key]; + } + + /** + * Checks if a value is set + * @param string $key Key of the setting + * @return bool True if the value exists + */ + public function exists($key){ + return isset($this->values[$key]); + } + + public function __toString() { + $out = "Settings: {\n"; + foreach($this->values as $key=>$value){ + $out .= "\t".$key.": ".$value."\n"; + } + $out .= "}"; + return $out; + } +} +?> -- cgit v1.2.3