@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * |
190 | 190 | * Note that the composite custom columns are not supported |
191 | 191 | */ |
192 | - $config['cops_calibre_custom_column_list'] = array (); |
|
192 | + $config['cops_calibre_custom_column_list'] = array(); |
|
193 | 193 | |
194 | 194 | /* |
195 | 195 | * Custom Columns for the book preview panel |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * Note that the composite custom columns are not supported |
201 | 201 | */ |
202 | - $config['cops_calibre_custom_column_preview'] = array (); |
|
202 | + $config['cops_calibre_custom_column_preview'] = array(); |
|
203 | 203 | |
204 | 204 | /* |
205 | 205 | * Rename .epub to .kepub.epub if downloaded from a Kobo eReader |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | $idData = getURLParam('data', NULL); |
17 | 17 | $add = 'data=' . $idData . '&'; |
18 | -if (!is_null (GetUrlParam (DB))) { |
|
19 | - $add .= DB . '=' . GetUrlParam (DB) . '&'; |
|
18 | +if (!is_null(GetUrlParam(DB))) { |
|
19 | + $add .= DB . '=' . GetUrlParam(DB) . '&'; |
|
20 | 20 | } |
21 | 21 | $myBook = Book::getBookByDataId($idData); |
22 | 22 | |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | Monocle.DEBUG = true; |
38 | 38 | var bookData = { |
39 | 39 | getComponents: function() { |
40 | - <?php echo 'return [' . implode(', ', array_map(function($comp) { return "'" . $comp . "'"; }, $book->components ())) . '];'; ?> |
|
40 | + <?php echo 'return [' . implode(', ', array_map(function($comp) { return "'" . $comp . "'"; }, $book->components())) . '];'; ?> |
|
41 | 41 | }, |
42 | 42 | getContents: function() { |
43 | - <?php echo 'return [' . implode(', ', array_map(function($content) { return "{title: '" . addslashes($content['title']) . "', src: '". $content['src'] . "'}"; }, $book->contents())) . '];'; ?> |
|
43 | + <?php echo 'return [' . implode(', ', array_map(function($content) { return "{title: '" . addslashes($content['title']) . "', src: '" . $content['src'] . "'}"; }, $book->contents())) . '];'; ?> |
|
44 | 44 | }, |
45 | 45 | getComponent: function (componentId) { |
46 | 46 | return { url: "epubfs.php?<?php echo $add ?>comp=" + componentId }; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | // Counting down is faster. I'm *so* sorry. |
91 | 91 | $len = $chunk + 1; |
92 | 92 | |
93 | - for ($i = -1; --$len; ) { |
|
93 | + for ($i = -1; --$len;) { |
|
94 | 94 | $c = $str[++$i]; |
95 | 95 | if ($remaining = $tail_bytes[$c]) { |
96 | 96 | // UTF-8 head byte! |
@@ -208,5 +208,5 @@ discard block |
||
208 | 208 | |
209 | 209 | $ord = $ord & 255; |
210 | 210 | |
211 | - return isset($map[$bank][$langcode][$ord]) ? $map[$bank][$langcode][$ord] : $unknown; |
|
211 | + return isset($map[$bank][$langcode][$ord])?$map[$bank][$langcode][$ord]:$unknown; |
|
212 | 212 | } |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | * @return |
26 | 26 | * Transliterated text. |
27 | 27 | */ |
28 | -function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) { |
|
28 | +function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) |
|
29 | +{ |
|
29 | 30 | // ASCII is always valid NFC! If we're only ever given plain ASCII, we can |
30 | 31 | // avoid the overhead of initializing the decomposition tables by skipping |
31 | 32 | // out early. |
@@ -41,23 +42,17 @@ discard block |
||
41 | 42 | for ($n = 0; $n < 256; $n++) { |
42 | 43 | if ($n < 0xc0) { |
43 | 44 | $remaining = 0; |
44 | - } |
|
45 | - elseif ($n < 0xe0) { |
|
45 | + } elseif ($n < 0xe0) { |
|
46 | 46 | $remaining = 1; |
47 | - } |
|
48 | - elseif ($n < 0xf0) { |
|
47 | + } elseif ($n < 0xf0) { |
|
49 | 48 | $remaining = 2; |
50 | - } |
|
51 | - elseif ($n < 0xf8) { |
|
49 | + } elseif ($n < 0xf8) { |
|
52 | 50 | $remaining = 3; |
53 | - } |
|
54 | - elseif ($n < 0xfc) { |
|
51 | + } elseif ($n < 0xfc) { |
|
55 | 52 | $remaining = 4; |
56 | - } |
|
57 | - elseif ($n < 0xfe) { |
|
53 | + } elseif ($n < 0xfe) { |
|
58 | 54 | $remaining = 5; |
59 | - } |
|
60 | - else { |
|
55 | + } else { |
|
61 | 56 | $remaining = 0; |
62 | 57 | } |
63 | 58 | $tail_bytes[chr($n)] = $remaining; |
@@ -100,15 +95,13 @@ discard block |
||
100 | 95 | if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") { |
101 | 96 | // Legal tail bytes are nice. |
102 | 97 | $sequence .= $c; |
103 | - } |
|
104 | - else { |
|
98 | + } else { |
|
105 | 99 | if ($len == 0) { |
106 | 100 | // Premature end of string! Drop a replacement character into |
107 | 101 | // output to represent the invalid UTF-8 sequence. |
108 | 102 | $result .= $unknown; |
109 | 103 | break 2; |
110 | - } |
|
111 | - else { |
|
104 | + } else { |
|
112 | 105 | // Illegal tail byte; abandon the sequence. |
113 | 106 | $result .= $unknown; |
114 | 107 | // Back up and reprocess this byte; it may itself be a legal |
@@ -123,17 +116,13 @@ discard block |
||
123 | 116 | $n = ord($head); |
124 | 117 | if ($n <= 0xdf) { |
125 | 118 | $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128); |
126 | - } |
|
127 | - elseif ($n <= 0xef) { |
|
119 | + } elseif ($n <= 0xef) { |
|
128 | 120 | $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128); |
129 | - } |
|
130 | - elseif ($n <= 0xf7) { |
|
121 | + } elseif ($n <= 0xf7) { |
|
131 | 122 | $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128); |
132 | - } |
|
133 | - elseif ($n <= 0xfb) { |
|
123 | + } elseif ($n <= 0xfb) { |
|
134 | 124 | $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128); |
135 | - } |
|
136 | - elseif ($n <= 0xfd) { |
|
125 | + } elseif ($n <= 0xfd) { |
|
137 | 126 | $ord = ($n - 252) * 1073741824 + (ord($sequence[1]) - 128) * 16777216 + (ord($sequence[2]) - 128) * 262144 + (ord($sequence[3]) - 128) * 4096 + (ord($sequence[4]) - 128) * 64 + (ord($sequence[5]) - 128); |
138 | 127 | } else { |
139 | 128 | $ord = $n; |
@@ -174,7 +163,8 @@ discard block |
||
174 | 163 | * @return |
175 | 164 | * ASCII replacement character. |
176 | 165 | */ |
177 | -function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) { |
|
166 | +function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) |
|
167 | +{ |
|
178 | 168 | static $map = array(); |
179 | 169 | |
180 | 170 | //GL: set language later |
@@ -196,12 +186,10 @@ discard block |
||
196 | 186 | if ($langcode != 'en' && isset($variant[$langcode])) { |
197 | 187 | // Merge in language specific mappings. |
198 | 188 | $map[$bank][$langcode] = $variant[$langcode] + $base; |
199 | - } |
|
200 | - else { |
|
189 | + } else { |
|
201 | 190 | $map[$bank][$langcode] = $base; |
202 | 191 | } |
203 | - } |
|
204 | - else { |
|
192 | + } else { |
|
205 | 193 | $map[$bank][$langcode] = array(); |
206 | 194 | } |
207 | 195 | } |
@@ -55,7 +55,9 @@ |
||
55 | 55 | public function getDescription() |
56 | 56 | { |
57 | 57 | $desc = $this->getDatabaseDescription(); |
58 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
58 | + if ($desc === NULL || empty($desc)) { |
|
59 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
60 | + } |
|
59 | 61 | return $desc; |
60 | 62 | } |
61 | 63 |
@@ -8,10 +8,10 @@ |
||
8 | 8 | |
9 | 9 | class PageAllAuthorsLetter extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | - $this->idPage = Author::getEntryIdByLetter ($this->idGet); |
|
14 | - $this->entryArray = Author::getAuthorsByStartingLetter ($this->idGet); |
|
15 | - $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("authorword", count ($this->entryArray)), count ($this->entryArray)), $this->idGet); |
|
13 | + $this->idPage = Author::getEntryIdByLetter($this->idGet); |
|
14 | + $this->entryArray = Author::getAuthorsByStartingLetter($this->idGet); |
|
15 | + $this->title = str_format(localize("splitByLetter.letter"), str_format(localize("authorword", count($this->entryArray)), count($this->entryArray)), $this->idGet); |
|
16 | 16 | } |
17 | 17 | } |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | */ |
12 | 12 | abstract class CustomColumnType extends Base |
13 | 13 | { |
14 | - const ALL_CUSTOMS_ID = "cops:custom"; |
|
14 | + const ALL_CUSTOMS_ID = "cops:custom"; |
|
15 | 15 | |
16 | - const CUSTOM_TYPE_TEXT = "text"; // type 1 + 2 |
|
17 | - const CUSTOM_TYPE_COMMENT = "comments"; // type 3 |
|
18 | - const CUSTOM_TYPE_SERIES = "series"; // type 4 |
|
16 | + const CUSTOM_TYPE_TEXT = "text"; // type 1 + 2 |
|
17 | + const CUSTOM_TYPE_COMMENT = "comments"; // type 3 |
|
18 | + const CUSTOM_TYPE_SERIES = "series"; // type 4 |
|
19 | 19 | const CUSTOM_TYPE_ENUM = "enumeration"; // type 5 |
20 | - const CUSTOM_TYPE_DATE = "datetime"; // type 6 |
|
21 | - const CUSTOM_TYPE_FLOAT = "float"; // type 7 |
|
22 | - const CUSTOM_TYPE_INT = "int"; // type 8 |
|
23 | - const CUSTOM_TYPE_RATING = "rating"; // type 9 |
|
24 | - const CUSTOM_TYPE_BOOL = "bool"; // type 10 |
|
25 | - const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12 |
|
20 | + const CUSTOM_TYPE_DATE = "datetime"; // type 6 |
|
21 | + const CUSTOM_TYPE_FLOAT = "float"; // type 7 |
|
22 | + const CUSTOM_TYPE_INT = "int"; // type 8 |
|
23 | + const CUSTOM_TYPE_RATING = "rating"; // type 9 |
|
24 | + const CUSTOM_TYPE_BOOL = "bool"; // type 10 |
|
25 | + const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12 |
|
26 | 26 | |
27 | 27 | /** @var array[integer]CustomColumnType */ |
28 | 28 | private static $customColumnCacheID = array(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $result->execute(array($this->customId)); |
111 | 111 | if ($post = $result->fetchObject()) { |
112 | 112 | $json = json_decode($post->display); |
113 | - return (isset($json->description) && !empty($json->description)) ? $json->description : NULL; |
|
113 | + return (isset($json->description) && !empty($json->description))?$json->description:NULL; |
|
114 | 114 | } |
115 | 115 | return NULL; |
116 | 116 | } |
@@ -181,8 +181,9 @@ discard block |
||
181 | 181 | public static function createByCustomID($customId) |
182 | 182 | { |
183 | 183 | // Reuse already created CustomColumns for performance |
184 | - if (array_key_exists($customId, self::$customColumnCacheID)) |
|
185 | - return self::$customColumnCacheID[$customId]; |
|
184 | + if (array_key_exists($customId, self::$customColumnCacheID)) { |
|
185 | + return self::$customColumnCacheID[$customId]; |
|
186 | + } |
|
186 | 187 | |
187 | 188 | $datatype = self::getDatatypeByCustomID($customId); |
188 | 189 | |
@@ -221,8 +222,9 @@ discard block |
||
221 | 222 | public static function createByLookup($lookup) |
222 | 223 | { |
223 | 224 | // Reuse already created CustomColumns for performance |
224 | - if (array_key_exists($lookup, self::$customColumnCacheLookup)) |
|
225 | - return self::$customColumnCacheLookup[$lookup]; |
|
225 | + if (array_key_exists($lookup, self::$customColumnCacheLookup)) { |
|
226 | + return self::$customColumnCacheLookup[$lookup]; |
|
227 | + } |
|
226 | 228 | |
227 | 229 | $result = parent::getDb()->prepare('SELECT id FROM custom_columns WHERE label = ?'); |
228 | 230 | $result->execute(array($lookup)); |
@@ -241,8 +243,9 @@ discard block |
||
241 | 243 | public function getAllCustomValues() |
242 | 244 | { |
243 | 245 | // lazy loading |
244 | - if ($this->customValues == NULL) |
|
245 | - $this->customValues = $this->getAllCustomValuesFromDatabase(); |
|
246 | + if ($this->customValues == NULL) { |
|
247 | + $this->customValues = $this->getAllCustomValuesFromDatabase(); |
|
248 | + } |
|
246 | 249 | |
247 | 250 | return $this->customValues; |
248 | 251 | } |
@@ -21,44 +21,44 @@ |
||
21 | 21 | $this->name = $post->name; |
22 | 22 | } |
23 | 23 | |
24 | - public function getUri () { |
|
25 | - return "?page=".parent::PAGE_SERIE_DETAIL."&id=$this->id"; |
|
24 | + public function getUri() { |
|
25 | + return "?page=" . parent::PAGE_SERIE_DETAIL . "&id=$this->id"; |
|
26 | 26 | } |
27 | 27 | |
28 | - public function getEntryId () { |
|
29 | - return self::ALL_SERIES_ID.":".$this->id; |
|
28 | + public function getEntryId() { |
|
29 | + return self::ALL_SERIES_ID . ":" . $this->id; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public static function getCount() { |
33 | 33 | // str_format (localize("series.alphabetical", count(array)) |
34 | - return parent::getCountGeneric ("series", self::ALL_SERIES_ID, parent::PAGE_ALL_SERIES); |
|
34 | + return parent::getCountGeneric("series", self::ALL_SERIES_ID, parent::PAGE_ALL_SERIES); |
|
35 | 35 | } |
36 | 36 | |
37 | - public static function getSerieByBookId ($bookId) { |
|
38 | - $result = parent::getDb ()->prepare('select series.id as id, name |
|
37 | + public static function getSerieByBookId($bookId) { |
|
38 | + $result = parent::getDb()->prepare('select series.id as id, name |
|
39 | 39 | from books_series_link, series |
40 | 40 | where series.id = series and book = ?'); |
41 | - $result->execute (array ($bookId)); |
|
42 | - if ($post = $result->fetchObject ()) { |
|
43 | - return new Serie ($post); |
|
41 | + $result->execute(array($bookId)); |
|
42 | + if ($post = $result->fetchObject()) { |
|
43 | + return new Serie($post); |
|
44 | 44 | } |
45 | 45 | return NULL; |
46 | 46 | } |
47 | 47 | |
48 | - public static function getSerieById ($serieId) { |
|
49 | - $result = parent::getDb ()->prepare('select id, name from series where id = ?'); |
|
50 | - $result->execute (array ($serieId)); |
|
51 | - if ($post = $result->fetchObject ()) { |
|
52 | - return new Serie ($post); |
|
48 | + public static function getSerieById($serieId) { |
|
49 | + $result = parent::getDb()->prepare('select id, name from series where id = ?'); |
|
50 | + $result->execute(array($serieId)); |
|
51 | + if ($post = $result->fetchObject()) { |
|
52 | + return new Serie($post); |
|
53 | 53 | } |
54 | 54 | return NULL; |
55 | 55 | } |
56 | 56 | |
57 | 57 | public static function getAllSeries() { |
58 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array (), "Serie"); |
|
58 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array(), "Serie"); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public static function getAllSeriesByQuery($query) { |
62 | - return Base::getEntryArrayWithBookNumber (self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array ('%' . $query . '%'), "Serie"); |
|
62 | + return Base::getEntryArrayWithBookNumber(self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array('%' . $query . '%'), "Serie"); |
|
63 | 63 | } |
64 | 64 | } |
@@ -16,25 +16,30 @@ discard block |
||
16 | 16 | public $id; |
17 | 17 | public $name; |
18 | 18 | |
19 | - public function __construct($post) { |
|
19 | + public function __construct($post) |
|
20 | + { |
|
20 | 21 | $this->id = $post->id; |
21 | 22 | $this->name = $post->name; |
22 | 23 | } |
23 | 24 | |
24 | - public function getUri () { |
|
25 | + public function getUri () |
|
26 | + { |
|
25 | 27 | return "?page=".parent::PAGE_SERIE_DETAIL."&id=$this->id"; |
26 | 28 | } |
27 | 29 | |
28 | - public function getEntryId () { |
|
30 | + public function getEntryId () |
|
31 | + { |
|
29 | 32 | return self::ALL_SERIES_ID.":".$this->id; |
30 | 33 | } |
31 | 34 | |
32 | - public static function getCount() { |
|
35 | + public static function getCount() |
|
36 | + { |
|
33 | 37 | // str_format (localize("series.alphabetical", count(array)) |
34 | 38 | return parent::getCountGeneric ("series", self::ALL_SERIES_ID, parent::PAGE_ALL_SERIES); |
35 | 39 | } |
36 | 40 | |
37 | - public static function getSerieByBookId ($bookId) { |
|
41 | + public static function getSerieByBookId ($bookId) |
|
42 | + { |
|
38 | 43 | $result = parent::getDb ()->prepare('select series.id as id, name |
39 | 44 | from books_series_link, series |
40 | 45 | where series.id = series and book = ?'); |
@@ -45,7 +50,8 @@ discard block |
||
45 | 50 | return NULL; |
46 | 51 | } |
47 | 52 | |
48 | - public static function getSerieById ($serieId) { |
|
53 | + public static function getSerieById ($serieId) |
|
54 | + { |
|
49 | 55 | $result = parent::getDb ()->prepare('select id, name from series where id = ?'); |
50 | 56 | $result->execute (array ($serieId)); |
51 | 57 | if ($post = $result->fetchObject ()) { |
@@ -54,11 +60,13 @@ discard block |
||
54 | 60 | return NULL; |
55 | 61 | } |
56 | 62 | |
57 | - public static function getAllSeries() { |
|
63 | + public static function getAllSeries() |
|
64 | + { |
|
58 | 65 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array (), "Serie"); |
59 | 66 | } |
60 | 67 | |
61 | - public static function getAllSeriesByQuery($query) { |
|
68 | + public static function getAllSeriesByQuery($query) |
|
69 | + { |
|
62 | 70 | return Base::getEntryArrayWithBookNumber (self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array ('%' . $query . '%'), "Serie"); |
63 | 71 | } |
64 | 72 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllSeries extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("series.title"); |
14 | 14 | $this->entryArray = Serie::getAllSeries(); |
@@ -8,10 +8,10 @@ |
||
8 | 8 | |
9 | 9 | class PageRecentBooks extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | - $this->title = localize ("recent.title"); |
|
14 | - $this->entryArray = Book::getAllRecentBooks (); |
|
13 | + $this->title = localize("recent.title"); |
|
14 | + $this->entryArray = Book::getAllRecentBooks(); |
|
15 | 15 | $this->idPage = Book::ALL_RECENT_BOOKS_ID; |
16 | 16 | } |
17 | 17 | } |