@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAuthorDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $author = Author::getAuthorById ($this->idGet); |
|
| 14 | - $this->idPage = $author->getEntryId (); |
|
| 13 | + $author = Author::getAuthorById($this->idGet); |
|
| 14 | + $this->idPage = $author->getEntryId(); |
|
| 15 | 15 | $this->title = $author->name; |
| 16 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByAuthor ($this->idGet, $this->n); |
|
| 16 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByAuthor($this->idGet, $this->n); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -473,15 +473,15 @@ discard block |
||
| 473 | 473 | $nBooks = parent::executeQuerySingle('select count(*) from books'); |
| 474 | 474 | $result = array(); |
| 475 | 475 | $entry = new Entry(localize('allbooks.title'), |
| 476 | - self::ALL_BOOKS_ID, |
|
| 477 | - str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
|
| 478 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
| 476 | + self::ALL_BOOKS_ID, |
|
| 477 | + str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
|
| 478 | + array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
| 479 | 479 | array_push($result, $entry); |
| 480 | 480 | if ($config['cops_recentbooks_limit'] > 0) { |
| 481 | 481 | $entry = new Entry(localize('recent.title'), |
| 482 | - self::ALL_RECENT_BOOKS_ID, |
|
| 483 | - str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
|
| 484 | - array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
| 482 | + self::ALL_RECENT_BOOKS_ID, |
|
| 483 | + str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
|
| 484 | + array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
| 485 | 485 | array_push($result, $entry); |
| 486 | 486 | } |
| 487 | 487 | return $result; |
@@ -556,10 +556,10 @@ discard block |
||
| 556 | 556 | $i = 0; |
| 557 | 557 | $critArray = array(); |
| 558 | 558 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
| 559 | - PageQueryResult::SCOPE_TAG, |
|
| 560 | - PageQueryResult::SCOPE_SERIES, |
|
| 561 | - PageQueryResult::SCOPE_PUBLISHER, |
|
| 562 | - PageQueryResult::SCOPE_BOOK) as $key) { |
|
| 559 | + PageQueryResult::SCOPE_TAG, |
|
| 560 | + PageQueryResult::SCOPE_SERIES, |
|
| 561 | + PageQueryResult::SCOPE_PUBLISHER, |
|
| 562 | + PageQueryResult::SCOPE_BOOK) as $key) { |
|
| 563 | 563 | if (in_array($key, getCurrentOption('ignored_categories')) || |
| 564 | 564 | (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { |
| 565 | 565 | $critArray[$i] = self::BAD_SEARCH; |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | public $seriesIndex; |
| 102 | 102 | public $comment; |
| 103 | 103 | public $rating; |
| 104 | - public $datas = NULL; |
|
| 105 | - public $authors = NULL; |
|
| 106 | - public $publisher = NULL; |
|
| 107 | - public $serie = NULL; |
|
| 108 | - public $tags = NULL; |
|
| 109 | - public $identifiers = NULL; |
|
| 110 | - public $languages = NULL; |
|
| 104 | + public $datas = null; |
|
| 105 | + public $authors = null; |
|
| 106 | + public $publisher = null; |
|
| 107 | + public $serie = null; |
|
| 108 | + public $tags = null; |
|
| 109 | + public $identifiers = null; |
|
| 110 | + public $languages = null; |
|
| 111 | 111 | public $format = array (); |
| 112 | 112 | |
| 113 | 113 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | /* End of other class (author, series, tag, ...) initialization and accessors */ |
| 268 | 268 | |
| 269 | 269 | public static function getFilterString() { |
| 270 | - $filter = getURLParam('tag', NULL); |
|
| 270 | + $filter = getURLParam('tag', null); |
|
| 271 | 271 | if (empty($filter)) return ''; |
| 272 | 272 | |
| 273 | 273 | $exists = true; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $bestFormatForKindle = array('EPUB', 'PDF', 'AZW3', 'MOBI'); |
| 291 | 291 | $bestRank = -1; |
| 292 | - $bestData = NULL; |
|
| 292 | + $bestData = null; |
|
| 293 | 293 | foreach ($this->getDatas() as $data) { |
| 294 | 294 | $key = array_search($data->format, $bestFormatForKindle); |
| 295 | 295 | if ($key !== false && $key > $bestRank) { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | return reset($reduced); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - public function getFilePath($extension, $idData = NULL, $relative = false) |
|
| 359 | + public function getFilePath($extension, $idData = null, $relative = false) |
|
| 360 | 360 | { |
| 361 | 361 | if ($extension == 'jpg') |
| 362 | 362 | { |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | else |
| 366 | 366 | { |
| 367 | 367 | $data = $this->getDataById($idData); |
| 368 | - if (!$data) return NULL; |
|
| 368 | + if (!$data) return null; |
|
| 369 | 369 | $file = $data->name . '.' . strtolower($data->format); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - public function getThumbnail($width, $height, $outputfile = NULL) { |
|
| 420 | + public function getThumbnail($width, $height, $outputfile = null) { |
|
| 421 | 421 | if (is_null($width) && is_null($height)) { |
| 422 | 422 | return false; |
| 423 | 423 | } |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if ($this->hasCover) |
| 460 | 460 | { |
| 461 | - array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
| 461 | + array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', null)); |
|
| 462 | 462 | |
| 463 | - array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
|
| 463 | + array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', null)); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | foreach ($this->getDatas() as $data) |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | $this->getLinkArray(), $this); |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - public static function getBookCount($database = NULL) { |
|
| 494 | + public static function getBookCount($database = null) { |
|
| 495 | 495 | return parent::executeQuerySingle('select count(*) from books', $database); |
| 496 | 496 | } |
| 497 | 497 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | $book = new Book($post); |
| 561 | 561 | return $book; |
| 562 | 562 | } |
| 563 | - return NULL; |
|
| 563 | + return null; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | public static function getBookByDataId($dataId) { |
@@ -576,10 +576,10 @@ discard block |
||
| 576 | 576 | $book->datas = array($data); |
| 577 | 577 | return $book; |
| 578 | 578 | } |
| 579 | - return NULL; |
|
| 579 | + return null; |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 582 | + public static function getBooksByQuery($query, $n, $database = null, $numberPerPage = null) { |
|
| 583 | 583 | $i = 0; |
| 584 | 584 | $critArray = array(); |
| 585 | 585 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
@@ -626,11 +626,11 @@ discard block |
||
| 626 | 626 | return $entryArray; |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | - public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 629 | + public static function getBooksByStartingLetter($letter, $n, $database = null, $numberPerPage = null) { |
|
| 630 | 630 | return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage); |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 633 | + public static function getEntryArray($query, $params, $n, $database = null, $numberPerPage = null) { |
|
| 634 | 634 | /* @var $totalNumber integer */ |
| 635 | 635 | /* @var $result PDOStatement */ |
| 636 | 636 | list($totalNumber, $result) = parent::executeQuery($query, self::BOOK_COLUMNS, self::getFilterString(), $params, $n, $database, $numberPerPage); |
@@ -7,55 +7,55 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Silly thing because PHP forbid string concatenation in class const |
| 10 | -define ('SQL_BOOKS_LEFT_JOIN', 'left outer join comments on comments.book = books.id |
|
| 10 | +define('SQL_BOOKS_LEFT_JOIN', 'left outer join comments on comments.book = books.id |
|
| 11 | 11 | left outer join books_ratings_link on books_ratings_link.book = books.id |
| 12 | 12 | left outer join ratings on books_ratings_link.rating = ratings.id '); |
| 13 | -define ('SQL_BOOKS_ALL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' order by books.sort '); |
|
| 14 | -define ('SQL_BOOKS_BY_PUBLISHER', 'select {0} from books_publishers_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 13 | +define('SQL_BOOKS_ALL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' order by books.sort '); |
|
| 14 | +define('SQL_BOOKS_BY_PUBLISHER', 'select {0} from books_publishers_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 15 | 15 | where books_publishers_link.book = books.id and publisher = ? {1} order by publisher'); |
| 16 | -define ('SQL_BOOKS_BY_FIRST_LETTER', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 16 | +define('SQL_BOOKS_BY_FIRST_LETTER', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 17 | 17 | where upper (books.sort) like ? order by books.sort'); |
| 18 | -define ('SQL_BOOKS_BY_AUTHOR', 'select {0} from books_authors_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 18 | +define('SQL_BOOKS_BY_AUTHOR', 'select {0} from books_authors_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 19 | 19 | left outer join books_series_link on books_series_link.book = books.id |
| 20 | 20 | where books_authors_link.book = books.id and author = ? {1} order by series desc, series_index asc, pubdate asc'); |
| 21 | -define ('SQL_BOOKS_BY_SERIE', 'select {0} from books_series_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 21 | +define('SQL_BOOKS_BY_SERIE', 'select {0} from books_series_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 22 | 22 | where books_series_link.book = books.id and series = ? {1} order by series_index'); |
| 23 | -define ('SQL_BOOKS_BY_TAG', 'select {0} from books_tags_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 23 | +define('SQL_BOOKS_BY_TAG', 'select {0} from books_tags_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 24 | 24 | where books_tags_link.book = books.id and tag = ? {1} order by sort'); |
| 25 | -define ('SQL_BOOKS_BY_LANGUAGE', 'select {0} from books_languages_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 25 | +define('SQL_BOOKS_BY_LANGUAGE', 'select {0} from books_languages_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 26 | 26 | where books_languages_link.book = books.id and lang_code = ? {1} order by sort'); |
| 27 | -define ('SQL_BOOKS_BY_CUSTOM', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 27 | +define('SQL_BOOKS_BY_CUSTOM', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 28 | 28 | where {2}.book = books.id and {2}.{3} = ? {1} order by sort'); |
| 29 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_TRUE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 29 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_TRUE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 30 | 30 | where {2}.book = books.id and {2}.value = 1 {1} order by sort'); |
| 31 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_FALSE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 31 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_FALSE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 32 | 32 | where {2}.book = books.id and {2}.value = 0 {1} order by sort'); |
| 33 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 33 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 34 | 34 | where books.id not in (select book from {2}) {1} order by sort'); |
| 35 | -define ('SQL_BOOKS_BY_CUSTOM_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 35 | +define('SQL_BOOKS_BY_CUSTOM_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 36 | 36 | left join {2} on {2}.book = books.id |
| 37 | 37 | left join {3} on {3}.id = {2}.{4} |
| 38 | 38 | where {3}.value = ? order by sort'); |
| 39 | -define ('SQL_BOOKS_BY_CUSTOM_RATING_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 39 | +define('SQL_BOOKS_BY_CUSTOM_RATING_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 40 | 40 | left join {2} on {2}.book = books.id |
| 41 | 41 | left join {3} on {3}.id = {2}.{4} |
| 42 | 42 | where ((books.id not in (select {2}.book from {2})) or ({3}.value = 0)) {1} order by sort'); |
| 43 | -define ('SQL_BOOKS_BY_CUSTOM_DATE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 43 | +define('SQL_BOOKS_BY_CUSTOM_DATE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 44 | 44 | where {2}.book = books.id and date({2}.value) = ? {1} order by sort'); |
| 45 | -define ('SQL_BOOKS_BY_CUSTOM_DIRECT', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 45 | +define('SQL_BOOKS_BY_CUSTOM_DIRECT', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 46 | 46 | where {2}.book = books.id and {2}.value = ? {1} order by sort'); |
| 47 | -define ('SQL_BOOKS_BY_CUSTOM_DIRECT_ID', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 47 | +define('SQL_BOOKS_BY_CUSTOM_DIRECT_ID', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 48 | 48 | where {2}.book = books.id and {2}.id = ? {1} order by sort'); |
| 49 | -define ('SQL_BOOKS_QUERY', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 49 | +define('SQL_BOOKS_QUERY', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 50 | 50 | where ( |
| 51 | 51 | exists (select null from authors, books_authors_link where book = books.id and author = authors.id and authors.name like ?) or |
| 52 | 52 | exists (select null from tags, books_tags_link where book = books.id and tag = tags.id and tags.name like ?) or |
| 53 | 53 | exists (select null from series, books_series_link on book = books.id and books_series_link.series = series.id and series.name like ?) or |
| 54 | 54 | exists (select null from publishers, books_publishers_link where book = books.id and books_publishers_link.publisher = publishers.id and publishers.name like ?) or |
| 55 | 55 | title like ?) {1} order by books.sort'); |
| 56 | -define ('SQL_BOOKS_RECENT', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 56 | +define('SQL_BOOKS_RECENT', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 57 | 57 | where 1=1 {1} order by timestamp desc limit '); |
| 58 | -define ('SQL_BOOKS_BY_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 58 | +define('SQL_BOOKS_BY_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 59 | 59 | where books_ratings_link.book = books.id and ratings.id = ? {1} order by sort'); |
| 60 | 60 | |
| 61 | 61 | require('Identifier.php'); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | public $tags = NULL; |
| 109 | 109 | public $identifiers = NULL; |
| 110 | 110 | public $languages = NULL; |
| 111 | - public $format = array (); |
|
| 111 | + public $format = array(); |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | public function __construct($line) { |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function getEntryId() { |
| 133 | - return self::ALL_BOOKS_UUID.':'.$this->uuid; |
|
| 133 | + return self::ALL_BOOKS_UUID . ':' . $this->uuid; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - public static function getEntryIdByLetter ($startingLetter) { |
|
| 137 | - return self::ALL_BOOKS_ID.':letter:'.$startingLetter; |
|
| 136 | + public static function getEntryIdByLetter($startingLetter) { |
|
| 137 | + return self::ALL_BOOKS_ID . ':letter:' . $startingLetter; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - public function getUri () { |
|
| 141 | - return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id; |
|
| 140 | + public function getUri() { |
|
| 141 | + return '?page=' . parent::PAGE_BOOK_DETAIL . '&id=' . $this->id; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function getDetailUrl () { |
|
| 144 | + public function getDetailUrl() { |
|
| 145 | 145 | $urlParam = $this->getUri(); |
| 146 | - if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
| 146 | + if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam(DB)); |
|
| 147 | 147 | return 'index.php' . $urlParam; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - public function getTitle () { |
|
| 150 | + public function getTitle() { |
|
| 151 | 151 | return $this->title; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,22 +156,22 @@ discard block |
||
| 156 | 156 | /** |
| 157 | 157 | * @return Author[] |
| 158 | 158 | */ |
| 159 | - public function getAuthors () { |
|
| 159 | + public function getAuthors() { |
|
| 160 | 160 | if (is_null($this->authors)) { |
| 161 | 161 | $this->authors = Author::getAuthorByBookId($this->id); |
| 162 | 162 | } |
| 163 | 163 | return $this->authors; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - public function getAuthorsName () { |
|
| 167 | - return implode(', ', array_map(function ($author) { return $author->name; }, $this->getAuthors())); |
|
| 166 | + public function getAuthorsName() { |
|
| 167 | + return implode(', ', array_map(function($author) { return $author->name; }, $this->getAuthors())); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function getAuthorsSort () { |
|
| 171 | - return implode(', ', array_map(function ($author) { return $author->sort; }, $this->getAuthors())); |
|
| 170 | + public function getAuthorsSort() { |
|
| 171 | + return implode(', ', array_map(function($author) { return $author->sort; }, $this->getAuthors())); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function getPublisher () { |
|
| 174 | + public function getPublisher() { |
|
| 175 | 175 | if (is_null($this->publisher)) { |
| 176 | 176 | $this->publisher = Publisher::getPublisherByBookId($this->id); |
| 177 | 177 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @return Tag[] |
| 211 | 211 | */ |
| 212 | 212 | public function getTags() { |
| 213 | - if (is_null ($this->tags)) { |
|
| 213 | + if (is_null($this->tags)) { |
|
| 214 | 214 | $this->tags = array(); |
| 215 | 215 | |
| 216 | 216 | $result = parent::getDb()->prepare('select tags.id as id, name |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | public function getTagsName() { |
| 231 | - return implode(', ', array_map(function ($tag) { return $tag->name; }, $this->getTags())); |
|
| 231 | + return implode(', ', array_map(function($tag) { return $tag->name; }, $this->getTags())); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @return Identifiers[] |
| 237 | 237 | */ |
| 238 | 238 | public function getIdentifiers() { |
| 239 | - if (is_null ($this->identifiers)) { |
|
| 239 | + if (is_null($this->identifiers)) { |
|
| 240 | 240 | $this->identifiers = array(); |
| 241 | 241 | |
| 242 | 242 | $result = parent::getDb()->prepare('select type, val, id |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | public function getDataById($idData) |
| 304 | 304 | { |
| 305 | - $reduced = array_filter($this->getDatas(), function ($data) use ($idData) { |
|
| 305 | + $reduced = array_filter($this->getDatas(), function($data) use ($idData) { |
|
| 306 | 306 | return $data->id == $idData; |
| 307 | 307 | }); |
| 308 | 308 | 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 | } |
@@ -335,15 +335,15 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | public function getComment($withSerie = true) { |
| 337 | 337 | $addition = ''; |
| 338 | - $se = $this->getSerie (); |
|
| 339 | - if (!is_null ($se) && $withSerie) { |
|
| 338 | + $se = $this->getSerie(); |
|
| 339 | + if (!is_null($se) && $withSerie) { |
|
| 340 | 340 | $addition = $addition . '<strong>' . localize('content.series') . '</strong>' . str_format(localize('content.series.data'), $this->seriesIndex, htmlspecialchars($se->name)) . "<br />\n"; |
| 341 | 341 | } |
| 342 | 342 | return $addition . html2xhtml($this->comment); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | public function getDataFormat($format) { |
| 346 | - $reduced = array_filter($this->getDatas(), function ($data) use ($format) { |
|
| 346 | + $reduced = array_filter($this->getDatas(), function($data) use ($format) { |
|
| 347 | 347 | return $data->format == $format; |
| 348 | 348 | }); |
| 349 | 349 | return reset($reduced); |
@@ -364,11 +364,11 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | if ($relative) |
| 366 | 366 | { |
| 367 | - return $this->relativePath.'/'.$file; |
|
| 367 | + return $this->relativePath . '/' . $file; |
|
| 368 | 368 | } |
| 369 | 369 | else |
| 370 | 370 | { |
| 371 | - return $this->path.'/'.$file; |
|
| 371 | + return $this->path . '/' . $file; |
|
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | $epub->Authors($authorArray); |
| 390 | 390 | $epub->Language($this->getLanguages()); |
| 391 | - $epub->Description ($this->getComment(false)); |
|
| 391 | + $epub->Description($this->getComment(false)); |
|
| 392 | 392 | $epub->Subjects($this->getTagsName()); |
| 393 | 393 | $epub->Cover2($this->getFilePath('jpg'), 'image/jpeg'); |
| 394 | 394 | $epub->Calibre($this->uuid); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $epub->SerieIndex($this->seriesIndex); |
| 399 | 399 | } |
| 400 | 400 | $filename = $data->getUpdatedFilenameEpub(); |
| 401 | - if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
| 401 | + if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
| 402 | 402 | $epub->updateForKepub(); |
| 403 | 403 | $filename = $data->getUpdatedFilenameKepub(); |
| 404 | 404 | } |
@@ -424,11 +424,11 @@ discard block |
||
| 424 | 424 | if (!is_null($width)) { |
| 425 | 425 | $nw = $width; |
| 426 | 426 | if ($nw >= $w) { return false; } |
| 427 | - $nh = ($nw*$h)/$w; |
|
| 427 | + $nh = ($nw * $h) / $w; |
|
| 428 | 428 | } else { |
| 429 | 429 | $nh = $height; |
| 430 | 430 | if ($nh >= $h) { return false; } |
| 431 | - $nw = ($nh*$w)/$h; |
|
| 431 | + $nw = ($nh * $w) / $h; |
|
| 432 | 432 | } |
| 433 | 433 | } else { |
| 434 | 434 | return false; |
@@ -436,16 +436,16 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | //draw the image |
| 438 | 438 | $src_img = imagecreatefromjpeg($file); |
| 439 | - $dst_img = imagecreatetruecolor($nw,$nh); |
|
| 440 | - imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h);//resizing the image |
|
| 441 | - imagejpeg($dst_img,$outputfile,80); |
|
| 439 | + $dst_img = imagecreatetruecolor($nw, $nh); |
|
| 440 | + imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h); //resizing the image |
|
| 441 | + imagejpeg($dst_img, $outputfile, 80); |
|
| 442 | 442 | imagedestroy($src_img); |
| 443 | 443 | imagedestroy($dst_img); |
| 444 | 444 | |
| 445 | 445 | return true; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - public function getLinkArray () |
|
| 448 | + public function getLinkArray() |
|
| 449 | 449 | { |
| 450 | 450 | $linkArray = array(); |
| 451 | 451 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | $serie = $this->getSerie(); |
| 473 | - if (!is_null ($serie)) { |
|
| 473 | + if (!is_null($serie)) { |
|
| 474 | 474 | array_push($linkArray, new LinkNavigation($serie->getUri(), 'related', str_format(localize('content.series.data'), $this->seriesIndex, $serie->name))); |
| 475 | 475 | } |
| 476 | 476 | |
@@ -495,13 +495,13 @@ discard block |
||
| 495 | 495 | $entry = new Entry(localize('allbooks.title'), |
| 496 | 496 | self::ALL_BOOKS_ID, |
| 497 | 497 | str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
| 498 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
| 498 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
| 499 | 499 | array_push($result, $entry); |
| 500 | 500 | if ($config['cops_recentbooks_limit'] > 0) { |
| 501 | 501 | $entry = new Entry(localize('recent.title'), |
| 502 | 502 | self::ALL_RECENT_BOOKS_ID, |
| 503 | 503 | str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
| 504 | - array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
| 504 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
| 505 | 505 | array_push($result, $entry); |
| 506 | 506 | } |
| 507 | 507 | return $result; |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | public static function getBooks($n) { |
| 600 | - list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL , array (), $n); |
|
| 600 | + list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL, array(), $n); |
|
| 601 | 601 | return array($entryArray, $totalNumber); |
| 602 | 602 | } |
| 603 | 603 | |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | { |
| 615 | 615 | array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title), |
| 616 | 616 | str_format(localize('bookword', $post->count), $post->count), 'text', |
| 617 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count)); |
|
| 617 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS_LETTER . '&id=' . rawurlencode($post->title))), '', $post->count)); |
|
| 618 | 618 | } |
| 619 | 619 | return $entryArray; |
| 620 | 620 | } |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | |
| 640 | 640 | public static function getAllRecentBooks() { |
| 641 | 641 | global $config; |
| 642 | - list ($entryArray, ) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
|
| 642 | + list ($entryArray,) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
|
| 643 | 643 | return $entryArray; |
| 644 | 644 | } |
| 645 | 645 | |
@@ -111,7 +111,8 @@ discard block |
||
| 111 | 111 | public $format = array (); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - public function __construct($line) { |
|
| 114 | + public function __construct($line) |
|
| 115 | + { |
|
| 115 | 116 | $this->id = $line->id; |
| 116 | 117 | $this->title = $line->title; |
| 117 | 118 | $this->timestamp = strtotime($line->timestamp); |
@@ -129,25 +130,32 @@ discard block |
||
| 129 | 130 | $this->rating = $line->rating; |
| 130 | 131 | } |
| 131 | 132 | |
| 132 | - public function getEntryId() { |
|
| 133 | + public function getEntryId() |
|
| 134 | + { |
|
| 133 | 135 | return self::ALL_BOOKS_UUID.':'.$this->uuid; |
| 134 | 136 | } |
| 135 | 137 | |
| 136 | - public static function getEntryIdByLetter ($startingLetter) { |
|
| 138 | + public static function getEntryIdByLetter ($startingLetter) |
|
| 139 | + { |
|
| 137 | 140 | return self::ALL_BOOKS_ID.':letter:'.$startingLetter; |
| 138 | 141 | } |
| 139 | 142 | |
| 140 | - public function getUri () { |
|
| 143 | + public function getUri () |
|
| 144 | + { |
|
| 141 | 145 | return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id; |
| 142 | 146 | } |
| 143 | 147 | |
| 144 | - public function getDetailUrl () { |
|
| 148 | + public function getDetailUrl () |
|
| 149 | + { |
|
| 145 | 150 | $urlParam = $this->getUri(); |
| 146 | - if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
| 151 | + if (!is_null(GetUrlParam(DB))) { |
|
| 152 | + $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
| 153 | + } |
|
| 147 | 154 | return 'index.php' . $urlParam; |
| 148 | 155 | } |
| 149 | 156 | |
| 150 | - public function getTitle () { |
|
| 157 | + public function getTitle () |
|
| 158 | + { |
|
| 151 | 159 | return $this->title; |
| 152 | 160 | } |
| 153 | 161 | |
@@ -156,22 +164,26 @@ discard block |
||
| 156 | 164 | /** |
| 157 | 165 | * @return Author[] |
| 158 | 166 | */ |
| 159 | - public function getAuthors () { |
|
| 167 | + public function getAuthors () |
|
| 168 | + { |
|
| 160 | 169 | if (is_null($this->authors)) { |
| 161 | 170 | $this->authors = Author::getAuthorByBookId($this->id); |
| 162 | 171 | } |
| 163 | 172 | return $this->authors; |
| 164 | 173 | } |
| 165 | 174 | |
| 166 | - public function getAuthorsName () { |
|
| 175 | + public function getAuthorsName () |
|
| 176 | + { |
|
| 167 | 177 | return implode(', ', array_map(function ($author) { return $author->name; }, $this->getAuthors())); |
| 168 | 178 | } |
| 169 | 179 | |
| 170 | - public function getAuthorsSort () { |
|
| 180 | + public function getAuthorsSort () |
|
| 181 | + { |
|
| 171 | 182 | return implode(', ', array_map(function ($author) { return $author->sort; }, $this->getAuthors())); |
| 172 | 183 | } |
| 173 | 184 | |
| 174 | - public function getPublisher () { |
|
| 185 | + public function getPublisher () |
|
| 186 | + { |
|
| 175 | 187 | if (is_null($this->publisher)) { |
| 176 | 188 | $this->publisher = Publisher::getPublisherByBookId($this->id); |
| 177 | 189 | } |
@@ -181,7 +193,8 @@ discard block |
||
| 181 | 193 | /** |
| 182 | 194 | * @return Serie |
| 183 | 195 | */ |
| 184 | - public function getSerie() { |
|
| 196 | + public function getSerie() |
|
| 197 | + { |
|
| 185 | 198 | if (is_null($this->serie)) { |
| 186 | 199 | $this->serie = Serie::getSerieByBookId($this->id); |
| 187 | 200 | } |
@@ -191,7 +204,8 @@ discard block |
||
| 191 | 204 | /** |
| 192 | 205 | * @return string |
| 193 | 206 | */ |
| 194 | - public function getLanguages() { |
|
| 207 | + public function getLanguages() |
|
| 208 | + { |
|
| 195 | 209 | $lang = array(); |
| 196 | 210 | $result = parent::getDb()->prepare('select languages.lang_code |
| 197 | 211 | from books_languages_link, languages |
@@ -199,8 +213,7 @@ discard block |
||
| 199 | 213 | and book = ? |
| 200 | 214 | order by item_order'); |
| 201 | 215 | $result->execute(array($this->id)); |
| 202 | - while ($post = $result->fetchObject()) |
|
| 203 | - { |
|
| 216 | + while ($post = $result->fetchObject()) { |
|
| 204 | 217 | array_push($lang, Language::getLanguageString($post->lang_code)); |
| 205 | 218 | } |
| 206 | 219 | return implode(', ', $lang); |
@@ -209,7 +222,8 @@ discard block |
||
| 209 | 222 | /** |
| 210 | 223 | * @return Tag[] |
| 211 | 224 | */ |
| 212 | - public function getTags() { |
|
| 225 | + public function getTags() |
|
| 226 | + { |
|
| 213 | 227 | if (is_null ($this->tags)) { |
| 214 | 228 | $this->tags = array(); |
| 215 | 229 | |
@@ -219,15 +233,15 @@ discard block |
||
| 219 | 233 | and book = ? |
| 220 | 234 | order by name'); |
| 221 | 235 | $result->execute(array($this->id)); |
| 222 | - while ($post = $result->fetchObject()) |
|
| 223 | - { |
|
| 236 | + while ($post = $result->fetchObject()) { |
|
| 224 | 237 | array_push($this->tags, new Tag($post)); |
| 225 | 238 | } |
| 226 | 239 | } |
| 227 | 240 | return $this->tags; |
| 228 | 241 | } |
| 229 | 242 | |
| 230 | - public function getTagsName() { |
|
| 243 | + public function getTagsName() |
|
| 244 | + { |
|
| 231 | 245 | return implode(', ', array_map(function ($tag) { return $tag->name; }, $this->getTags())); |
| 232 | 246 | } |
| 233 | 247 | |
@@ -235,7 +249,8 @@ discard block |
||
| 235 | 249 | /** |
| 236 | 250 | * @return Identifiers[] |
| 237 | 251 | */ |
| 238 | - public function getIdentifiers() { |
|
| 252 | + public function getIdentifiers() |
|
| 253 | + { |
|
| 239 | 254 | if (is_null ($this->identifiers)) { |
| 240 | 255 | $this->identifiers = array(); |
| 241 | 256 | |
@@ -244,8 +259,7 @@ discard block |
||
| 244 | 259 | where book = ? |
| 245 | 260 | order by type'); |
| 246 | 261 | $result->execute(array($this->id)); |
| 247 | - while ($post = $result->fetchObject()) |
|
| 248 | - { |
|
| 262 | + while ($post = $result->fetchObject()) { |
|
| 249 | 263 | array_push($this->identifiers, new Identifier($post)); |
| 250 | 264 | } |
| 251 | 265 | |
@@ -266,9 +280,12 @@ discard block |
||
| 266 | 280 | |
| 267 | 281 | /* End of other class (author, series, tag, ...) initialization and accessors */ |
| 268 | 282 | |
| 269 | - public static function getFilterString() { |
|
| 283 | + public static function getFilterString() |
|
| 284 | + { |
|
| 270 | 285 | $filter = getURLParam('tag', NULL); |
| 271 | - if (empty($filter)) return ''; |
|
| 286 | + if (empty($filter)) { |
|
| 287 | + return ''; |
|
| 288 | + } |
|
| 272 | 289 | |
| 273 | 290 | $exists = true; |
| 274 | 291 | if (preg_match("/^!(.*)$/", $filter, $matches)) { |
@@ -308,7 +325,8 @@ discard block |
||
| 308 | 325 | return reset($reduced); |
| 309 | 326 | } |
| 310 | 327 | |
| 311 | - public function getRating() { |
|
| 328 | + public function getRating() |
|
| 329 | + { |
|
| 312 | 330 | if (is_null($this->rating) || $this->rating == 0) { |
| 313 | 331 | return ''; |
| 314 | 332 | } |
@@ -322,7 +340,8 @@ discard block |
||
| 322 | 340 | return $retour; |
| 323 | 341 | } |
| 324 | 342 | |
| 325 | - public function getPubDate() { |
|
| 343 | + public function getPubDate() |
|
| 344 | + { |
|
| 326 | 345 | if (empty ($this->pubdate)) { |
| 327 | 346 | return ''; |
| 328 | 347 | } |
@@ -333,7 +352,8 @@ discard block |
||
| 333 | 352 | return ''; |
| 334 | 353 | } |
| 335 | 354 | |
| 336 | - public function getComment($withSerie = true) { |
|
| 355 | + public function getComment($withSerie = true) |
|
| 356 | + { |
|
| 337 | 357 | $addition = ''; |
| 338 | 358 | $se = $this->getSerie (); |
| 339 | 359 | if (!is_null ($se) && $withSerie) { |
@@ -342,7 +362,8 @@ discard block |
||
| 342 | 362 | return $addition . html2xhtml($this->comment); |
| 343 | 363 | } |
| 344 | 364 | |
| 345 | - public function getDataFormat($format) { |
|
| 365 | + public function getDataFormat($format) |
|
| 366 | + { |
|
| 346 | 367 | $reduced = array_filter($this->getDatas(), function ($data) use ($format) { |
| 347 | 368 | return $data->format == $format; |
| 348 | 369 | }); |
@@ -351,23 +372,19 @@ discard block |
||
| 351 | 372 | |
| 352 | 373 | public function getFilePath($extension, $idData = NULL, $relative = false) |
| 353 | 374 | { |
| 354 | - if ($extension == 'jpg') |
|
| 355 | - { |
|
| 375 | + if ($extension == 'jpg') { |
|
| 356 | 376 | $file = 'cover.jpg'; |
| 357 | - } |
|
| 358 | - else |
|
| 359 | - { |
|
| 377 | + } else { |
|
| 360 | 378 | $data = $this->getDataById($idData); |
| 361 | - if (!$data) return NULL; |
|
| 379 | + if (!$data) { |
|
| 380 | + return NULL; |
|
| 381 | + } |
|
| 362 | 382 | $file = $data->name . '.' . strtolower($data->format); |
| 363 | 383 | } |
| 364 | 384 | |
| 365 | - if ($relative) |
|
| 366 | - { |
|
| 385 | + if ($relative) { |
|
| 367 | 386 | return $this->relativePath.'/'.$file; |
| 368 | - } |
|
| 369 | - else |
|
| 370 | - { |
|
| 387 | + } else { |
|
| 371 | 388 | return $this->path.'/'.$file; |
| 372 | 389 | } |
| 373 | 390 | } |
@@ -377,8 +394,7 @@ discard block |
||
| 377 | 394 | global $config; |
| 378 | 395 | $data = $this->getDataById($idData); |
| 379 | 396 | |
| 380 | - try |
|
| 381 | - { |
|
| 397 | + try { |
|
| 382 | 398 | $epub = new EPub($data->getLocalPath()); |
| 383 | 399 | |
| 384 | 400 | $epub->Title($this->title); |
@@ -403,14 +419,13 @@ discard block |
||
| 403 | 419 | $filename = $data->getUpdatedFilenameKepub(); |
| 404 | 420 | } |
| 405 | 421 | $epub->download($filename); |
| 406 | - } |
|
| 407 | - catch (Exception $e) |
|
| 408 | - { |
|
| 422 | + } catch (Exception $e) { |
|
| 409 | 423 | echo 'Exception : ' . $e->getMessage(); |
| 410 | 424 | } |
| 411 | 425 | } |
| 412 | 426 | |
| 413 | - public function getThumbnail($width, $height, $outputfile = NULL) { |
|
| 427 | + public function getThumbnail($width, $height, $outputfile = NULL) |
|
| 428 | + { |
|
| 414 | 429 | if (is_null($width) && is_null($height)) { |
| 415 | 430 | return false; |
| 416 | 431 | } |
@@ -449,17 +464,14 @@ discard block |
||
| 449 | 464 | { |
| 450 | 465 | $linkArray = array(); |
| 451 | 466 | |
| 452 | - if ($this->hasCover) |
|
| 453 | - { |
|
| 467 | + if ($this->hasCover) { |
|
| 454 | 468 | array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
| 455 | 469 | |
| 456 | 470 | array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
| 457 | 471 | } |
| 458 | 472 | |
| 459 | - foreach ($this->getDatas() as $data) |
|
| 460 | - { |
|
| 461 | - if ($data->isKnownType()) |
|
| 462 | - { |
|
| 473 | + foreach ($this->getDatas() as $data) { |
|
| 474 | + if ($data->isKnownType()) { |
|
| 463 | 475 | array_push($linkArray, $data->getDataLink(Link::OPDS_ACQUISITION_TYPE, $data->format)); |
| 464 | 476 | } |
| 465 | 477 | } |
@@ -478,17 +490,20 @@ discard block |
||
| 478 | 490 | } |
| 479 | 491 | |
| 480 | 492 | |
| 481 | - public function getEntry() { |
|
| 493 | + public function getEntry() |
|
| 494 | + { |
|
| 482 | 495 | return new EntryBook($this->getTitle(), $this->getEntryId(), |
| 483 | 496 | $this->getComment(), 'text/html', |
| 484 | 497 | $this->getLinkArray(), $this); |
| 485 | 498 | } |
| 486 | 499 | |
| 487 | - public static function getBookCount($database = NULL) { |
|
| 500 | + public static function getBookCount($database = NULL) |
|
| 501 | + { |
|
| 488 | 502 | return parent::executeQuerySingle('select count(*) from books', $database); |
| 489 | 503 | } |
| 490 | 504 | |
| 491 | - public static function getCount() { |
|
| 505 | + public static function getCount() |
|
| 506 | + { |
|
| 492 | 507 | global $config; |
| 493 | 508 | $nBooks = parent::executeQuerySingle('select count(*) from books'); |
| 494 | 509 | $result = array(); |
@@ -507,27 +522,33 @@ discard block |
||
| 507 | 522 | return $result; |
| 508 | 523 | } |
| 509 | 524 | |
| 510 | - public static function getBooksByAuthor($authorId, $n) { |
|
| 525 | + public static function getBooksByAuthor($authorId, $n) |
|
| 526 | + { |
|
| 511 | 527 | return self::getEntryArray(self::SQL_BOOKS_BY_AUTHOR, array($authorId), $n); |
| 512 | 528 | } |
| 513 | 529 | |
| 514 | - public static function getBooksByRating($ratingId, $n) { |
|
| 530 | + public static function getBooksByRating($ratingId, $n) |
|
| 531 | + { |
|
| 515 | 532 | return self::getEntryArray(self::SQL_BOOKS_BY_RATING, array($ratingId), $n); |
| 516 | 533 | } |
| 517 | 534 | |
| 518 | - public static function getBooksByPublisher($publisherId, $n) { |
|
| 535 | + public static function getBooksByPublisher($publisherId, $n) |
|
| 536 | + { |
|
| 519 | 537 | return self::getEntryArray(self::SQL_BOOKS_BY_PUBLISHER, array($publisherId), $n); |
| 520 | 538 | } |
| 521 | 539 | |
| 522 | - public static function getBooksBySeries($serieId, $n) { |
|
| 540 | + public static function getBooksBySeries($serieId, $n) |
|
| 541 | + { |
|
| 523 | 542 | return self::getEntryArray(self::SQL_BOOKS_BY_SERIE, array($serieId), $n); |
| 524 | 543 | } |
| 525 | 544 | |
| 526 | - public static function getBooksByTag($tagId, $n) { |
|
| 545 | + public static function getBooksByTag($tagId, $n) |
|
| 546 | + { |
|
| 527 | 547 | return self::getEntryArray(self::SQL_BOOKS_BY_TAG, array($tagId), $n); |
| 528 | 548 | } |
| 529 | 549 | |
| 530 | - public static function getBooksByLanguage($languageId, $n) { |
|
| 550 | + public static function getBooksByLanguage($languageId, $n) |
|
| 551 | + { |
|
| 531 | 552 | return self::getEntryArray(self::SQL_BOOKS_BY_LANGUAGE, array($languageId), $n); |
| 532 | 553 | } |
| 533 | 554 | |
@@ -537,32 +558,33 @@ discard block |
||
| 537 | 558 | * @param $n integer |
| 538 | 559 | * @return array |
| 539 | 560 | */ |
| 540 | - public static function getBooksByCustom($customColumn, $id, $n) { |
|
| 561 | + public static function getBooksByCustom($customColumn, $id, $n) |
|
| 562 | + { |
|
| 541 | 563 | list($query, $params) = $customColumn->getQuery($id); |
| 542 | 564 | |
| 543 | 565 | return self::getEntryArray($query, $params, $n); |
| 544 | 566 | } |
| 545 | 567 | |
| 546 | - public static function getBookById($bookId) { |
|
| 568 | + public static function getBookById($bookId) |
|
| 569 | + { |
|
| 547 | 570 | $result = parent::getDb()->prepare('select ' . self::BOOK_COLUMNS . ' |
| 548 | 571 | from books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
| 549 | 572 | where books.id = ?'); |
| 550 | 573 | $result->execute(array($bookId)); |
| 551 | - while ($post = $result->fetchObject()) |
|
| 552 | - { |
|
| 574 | + while ($post = $result->fetchObject()) { |
|
| 553 | 575 | $book = new Book($post); |
| 554 | 576 | return $book; |
| 555 | 577 | } |
| 556 | 578 | return NULL; |
| 557 | 579 | } |
| 558 | 580 | |
| 559 | - public static function getBookByDataId($dataId) { |
|
| 581 | + public static function getBookByDataId($dataId) |
|
| 582 | + { |
|
| 560 | 583 | $result = parent::getDb()->prepare('select ' . self::BOOK_COLUMNS . ', data.name, data.format |
| 561 | 584 | from data, books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
| 562 | 585 | where data.book = books.id and data.id = ?'); |
| 563 | 586 | $result->execute(array($dataId)); |
| 564 | - while ($post = $result->fetchObject()) |
|
| 565 | - { |
|
| 587 | + while ($post = $result->fetchObject()) { |
|
| 566 | 588 | $book = new Book($post); |
| 567 | 589 | $data = new Data($post, $book); |
| 568 | 590 | $data->id = $dataId; |
@@ -572,7 +594,8 @@ discard block |
||
| 572 | 594 | return NULL; |
| 573 | 595 | } |
| 574 | 596 | |
| 575 | - public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 597 | + public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) |
|
| 598 | + { |
|
| 576 | 599 | $i = 0; |
| 577 | 600 | $critArray = array(); |
| 578 | 601 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
@@ -583,8 +606,7 @@ discard block |
||
| 583 | 606 | if (in_array($key, getCurrentOption('ignored_categories')) || |
| 584 | 607 | (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { |
| 585 | 608 | $critArray[$i] = self::BAD_SEARCH; |
| 586 | - } |
|
| 587 | - else { |
|
| 609 | + } else { |
|
| 588 | 610 | if (array_key_exists($key, $query)) { |
| 589 | 611 | $critArray[$i] = $query[$key]; |
| 590 | 612 | } else { |
@@ -596,12 +618,14 @@ discard block |
||
| 596 | 618 | return self::getEntryArray(self::SQL_BOOKS_QUERY, $critArray, $n, $database, $numberPerPage); |
| 597 | 619 | } |
| 598 | 620 | |
| 599 | - public static function getBooks($n) { |
|
| 621 | + public static function getBooks($n) |
|
| 622 | + { |
|
| 600 | 623 | list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL , array (), $n); |
| 601 | 624 | return array($entryArray, $totalNumber); |
| 602 | 625 | } |
| 603 | 626 | |
| 604 | - public static function getAllBooks() { |
|
| 627 | + public static function getAllBooks() |
|
| 628 | + { |
|
| 605 | 629 | /* @var $result PDOStatement */ |
| 606 | 630 | |
| 607 | 631 | list (, $result) = parent::executeQuery('select {0} |
@@ -610,8 +634,7 @@ discard block |
||
| 610 | 634 | order by substr (upper (sort), 1, 1)', 'substr (upper (sort), 1, 1) as title, count(*) as count', self::getFilterString(), array(), -1); |
| 611 | 635 | |
| 612 | 636 | $entryArray = array(); |
| 613 | - while ($post = $result->fetchObject()) |
|
| 614 | - { |
|
| 637 | + while ($post = $result->fetchObject()) { |
|
| 615 | 638 | array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title), |
| 616 | 639 | str_format(localize('bookword', $post->count), $post->count), 'text', |
| 617 | 640 | array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count)); |
@@ -619,25 +642,27 @@ discard block |
||
| 619 | 642 | return $entryArray; |
| 620 | 643 | } |
| 621 | 644 | |
| 622 | - public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 645 | + public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) |
|
| 646 | + { |
|
| 623 | 647 | return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage); |
| 624 | 648 | } |
| 625 | 649 | |
| 626 | - public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 650 | + public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) |
|
| 651 | + { |
|
| 627 | 652 | /* @var $totalNumber integer */ |
| 628 | 653 | /* @var $result PDOStatement */ |
| 629 | 654 | list($totalNumber, $result) = parent::executeQuery($query, self::BOOK_COLUMNS, self::getFilterString(), $params, $n, $database, $numberPerPage); |
| 630 | 655 | |
| 631 | 656 | $entryArray = array(); |
| 632 | - while ($post = $result->fetchObject()) |
|
| 633 | - { |
|
| 657 | + while ($post = $result->fetchObject()) { |
|
| 634 | 658 | $book = new Book($post); |
| 635 | 659 | array_push($entryArray, $book->getEntry()); |
| 636 | 660 | } |
| 637 | 661 | return array($entryArray, $totalNumber); |
| 638 | 662 | } |
| 639 | 663 | |
| 640 | - public static function getAllRecentBooks() { |
|
| 664 | + public static function getAllRecentBooks() |
|
| 665 | + { |
|
| 641 | 666 | global $config; |
| 642 | 667 | list ($entryArray, ) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
| 643 | 668 | return $entryArray; |
@@ -649,7 +674,8 @@ discard block |
||
| 649 | 674 | * @param string[] $columns |
| 650 | 675 | * @return CustomColumn[] |
| 651 | 676 | */ |
| 652 | - public function getCustomColumnValues($columns, $asArray = false) { |
|
| 677 | + public function getCustomColumnValues($columns, $asArray = false) |
|
| 678 | + { |
|
| 653 | 679 | $result = array(); |
| 654 | 680 | |
| 655 | 681 | foreach ($columns as $lookup) { |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageSerieDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $serie = Serie::getSerieById ($this->idGet); |
|
| 13 | + $serie = Serie::getSerieById($this->idGet); |
|
| 14 | 14 | $this->title = $serie->name; |
| 15 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksBySeries ($this->idGet, $this->n); |
|
| 16 | - $this->idPage = $serie->getEntryId (); |
|
| 15 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksBySeries($this->idGet, $this->n); |
|
| 16 | + $this->idPage = $serie->getEntryId(); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -20,44 +20,44 @@ |
||
| 20 | 20 | $this->name = $post->name; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function getUri () { |
|
| 24 | - return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id"; |
|
| 23 | + public function getUri() { |
|
| 24 | + return "?page=" . parent::PAGE_TAG_DETAIL . "&id=$this->id"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function getEntryId () { |
|
| 28 | - return self::ALL_TAGS_ID.":".$this->id; |
|
| 27 | + public function getEntryId() { |
|
| 28 | + return self::ALL_TAGS_ID . ":" . $this->id; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function getCount() { |
| 32 | 32 | // str_format (localize("tags.alphabetical", count(array)) |
| 33 | - return parent::getCountGeneric ("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS); |
|
| 33 | + return parent::getCountGeneric("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function getTagById ($tagId) { |
|
| 37 | - $result = parent::getDb ()->prepare('select id, name from tags where id = ?'); |
|
| 38 | - $result->execute (array ($tagId)); |
|
| 39 | - if ($post = $result->fetchObject ()) { |
|
| 40 | - return new Tag ($post); |
|
| 36 | + public static function getTagById($tagId) { |
|
| 37 | + $result = parent::getDb()->prepare('select id, name from tags where id = ?'); |
|
| 38 | + $result->execute(array($tagId)); |
|
| 39 | + if ($post = $result->fetchObject()) { |
|
| 40 | + return new Tag($post); |
|
| 41 | 41 | } |
| 42 | 42 | return NULL; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function getAllTags() { |
| 46 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
|
| 46 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_TAGS, self::TAG_COLUMNS, array(), "Tag"); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
| 50 | - $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
| 50 | + $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
| 51 | 51 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
| 52 | - list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage); |
|
| 52 | + list ($totalNumber, $result) = parent::executeQuery($sql, $columns, "", array('%' . $query . '%'), $n, $database, $numberPerPage); |
|
| 53 | 53 | $entryArray = array(); |
| 54 | - while ($post = $result->fetchObject ()) |
|
| 54 | + while ($post = $result->fetchObject()) |
|
| 55 | 55 | { |
| 56 | - $tag = new Tag ($post); |
|
| 57 | - array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (), |
|
| 58 | - str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 59 | - array ( new LinkNavigation ($tag->getUri ())))); |
|
| 56 | + $tag = new Tag($post); |
|
| 57 | + array_push($entryArray, new Entry($tag->name, $tag->getEntryId(), |
|
| 58 | + str_format(localize("bookword", $post->count), $post->count), "text", |
|
| 59 | + array(new LinkNavigation($tag->getUri())))); |
|
| 60 | 60 | } |
| 61 | - return array ($entryArray, $totalNumber); |
|
| 61 | + return array($entryArray, $totalNumber); |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -15,25 +15,30 @@ discard block |
||
| 15 | 15 | public $id; |
| 16 | 16 | public $name; |
| 17 | 17 | |
| 18 | - public function __construct($post) { |
|
| 18 | + public function __construct($post) |
|
| 19 | + { |
|
| 19 | 20 | $this->id = $post->id; |
| 20 | 21 | $this->name = $post->name; |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | - public function getUri () { |
|
| 24 | + public function getUri () |
|
| 25 | + { |
|
| 24 | 26 | return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id"; |
| 25 | 27 | } |
| 26 | 28 | |
| 27 | - public function getEntryId () { |
|
| 29 | + public function getEntryId () |
|
| 30 | + { |
|
| 28 | 31 | return self::ALL_TAGS_ID.":".$this->id; |
| 29 | 32 | } |
| 30 | 33 | |
| 31 | - public static function getCount() { |
|
| 34 | + public static function getCount() |
|
| 35 | + { |
|
| 32 | 36 | // str_format (localize("tags.alphabetical", count(array)) |
| 33 | 37 | return parent::getCountGeneric ("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS); |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | - public static function getTagById ($tagId) { |
|
| 40 | + public static function getTagById ($tagId) |
|
| 41 | + { |
|
| 37 | 42 | $result = parent::getDb ()->prepare('select id, name from tags where id = ?'); |
| 38 | 43 | $result->execute (array ($tagId)); |
| 39 | 44 | if ($post = $result->fetchObject ()) { |
@@ -42,17 +47,18 @@ discard block |
||
| 42 | 47 | return NULL; |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | - public static function getAllTags() { |
|
| 50 | + public static function getAllTags() |
|
| 51 | + { |
|
| 46 | 52 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
| 47 | 53 | } |
| 48 | 54 | |
| 49 | - public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 55 | + public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) |
|
| 56 | + { |
|
| 50 | 57 | $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
| 51 | 58 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
| 52 | 59 | list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage); |
| 53 | 60 | $entryArray = array(); |
| 54 | - while ($post = $result->fetchObject ()) |
|
| 55 | - { |
|
| 61 | + while ($post = $result->fetchObject ()) { |
|
| 56 | 62 | $tag = new Tag ($post); |
| 57 | 63 | array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (), |
| 58 | 64 | str_format (localize("bookword", $post->count), $post->count), "text", |
@@ -39,14 +39,14 @@ |
||
| 39 | 39 | if ($post = $result->fetchObject ()) { |
| 40 | 40 | return new Tag ($post); |
| 41 | 41 | } |
| 42 | - return NULL; |
|
| 42 | + return null; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function getAllTags() { |
| 46 | 46 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
| 49 | + public static function getAllTagsByQuery($query, $n, $database = null, $numberPerPage = null) { |
|
| 50 | 50 | $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
| 51 | 51 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
| 52 | 52 | list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage); |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | // PHP pre 5.6 does not support const arrays |
| 12 | 12 | private $BOOLEAN_NAMES = array( |
| 13 | 13 | -1 => "customcolumn.boolean.unknown", // localize("customcolumn.boolean.unknown") |
| 14 | - 00 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no") |
|
| 15 | - +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes") |
|
| 14 | + 00 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no") |
|
| 15 | + +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes") |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | protected function __construct($pcustomId) |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $entryArray = array(); |
| 61 | 61 | while ($post = $result->fetchObject()) { |
| 62 | 62 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 63 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
|
| 63 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id))); |
|
| 64 | 64 | |
| 65 | 65 | $entry = new Entry(localize($this->BOOLEAN_NAMES[$post->id]), $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
| 66 | 66 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $query = str_format(Book::SQL_BOOKS_BY_CUSTOM_BOOL_TRUE, "{0}", "{1}", $this->getTableName()); |
| 43 | 43 | return array($query, array()); |
| 44 | 44 | } else { |
| 45 | - return NULL; |
|
| 45 | + return null; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -20,27 +20,27 @@ |
||
| 20 | 20 | * @param Book $pbook |
| 21 | 21 | */ |
| 22 | 22 | public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
| 23 | - parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
|
| 23 | + parent::__construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
|
| 24 | 24 | $this->book = $pbook; |
| 25 | 25 | $this->localUpdated = $pbook->timestamp; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function getCoverThumbnail () { |
|
| 28 | + public function getCoverThumbnail() { |
|
| 29 | 29 | foreach ($this->linkArray as $link) { |
| 30 | 30 | /* @var $link LinkNavigation */ |
| 31 | 31 | |
| 32 | 32 | if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) |
| 33 | - return $link->hrefXhtml (); |
|
| 33 | + return $link->hrefXhtml(); |
|
| 34 | 34 | } |
| 35 | 35 | return null; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getCover () { |
|
| 38 | + public function getCover() { |
|
| 39 | 39 | foreach ($this->linkArray as $link) { |
| 40 | 40 | /* @var $link LinkNavigation */ |
| 41 | 41 | |
| 42 | 42 | if ($link->rel == Link::OPDS_IMAGE_TYPE) |
| 43 | - return $link->hrefXhtml (); |
|
| 43 | + return $link->hrefXhtml(); |
|
| 44 | 44 | } |
| 45 | 45 | return null; |
| 46 | 46 | } |
@@ -19,28 +19,33 @@ |
||
| 19 | 19 | * @param array $plinkArray |
| 20 | 20 | * @param Book $pbook |
| 21 | 21 | */ |
| 22 | - public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
|
| 22 | + public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) |
|
| 23 | + { |
|
| 23 | 24 | parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
| 24 | 25 | $this->book = $pbook; |
| 25 | 26 | $this->localUpdated = $pbook->timestamp; |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | - public function getCoverThumbnail () { |
|
| 29 | + public function getCoverThumbnail () |
|
| 30 | + { |
|
| 29 | 31 | foreach ($this->linkArray as $link) { |
| 30 | 32 | /* @var $link LinkNavigation */ |
| 31 | 33 | |
| 32 | - if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) |
|
| 33 | - return $link->hrefXhtml (); |
|
| 34 | + if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) { |
|
| 35 | + return $link->hrefXhtml (); |
|
| 36 | + } |
|
| 34 | 37 | } |
| 35 | 38 | return null; |
| 36 | 39 | } |
| 37 | 40 | |
| 38 | - public function getCover () { |
|
| 41 | + public function getCover () |
|
| 42 | + { |
|
| 39 | 43 | foreach ($this->linkArray as $link) { |
| 40 | 44 | /* @var $link LinkNavigation */ |
| 41 | 45 | |
| 42 | - if ($link->rel == Link::OPDS_IMAGE_TYPE) |
|
| 43 | - return $link->hrefXhtml (); |
|
| 46 | + if ($link->rel == Link::OPDS_IMAGE_TYPE) { |
|
| 47 | + return $link->hrefXhtml (); |
|
| 48 | + } |
|
| 44 | 49 | } |
| 45 | 50 | return null; |
| 46 | 51 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | while ($post = $result->fetchObject()) |
| 71 | 71 | { |
| 72 | 72 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 73 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
|
| 73 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id))); |
|
| 74 | 74 | |
| 75 | 75 | $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
| 76 | 76 | |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $result = $this->getDb()->query($query); |
| 69 | 69 | $entryArray = array(); |
| 70 | - while ($post = $result->fetchObject()) |
|
| 71 | - { |
|
| 70 | + while ($post = $result->fetchObject()) { |
|
| 72 | 71 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 73 | 72 | $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
| 74 | 73 | |
@@ -82,7 +81,9 @@ discard block |
||
| 82 | 81 | public function getDescription() |
| 83 | 82 | { |
| 84 | 83 | $desc = $this->getDatabaseDescription(); |
| 85 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 84 | + if ($desc === NULL || empty($desc)) { |
|
| 85 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 86 | + } |
|
| 86 | 87 | return $desc; |
| 87 | 88 | } |
| 88 | 89 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if ($post = $result->fetchObject()) { |
| 58 | 58 | return new CustomColumn($id, $post->name, $this); |
| 59 | 59 | } |
| 60 | - return NULL; |
|
| 60 | + return null; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | protected function getAllCustomValuesFromDatabase() |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function getDescription() |
| 83 | 83 | { |
| 84 | 84 | $desc = $this->getDatabaseDescription(); |
| 85 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 85 | + if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 86 | 86 | return $desc; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | if ($post = $result->fetchObject()) { |
| 96 | 96 | return new CustomColumn($post->id, $post->name, $this); |
| 97 | 97 | } |
| 98 | - return new CustomColumn(NULL, "", $this); |
|
| 98 | + return new CustomColumn(null, "", $this); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function isSearchable() |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $result = $this->getDb()->prepare(str_format("SELECT id, value AS name FROM {0} WHERE id = ?", $this->getTableName())); |
| 56 | 56 | $result->execute(array($id)); |
| 57 | 57 | if ($post = $result->fetchObject()) { |
| 58 | - return new CustomColumn ($id, $post->name, $this); |
|
| 58 | + return new CustomColumn($id, $post->name, $this); |
|
| 59 | 59 | } |
| 60 | 60 | return NULL; |
| 61 | 61 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $entryArray = array(); |
| 70 | 70 | while ($post = $result->fetchObject()) { |
| 71 | 71 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 72 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
|
| 72 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id))); |
|
| 73 | 73 | |
| 74 | - $entry = new Entry ($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
|
| 74 | + $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
|
| 75 | 75 | |
| 76 | 76 | array_push($entryArray, $entry); |
| 77 | 77 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if ($post = $result->fetchObject()) { |
| 58 | 58 | return new CustomColumn ($id, $post->name, $this); |
| 59 | 59 | } |
| 60 | - return NULL; |
|
| 60 | + return null; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | protected function getAllCustomValuesFromDatabase() |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($post = $result->fetchObject()) { |
| 93 | 93 | return new CustomColumn($post->id, $post->name, $this); |
| 94 | 94 | } |
| 95 | - return new CustomColumn(NULL, localize("customcolumn.enum.unknown"), $this); |
|
| 95 | + return new CustomColumn(null, localize("customcolumn.enum.unknown"), $this); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function isSearchable() |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageCustomDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $customId = getURLParam ("custom", NULL); |
|
| 14 | - $custom = CustomColumn::createCustom ($customId, $this->idGet); |
|
| 15 | - $this->idPage = $custom->getEntryId (); |
|
| 13 | + $customId = getURLParam("custom", NULL); |
|
| 14 | + $custom = CustomColumn::createCustom($customId, $this->idGet); |
|
| 15 | + $this->idPage = $custom->getEntryId(); |
|
| 16 | 16 | $this->title = $custom->value; |
| 17 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByCustom ($custom, $this->idGet, $this->n); |
|
| 17 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByCustom($custom, $this->idGet, $this->n); |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function InitializeContent () |
| 12 | 12 | { |
| 13 | - $customId = getURLParam ("custom", NULL); |
|
| 13 | + $customId = getURLParam ("custom", null); |
|
| 14 | 14 | $custom = CustomColumn::createCustom ($customId, $this->idGet); |
| 15 | 15 | $this->idPage = $custom->getEntryId (); |
| 16 | 16 | $this->title = $custom->value; |