@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | $data = $book->component($component); |
15 | 15 | |
16 | - $callback = function ($m) use ($book, $component, $add) { |
|
16 | + $callback = function($m) use ($book, $component, $add) { |
|
17 | 17 | $method = $m[1]; |
18 | 18 | $path = $m[2]; |
19 | 19 | $end = ''; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | try { |
73 | 73 | $data = getComponentContent($book, $component, $add); |
74 | 74 | |
75 | - $expires = 60*60*24*14; |
|
75 | + $expires = 60 * 60 * 24 * 14; |
|
76 | 76 | header('Pragma: public'); |
77 | - header('Cache-Control: maxage='.$expires); |
|
78 | - header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); |
|
77 | + header('Cache-Control: maxage=' . $expires); |
|
78 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); |
|
79 | 79 | header('Content-Type: ' . $book->componentContentType($component)); |
80 | 80 | echo $data; |
81 | 81 | } catch (Exception $e) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public const ALL_RATING_ID = "cops:rating"; |
12 | 12 | |
13 | 13 | public const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count"; |
14 | - public const SQL_ALL_RATINGS ="select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating"; |
|
14 | + public const SQL_ALL_RATINGS = "select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating"; |
|
15 | 15 | public $id; |
16 | 16 | public $name; |
17 | 17 | |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | |
24 | 24 | public function getUri() |
25 | 25 | { |
26 | - return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id"; |
|
26 | + return "?page=" . parent::PAGE_RATING_DETAIL . "&id=$this->id"; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getEntryId() |
30 | 30 | { |
31 | - return self::ALL_RATING_ID.":".$this->id; |
|
31 | + return self::ALL_RATING_ID . ":" . $this->id; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function getCount() |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | $entryArray = []; |
49 | 49 | while ($post = $result->fetchObject()) { |
50 | 50 | $ratingObj = new Rating($post->id, $post->rating); |
51 | - $rating=$post->rating/2; |
|
51 | + $rating = $post->rating / 2; |
|
52 | 52 | $rating = str_format(localize("ratingword", $rating), $rating); |
53 | 53 | array_push($entryArray, new Entry( |
54 | 54 | $rating, |
55 | 55 | $ratingObj->getEntryId(), |
56 | 56 | str_format(localize("bookword", $post->count), $post->count), |
57 | 57 | "text", |
58 | - [ new LinkNavigation($ratingObj->getUri())], |
|
58 | + [new LinkNavigation($ratingObj->getUri())], |
|
59 | 59 | "", |
60 | 60 | $post->count |
61 | 61 | )); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | $rating = Rating::getRatingById($this->idGet); |
14 | 14 | $this->idPage = $rating->getEntryId(); |
15 | - $this->title =str_format(localize("ratingword", $rating->name/2), $rating->name/2); |
|
15 | + $this->title = str_format(localize("ratingword", $rating->name / 2), $rating->name / 2); |
|
16 | 16 | [$this->entryArray, $this->totalNumber] = Book::getBooksByRating($this->idGet, $this->n); |
17 | 17 | } |
18 | 18 | } |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | public function getUri() |
30 | 30 | { |
31 | - return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id"; |
|
31 | + return "?page=" . parent::PAGE_AUTHOR_DETAIL . "&id=$this->id"; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getEntryId() |
35 | 35 | { |
36 | - return self::ALL_AUTHORS_ID.":".$this->id; |
|
36 | + return self::ALL_AUTHORS_ID . ":" . $this->id; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public static function getEntryIdByLetter($startingLetter) |
40 | 40 | { |
41 | - return self::ALL_AUTHORS_ID.":letter:".$startingLetter; |
|
41 | + return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public static function getCount() |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | Author::getEntryIdByLetter($post->title), |
61 | 61 | str_format(localize("authorword", $post->count), $post->count), |
62 | 62 | "text", |
63 | - [ new LinkNavigation("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode($post->title))], |
|
63 | + [new LinkNavigation("?page=" . parent::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))], |
|
64 | 64 | "", |
65 | 65 | $post->count |
66 | 66 | )); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | DB . ":query:{$d}", |
79 | 79 | " ", |
80 | 80 | "text", |
81 | - [ new LinkNavigation("?" . DB . "={$d}")], |
|
81 | + [new LinkNavigation("?" . DB . "={$d}")], |
|
82 | 82 | "tt-header" |
83 | 83 | )); |
84 | 84 | Base::getDb($d); |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | DB . ":query:{$d}:{$key}", |
113 | 113 | str_format(localize("{$key}word", $total), $total), |
114 | 114 | "text", |
115 | - [ new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")], |
|
116 | - Base::noDatabaseSelected() ? "" : "tt-header", |
|
115 | + [new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")], |
|
116 | + Base::noDatabaseSelected()?"":"tt-header", |
|
117 | 117 | $total |
118 | 118 | )); |
119 | 119 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | DB . ":query:{$i}", |
164 | 164 | str_format(localize("bookword", $totalNumber), $totalNumber), |
165 | 165 | "text", |
166 | - [ new LinkNavigation("?" . DB . "={$i}&page=9&query=" . $this->query)], |
|
166 | + [new LinkNavigation("?" . DB . "={$i}&page=9&query=" . $this->query)], |
|
167 | 167 | "", |
168 | 168 | $totalNumber |
169 | 169 | )); |
@@ -228,7 +228,7 @@ |
||
228 | 228 | return new Link("fetch.php?" . $urlParam, $mime, $rel, $title); |
229 | 229 | } |
230 | 230 | } else { |
231 | - return new Link(str_replace('%2F', '/', rawurlencode($book->path."/".$filename)), $mime, $rel, $title); |
|
231 | + return new Link(str_replace('%2F', '/', rawurlencode($book->path . "/" . $filename)), $mime, $rel, $title); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | } |
@@ -603,10 +603,10 @@ |
||
603 | 603 | $i = 0; |
604 | 604 | $critArray = []; |
605 | 605 | foreach ([PageQueryResult::SCOPE_AUTHOR, |
606 | - PageQueryResult::SCOPE_TAG, |
|
607 | - PageQueryResult::SCOPE_SERIES, |
|
608 | - PageQueryResult::SCOPE_PUBLISHER, |
|
609 | - PageQueryResult::SCOPE_BOOK] as $key) { |
|
606 | + PageQueryResult::SCOPE_TAG, |
|
607 | + PageQueryResult::SCOPE_SERIES, |
|
608 | + PageQueryResult::SCOPE_PUBLISHER, |
|
609 | + PageQueryResult::SCOPE_BOOK] as $key) { |
|
610 | 610 | if (in_array($key, getCurrentOption('ignored_categories')) || |
611 | 611 | (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { |
612 | 612 | $critArray[$i] = self::BAD_SEARCH; |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | |
130 | 130 | public function getEntryId() |
131 | 131 | { |
132 | - return self::ALL_BOOKS_UUID.':'.$this->uuid; |
|
132 | + return self::ALL_BOOKS_UUID . ':' . $this->uuid; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | public static function getEntryIdByLetter($startingLetter) |
136 | 136 | { |
137 | - return self::ALL_BOOKS_ID.':letter:'.$startingLetter; |
|
137 | + return self::ALL_BOOKS_ID . ':letter:' . $startingLetter; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | public function getUri() |
141 | 141 | { |
142 | - return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id; |
|
142 | + return '?page=' . parent::PAGE_BOOK_DETAIL . '&id=' . $this->id; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public function getDetailUrl() |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | |
172 | 172 | public function getAuthorsName() |
173 | 173 | { |
174 | - return implode(', ', array_map(function ($author) { |
|
174 | + return implode(', ', array_map(function($author) { |
|
175 | 175 | return $author->name; |
176 | 176 | }, $this->getAuthors())); |
177 | 177 | } |
178 | 178 | |
179 | 179 | public function getAuthorsSort() |
180 | 180 | { |
181 | - return implode(', ', array_map(function ($author) { |
|
181 | + return implode(', ', array_map(function($author) { |
|
182 | 182 | return $author->sort; |
183 | 183 | }, $this->getAuthors())); |
184 | 184 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | public function getTagsName() |
245 | 245 | { |
246 | - return implode(', ', array_map(function ($tag) { |
|
246 | + return implode(', ', array_map(function($tag) { |
|
247 | 247 | return $tag->name; |
248 | 248 | }, $this->getTags())); |
249 | 249 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | public function getDataById($idData) |
302 | 302 | { |
303 | - $reduced = array_filter($this->getDatas(), function ($data) use ($idData) { |
|
303 | + $reduced = array_filter($this->getDatas(), function($data) use ($idData) { |
|
304 | 304 | return $data->id == $idData; |
305 | 305 | }); |
306 | 306 | return reset($reduced); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | if (empty($this->pubdate)) { |
327 | 327 | return ''; |
328 | 328 | } |
329 | - $dateY = (int) substr($this->pubdate, 0, 4); |
|
329 | + $dateY = (int)substr($this->pubdate, 0, 4); |
|
330 | 330 | if ($dateY > 102) { |
331 | 331 | return str_pad($dateY, 4, '0', STR_PAD_LEFT); |
332 | 332 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | |
350 | 350 | public function getDataFormat($format) |
351 | 351 | { |
352 | - $reduced = array_filter($this->getDatas(), function ($data) use ($format) { |
|
352 | + $reduced = array_filter($this->getDatas(), function($data) use ($format) { |
|
353 | 353 | return $data->format == $format; |
354 | 354 | }); |
355 | 355 | return reset($reduced); |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | if ($relative) { |
371 | - return $this->relativePath.'/'.$file; |
|
371 | + return $this->relativePath . '/' . $file; |
|
372 | 372 | } else { |
373 | - return $this->path.'/'.$file; |
|
373 | + return $this->path . '/' . $file; |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $epub->SerieIndex($this->seriesIndex); |
400 | 400 | } |
401 | 401 | $filename = $data->getUpdatedFilenameEpub(); |
402 | - if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
402 | + if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
403 | 403 | $epub->updateForKepub(); |
404 | 404 | $filename = $data->getUpdatedFilenameKepub(); |
405 | 405 | } |
@@ -426,13 +426,13 @@ discard block |
||
426 | 426 | if ($nw >= $w) { |
427 | 427 | return false; |
428 | 428 | } |
429 | - $nh = intval(($nw*$h)/$w); |
|
429 | + $nh = intval(($nw * $h) / $w); |
|
430 | 430 | } else { |
431 | 431 | $nh = $height; |
432 | 432 | if ($nh >= $h) { |
433 | 433 | return false; |
434 | 434 | } |
435 | - $nw = intval(($nh*$w)/$h); |
|
435 | + $nw = intval(($nh * $w) / $h); |
|
436 | 436 | } |
437 | 437 | } else { |
438 | 438 | return false; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | //draw the image |
442 | 442 | $src_img = imagecreatefromjpeg($file); |
443 | 443 | $dst_img = imagecreatetruecolor($nw, $nh); |
444 | - imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h);//resizing the image |
|
444 | + imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h); //resizing the image |
|
445 | 445 | imagejpeg($dst_img, $outputfile, 80); |
446 | 446 | imagedestroy($src_img); |
447 | 447 | imagedestroy($dst_img); |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | self::ALL_BOOKS_ID, |
507 | 507 | str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), |
508 | 508 | 'text', |
509 | - [new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)], |
|
509 | + [new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS)], |
|
510 | 510 | '', |
511 | 511 | $nBooks |
512 | 512 | ); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | self::ALL_RECENT_BOOKS_ID, |
518 | 518 | str_format(localize('recent.list'), $config['cops_recentbooks_limit']), |
519 | 519 | 'text', |
520 | - [ new LinkNavigation('?page='.parent::PAGE_ALL_RECENT_BOOKS)], |
|
520 | + [new LinkNavigation('?page=' . parent::PAGE_ALL_RECENT_BOOKS)], |
|
521 | 521 | '', |
522 | 522 | $config['cops_recentbooks_limit'] |
523 | 523 | ); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | Book::getEntryIdByLetter($post->title), |
645 | 645 | str_format(localize('bookword', $post->count), $post->count), |
646 | 646 | 'text', |
647 | - [new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))], |
|
647 | + [new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS_LETTER . '&id=' . rawurlencode($post->title))], |
|
648 | 648 | '', |
649 | 649 | $post->count |
650 | 650 | )); |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | */ |
12 | 12 | abstract class CustomColumnType extends Base |
13 | 13 | { |
14 | - public const ALL_CUSTOMS_ID = "cops:custom"; |
|
14 | + public const ALL_CUSTOMS_ID = "cops:custom"; |
|
15 | 15 | |
16 | - public const CUSTOM_TYPE_TEXT = "text"; // type 1 + 2 |
|
17 | - public const CUSTOM_TYPE_COMMENT = "comments"; // type 3 |
|
18 | - public const CUSTOM_TYPE_SERIES = "series"; // type 4 |
|
16 | + public const CUSTOM_TYPE_TEXT = "text"; // type 1 + 2 |
|
17 | + public const CUSTOM_TYPE_COMMENT = "comments"; // type 3 |
|
18 | + public const CUSTOM_TYPE_SERIES = "series"; // type 4 |
|
19 | 19 | public const CUSTOM_TYPE_ENUM = "enumeration"; // type 5 |
20 | - public const CUSTOM_TYPE_DATE = "datetime"; // type 6 |
|
21 | - public const CUSTOM_TYPE_FLOAT = "float"; // type 7 |
|
22 | - public const CUSTOM_TYPE_INT = "int"; // type 8 |
|
23 | - public const CUSTOM_TYPE_RATING = "rating"; // type 9 |
|
24 | - public const CUSTOM_TYPE_BOOL = "bool"; // type 10 |
|
25 | - public const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12 |
|
20 | + public const CUSTOM_TYPE_DATE = "datetime"; // type 6 |
|
21 | + public const CUSTOM_TYPE_FLOAT = "float"; // type 7 |
|
22 | + public const CUSTOM_TYPE_INT = "int"; // type 8 |
|
23 | + public const CUSTOM_TYPE_RATING = "rating"; // type 9 |
|
24 | + public const CUSTOM_TYPE_BOOL = "bool"; // type 10 |
|
25 | + public const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12 |
|
26 | 26 | |
27 | 27 | /** @var array[integer]CustomColumnType */ |
28 | 28 | private static $customColumnCacheID = []; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $result->execute([$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 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | |
24 | 24 | public function getUri() |
25 | 25 | { |
26 | - return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id"; |
|
26 | + return "?page=" . parent::PAGE_TAG_DETAIL . "&id=$this->id"; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getEntryId() |
30 | 30 | { |
31 | - return self::ALL_TAGS_ID.":".$this->id; |
|
31 | + return self::ALL_TAGS_ID . ":" . $this->id; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function getCount() |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public static function getAllTagsByQuery($query, $n, $database = null, $numberPerPage = null) |
56 | 56 | { |
57 | - $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
57 | + $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
58 | 58 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
59 | 59 | [$totalNumber, $result] = parent::executeQuery($sql, $columns, "", ['%' . $query . '%'], $n, $database, $numberPerPage); |
60 | 60 | $entryArray = []; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $tag->getEntryId(), |
66 | 66 | str_format(localize("bookword", $post->count), $post->count), |
67 | 67 | "text", |
68 | - [ new LinkNavigation($tag->getUri())] |
|
68 | + [new LinkNavigation($tag->getUri())] |
|
69 | 69 | )); |
70 | 70 | } |
71 | 71 | return [$entryArray, $totalNumber]; |