aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/MOBIClass/EXTHHelper.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/3rdparty/libraries/MOBIClass/EXTHHelper.php')
-rw-r--r--inc/3rdparty/libraries/MOBIClass/EXTHHelper.php132
1 files changed, 0 insertions, 132 deletions
diff --git a/inc/3rdparty/libraries/MOBIClass/EXTHHelper.php b/inc/3rdparty/libraries/MOBIClass/EXTHHelper.php
deleted file mode 100644
index 275142bf..00000000
--- a/inc/3rdparty/libraries/MOBIClass/EXTHHelper.php
+++ /dev/null
@@ -1,132 +0,0 @@
1<?php
2//Reference: http://wiki.mobileread.com/wiki/MOBI
3
4class EXTHHelper{
5 static function typeToText($type){
6 $types = self::$types;
7 if(isset($types[$type])){
8 return $types[$type];
9 }
10 return $type;
11 }
12 static function textToType($text){
13 $text = strtolower($text);
14 if(isset(self::$flippedTypes[$text])){
15 return self::$flippedTypes[$text];
16 }
17 return false;
18 }
19
20 static function convert($n, $size){
21 $mask = 0xFF;
22 $out = "";
23 for($i = 0; $i < $size; $i++){
24 $out = chr(($n & $mask) >> (8*$i)).$out;
25 $mask = $mask << 8;
26 }
27 return $out;
28 }
29
30 static function getRightRepresentation($type, $value){
31 if($type >= 100 && $type < 200){
32 return $value;
33 }else{
34 return self::toHex($value);
35 }
36 }
37
38 static function toHex($value){
39 $out = "";
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;
44 $out .= $hex;
45 }
46 return $out;
47 }
48
49
50 static private $types = array(
51 1 => "drm server id",
52 2 => "drm commerce id",
53 3 => "drm ebookbase book id",
54 100 => "author",
55 101 => "publisher",
56 102 => "imprint",
57 103 => "description",
58 104 => "isbn",
59 105 => "subject",
60 106 => "publishingdate",
61 107 => "review",
62 108 => "contributor",
63 109 => "rights",
64 110 => "subjectcode",
65 111 => "type",
66 112 => "source",
67 113 => "asin",
68 114 => "versionnumber",
69 115 => "sample",
70 116 => "startreading",
71 118 => "retail price",
72 119 => "retail price currency",
73 201 => "coveroffset",
74 202 => "thumboffset",
75 203 => "hasfakecover",
76 204 => "Creator Software",
77 205 => "Creator Major Version",
78 206 => "Creator Minor Version",
79 207 => "Creator Build Number",
80 208 => "watermark",
81 209 => "tamper proof keys",
82 300 => "fontsignature",
83 401 => "clippinglimit",
84 402 => "publisherlimit",
85 403 => "403",
86 404 => "ttsflag",
87 501 => "cdetype",
88 502 => "lastupdatetime",
89 503 => "updatedtitle"
90 );
91 static private $flippedTypes = array(
92 "drm server id" => 1,
93 "drm commerce id" => 2,
94 "drm ebookbase book id" => 3,
95 "author" => 100,
96 "publisher" => 101,
97 "imprint" => 102,
98 "description" => 103,
99 "isbn" => 104,
100 "subject" => 105,
101 "publishingdate" => 106,
102 "review" => 107,
103 "contributor" => 108,
104 "rights" => 109,
105 "subjectcode" => 110,
106 "type" => 111,
107 "source" => 112,
108 "asin" => 113,
109 "versionnumber" => 114,
110 "sample" => 115,
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,
121 "watermark" => 208,
122 "tamper proof keys" => 209,
123 "fontsignature" => 300,
124 "clippinglimit" => 401,
125 "publisherlimit" => 402,
126 "403" => 403,
127 "ttsflag" => 404,
128 "cdetype" => 501,
129 "lastupdatetime" => 502,
130 "updatedtitle" => 503
131 );
132} \ No newline at end of file