1 | <?php |
||
11 | class Data extends Base { |
||
12 | public $id; |
||
13 | public $name; |
||
14 | public $format; |
||
15 | public $realFormat; |
||
16 | public $extension; |
||
17 | public $book; |
||
18 | |||
19 | public static $mimetypes = array( |
||
20 | 'aac' => 'audio/aac', |
||
21 | 'azw' => 'application/x-mobipocket-ebook', |
||
22 | 'azw1' => 'application/x-topaz-ebook', |
||
23 | 'azw2' => 'application/x-kindle-application', |
||
24 | 'azw3' => 'application/x-mobi8-ebook', |
||
25 | 'cbz' => 'application/x-cbz', |
||
26 | 'cbr' => 'application/x-cbr', |
||
27 | 'djv' => 'image/vnd.djvu', |
||
28 | 'djvu' => 'image/vnd.djvu', |
||
29 | 'doc' => 'application/msword', |
||
30 | 'epub' => 'application/epub+zip', |
||
31 | 'fb2' => 'text/fb2+xml', |
||
32 | 'ibooks'=> 'application/x-ibooks+zip', |
||
33 | 'kepub' => 'application/epub+zip', |
||
34 | 'kobo' => 'application/x-koboreader-ebook', |
||
35 | 'm4a' => 'audio/mp4', |
||
36 | 'mobi' => 'application/x-mobipocket-ebook', |
||
37 | 'mp3' => 'audio/mpeg', |
||
38 | 'lit' => 'application/x-ms-reader', |
||
39 | 'lrs' => 'text/x-sony-bbeb+xml', |
||
40 | 'lrf' => 'application/x-sony-bbeb', |
||
41 | 'lrx' => 'application/x-sony-bbeb', |
||
42 | 'ncx' => 'application/x-dtbncx+xml', |
||
43 | 'opf' => 'application/oebps-package+xml', |
||
44 | 'otf' => 'application/x-font-opentype', |
||
45 | 'pdb' => 'application/vnd.palm', |
||
46 | 'pdf' => 'application/pdf', |
||
47 | 'prc' => 'application/x-mobipocket-ebook', |
||
48 | 'rtf' => 'application/rtf', |
||
49 | 'svg' => 'image/svg+xml', |
||
50 | 'ttf' => 'application/x-font-truetype', |
||
51 | 'tpz' => 'application/x-topaz-ebook', |
||
52 | 'wav' => 'audio/wav', |
||
53 | 'wmf' => 'image/wmf', |
||
54 | 'xhtml' => 'application/xhtml+xml', |
||
55 | 'xpgt' => 'application/adobe-page-template+xml', |
||
56 | 'zip' => 'application/zip' |
||
57 | ); |
||
58 | |||
59 | 63 | public function __construct($post, $book = null) { |
|
67 | |||
68 | 53 | public function isKnownType () { |
|
71 | |||
72 | 53 | public function getMimeType () { |
|
89 | |||
90 | 1 | public function isEpubValidOnKobo () { |
|
93 | |||
94 | 50 | public function getFilename () { |
|
97 | |||
98 | 1 | public function getUpdatedFilename () { |
|
101 | |||
102 | 1 | public function getUpdatedFilenameEpub () { |
|
105 | |||
106 | 1 | public function getUpdatedFilenameKepub () { |
|
107 | 1 | $str = $this->getUpdatedFilename () . ".kepub.epub"; |
|
108 | 1 | return str_replace(array(':', '#', '&'), |
|
109 | 1 | array('-', '-', ' '), $str ); |
|
110 | } |
||
111 | |||
112 | 49 | public function getDataLink ($rel, $title = NULL) { |
|
121 | |||
122 | 5 | public function getHtmlLink () { |
|
125 | |||
126 | 2 | public function getLocalPath () { |
|
129 | |||
130 | 2 | public function getHtmlLinkWithRewriting ($title = NULL) { |
|
131 | 2 | global $config; |
|
132 | |||
133 | 2 | $database = ""; |
|
134 | 2 | if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/"; |
|
135 | |||
136 | 2 | $href = "download/" . $this->id . "/" . $database; |
|
137 | |||
138 | 2 | if ($config['cops_provide_kepub'] == "1" && |
|
139 | 2 | $this->isEpubValidOnKobo () && |
|
140 | 2 | preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) { |
|
141 | 1 | $href .= rawurlencode ($this->getUpdatedFilenameKepub ()); |
|
142 | 1 | } else { |
|
143 | 2 | $href .= rawurlencode ($this->getFilename ()); |
|
144 | } |
||
145 | 2 | return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title); |
|
146 | } |
||
147 | |||
148 | 62 | public static function getDataByBook ($book) { |
|
160 | |||
161 | 19 | public static function handleThumbnailLink ($urlParam, $height) { |
|
179 | |||
180 | 49 | public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
|
209 | } |
||
210 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.