]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/libraries/MOBIClass/EXTHHelper.php
2 //Reference: http://wiki.mobileread.com/wiki/MOBI
5 static function typeToText($type){
7 if(isset($types[$type])){
12 static function textToType($text){
13 $text = strtolower($text);
14 if(isset(self
::$flippedTypes[$text])){
15 return self
::$flippedTypes[$text];
20 static function convert($n, $size){
23 for($i = 0; $i < $size; $i++
){
24 $out = chr(($n & $mask) >> (8*$i)).$out;
30 static function getRightRepresentation($type, $value){
31 if($type >= 100 && $type < 200){
34 return self
::toHex($value);
38 static function toHex($value){
40 for($i = 0, $len = strlen($value); $i < $len; $i++
){
41 if($i > 0) $out .= " ";
42 $hex = dechex(ord($value[$i]));
43 if(strlen($hex) < 2) $hex = "0".$hex;
50 static private $types = array(
52 2 => "drm commerce id",
53 3 => "drm ebookbase book id",
60 106 => "publishingdate",
68 114 => "versionnumber",
70 116 => "startreading",
71 118 => "retail price",
72 119 => "retail price currency",
75 203 => "hasfakecover",
76 204 => "Creator Software",
77 205 => "Creator Major Version",
78 206 => "Creator Minor Version",
79 207 => "Creator Build Number",
81 209 => "tamper proof keys",
82 300 => "fontsignature",
83 401 => "clippinglimit",
84 402 => "publisherlimit",
88 502 => "lastupdatetime",
91 static private $flippedTypes = array(
93 "drm commerce id" => 2,
94 "drm ebookbase book id" => 3,
101 "publishingdate" => 106,
103 "contributor" => 108,
105 "subjectcode" => 110,
109 "versionnumber" => 114,
111 "startreading" => 116,
112 "retail price" => 118,
113 "retail price currency" => 119,
114 "coveroffset" => 201,
115 "thumboffset" => 202,
116 "hasfakecover" => 203,
117 "Creator Software" => 204,
118 "Creator Major Version" => 205,
119 "Creator Minor Version" => 206,
120 "Creator Build Number" => 207,
122 "tamper proof keys" => 209,
123 "fontsignature" => 300,
124 "clippinglimit" => 401,
125 "publisherlimit" => 402,
129 "lastupdatetime" => 502,
130 "updatedtitle" => 503