@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageTagDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $tag = Tag::getTagById ($this->idGet); |
|
| 14 | - $this->idPage = $tag->getEntryId (); |
|
| 13 | + $tag = Tag::getTagById($this->idGet); |
|
| 14 | + $this->idPage = $tag->getEntryId(); |
|
| 15 | 15 | $this->title = $tag->name; |
| 16 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByTag ($this->idGet, $this->n); |
|
| 16 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByTag($this->idGet, $this->n); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -15,33 +15,38 @@ discard block |
||
| 15 | 15 | public $id; |
| 16 | 16 | public $name; |
| 17 | 17 | |
| 18 | - public function __construct($pid, $pname) { |
|
| 18 | + public function __construct($pid, $pname) |
|
| 19 | + { |
|
| 19 | 20 | $this->id = $pid; |
| 20 | 21 | $this->name = $pname; |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | - public function getUri () { |
|
| 24 | + public function getUri () |
|
| 25 | + { |
|
| 24 | 26 | return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id"; |
| 25 | 27 | } |
| 26 | 28 | |
| 27 | - public function getEntryId () { |
|
| 29 | + public function getEntryId () |
|
| 30 | + { |
|
| 28 | 31 | return self::ALL_RATING_ID.":".$this->id; |
| 29 | 32 | } |
| 30 | 33 | |
| 31 | - public static function getCount() { |
|
| 34 | + public static function getCount() |
|
| 35 | + { |
|
| 32 | 36 | // str_format (localize("ratings", count(array)) |
| 33 | 37 | return parent::getCountGeneric ("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings"); |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | - public static function getAllRatings() { |
|
| 40 | + public static function getAllRatings() |
|
| 41 | + { |
|
| 37 | 42 | return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); |
| 38 | 43 | } |
| 39 | 44 | |
| 40 | - public static function getEntryArray ($query, $params) { |
|
| 45 | + public static function getEntryArray ($query, $params) |
|
| 46 | + { |
|
| 41 | 47 | list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); |
| 42 | 48 | $entryArray = array(); |
| 43 | - while ($post = $result->fetchObject ()) |
|
| 44 | - { |
|
| 49 | + while ($post = $result->fetchObject ()) { |
|
| 45 | 50 | $ratingObj = new Rating ($post->id, $post->rating); |
| 46 | 51 | $rating=$post->rating/2; |
| 47 | 52 | $rating = str_format (localize("ratingword", $rating), $rating); |
@@ -52,7 +57,8 @@ discard block |
||
| 52 | 57 | return $entryArray; |
| 53 | 58 | } |
| 54 | 59 | |
| 55 | - public static function getRatingById ($ratingId) { |
|
| 60 | + public static function getRatingById ($ratingId) |
|
| 61 | + { |
|
| 56 | 62 | $result = parent::getDb ()->prepare('select rating from ratings where id = ?'); |
| 57 | 63 | $result->execute (array ($ratingId)); |
| 58 | 64 | return new Rating ($ratingId, $result->fetchColumn ()); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | const ALL_RATING_ID = "cops:rating"; |
| 12 | 12 | |
| 13 | 13 | const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count"; |
| 14 | - 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 | + 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 | |
@@ -20,41 +20,41 @@ discard block |
||
| 20 | 20 | $this->name = $pname; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function getUri () { |
|
| 24 | - return "?page=".Base::PAGE_RATING_DETAIL."&id=$this->id"; |
|
| 23 | + public function getUri() { |
|
| 24 | + return "?page=" . Base::PAGE_RATING_DETAIL . "&id=$this->id"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function getEntryId () { |
|
| 28 | - return self::ALL_RATING_ID.":".$this->id; |
|
| 27 | + public function getEntryId() { |
|
| 28 | + return self::ALL_RATING_ID . ":" . $this->id; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function getCount() { |
| 32 | 32 | // str_format (localize("ratings", count(array)) |
| 33 | - return Base::getCountGeneric ("ratings", self::ALL_RATING_ID, Base::PAGE_ALL_RATINGS, "ratings"); |
|
| 33 | + return Base::getCountGeneric("ratings", self::ALL_RATING_ID, Base::PAGE_ALL_RATINGS, "ratings"); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public static function getAllRatings() { |
| 37 | - return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); |
|
| 37 | + return self::getEntryArray(self::SQL_ALL_RATINGS, array()); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public static function getEntryArray ($query, $params) { |
|
| 41 | - list (, $result) = Base::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); |
|
| 40 | + public static function getEntryArray($query, $params) { |
|
| 41 | + list (, $result) = Base::executeQuery($query, self::RATING_COLUMNS, "", $params, -1); |
|
| 42 | 42 | $entryArray = array(); |
| 43 | - while ($post = $result->fetchObject ()) |
|
| 43 | + while ($post = $result->fetchObject()) |
|
| 44 | 44 | { |
| 45 | - $ratingObj = new Rating ($post->id, $post->rating); |
|
| 46 | - $rating=$post->rating/2; |
|
| 47 | - $rating = str_format (localize("ratingword", $rating), $rating); |
|
| 48 | - array_push ($entryArray, new Entry ($rating, $ratingObj->getEntryId (), |
|
| 49 | - str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 50 | - array ( new LinkNavigation ($ratingObj->getUri ())), "", $post->count)); |
|
| 45 | + $ratingObj = new Rating($post->id, $post->rating); |
|
| 46 | + $rating = $post->rating / 2; |
|
| 47 | + $rating = str_format(localize("ratingword", $rating), $rating); |
|
| 48 | + array_push($entryArray, new Entry($rating, $ratingObj->getEntryId(), |
|
| 49 | + str_format(localize("bookword", $post->count), $post->count), "text", |
|
| 50 | + array(new LinkNavigation($ratingObj->getUri())), "", $post->count)); |
|
| 51 | 51 | } |
| 52 | 52 | return $entryArray; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public static function getRatingById ($ratingId) { |
|
| 56 | - $result = Base::getDb ()->prepare('select rating from ratings where id = ?'); |
|
| 57 | - $result->execute (array ($ratingId)); |
|
| 58 | - return new Rating ($ratingId, $result->fetchColumn ()); |
|
| 55 | + public static function getRatingById($ratingId) { |
|
| 56 | + $result = Base::getDb()->prepare('select rating from ratings where id = ?'); |
|
| 57 | + $result->execute(array($ratingId)); |
|
| 58 | + return new Rating($ratingId, $result->fetchColumn()); |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -31,21 +31,21 @@ discard block |
||
| 31 | 31 | Publisher::ALL_PUBLISHERS_ID => 'images/publisher.png' |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - public function getUpdatedTime () { |
|
| 35 | - if (!is_null ($this->localUpdated)) { |
|
| 36 | - return date (DATE_ATOM, $this->localUpdated); |
|
| 34 | + public function getUpdatedTime() { |
|
| 35 | + if (!is_null($this->localUpdated)) { |
|
| 36 | + return date(DATE_ATOM, $this->localUpdated); |
|
| 37 | 37 | } |
| 38 | - if (is_null (self::$updated)) { |
|
| 38 | + if (is_null(self::$updated)) { |
|
| 39 | 39 | self::$updated = time(); |
| 40 | 40 | } |
| 41 | - return date (DATE_ATOM, self::$updated); |
|
| 41 | + return date(DATE_ATOM, self::$updated); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function getNavLink () { |
|
| 44 | + public function getNavLink() { |
|
| 45 | 45 | foreach ($this->linkArray as $link) { |
| 46 | 46 | if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; } |
| 47 | 47 | |
| 48 | - return $link->hrefXhtml (); |
|
| 48 | + return $link->hrefXhtml(); |
|
| 49 | 49 | } |
| 50 | 50 | return "#"; |
| 51 | 51 | } |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | foreach (self::$icons as $reg => $image) |
| 66 | 66 | { |
| 67 | - if (preg_match ("/" . $reg . "/", $pid)) { |
|
| 68 | - array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
|
| 67 | + if (preg_match("/" . $reg . "/", $pid)) { |
|
| 68 | + array_push($this->linkArray, new Link(getUrlWithVersion($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
|
| 69 | 69 | break; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (!is_null (GetUrlParam (DB))) $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
| 74 | + if (!is_null(GetUrlParam(DB))) $this->id = str_replace("cops:", "cops:" . GetUrlParam(DB) . ":", $this->id); |
|
| 75 | 75 | } |
| 76 | 76 | } |
@@ -31,7 +31,8 @@ discard block |
||
| 31 | 31 | Publisher::ALL_PUBLISHERS_ID => 'images/publisher.png' |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - public function getUpdatedTime () { |
|
| 34 | + public function getUpdatedTime () |
|
| 35 | + { |
|
| 35 | 36 | if (!is_null ($this->localUpdated)) { |
| 36 | 37 | return date (DATE_ATOM, $this->localUpdated); |
| 37 | 38 | } |
@@ -41,7 +42,8 @@ discard block |
||
| 41 | 42 | return date (DATE_ATOM, self::$updated); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | - public function getNavLink () { |
|
| 45 | + public function getNavLink () |
|
| 46 | + { |
|
| 45 | 47 | foreach ($this->linkArray as $link) { |
| 46 | 48 | if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; } |
| 47 | 49 | |
@@ -50,7 +52,8 @@ discard block |
||
| 50 | 52 | return "#"; |
| 51 | 53 | } |
| 52 | 54 | |
| 53 | - public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) { |
|
| 55 | + public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) |
|
| 56 | + { |
|
| 54 | 57 | global $config; |
| 55 | 58 | $this->title = $ptitle; |
| 56 | 59 | $this->id = $pid; |
@@ -60,10 +63,8 @@ discard block |
||
| 60 | 63 | $this->className = $pclass; |
| 61 | 64 | $this->numberOfElement = $pcount; |
| 62 | 65 | |
| 63 | - if ($config['cops_show_icons'] == 1) |
|
| 64 | - { |
|
| 65 | - foreach (self::$icons as $reg => $image) |
|
| 66 | - { |
|
| 66 | + if ($config['cops_show_icons'] == 1) { |
|
| 67 | + foreach (self::$icons as $reg => $image) { |
|
| 67 | 68 | if (preg_match ("/" . $reg . "/", $pid)) { |
| 68 | 69 | array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
| 69 | 70 | break; |
@@ -71,6 +72,8 @@ discard block |
||
| 71 | 72 | } |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | - if (!is_null (GetUrlParam (DB))) $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
| 75 | + if (!is_null (GetUrlParam (DB))) { |
|
| 76 | + $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
| 77 | + } |
|
| 75 | 78 | } |
| 76 | 79 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public $linkArray; |
| 17 | 17 | public $localUpdated; |
| 18 | 18 | public $className; |
| 19 | - private static $updated = NULL; |
|
| 19 | + private static $updated = null; |
|
| 20 | 20 | |
| 21 | 21 | public static $icons = array( |
| 22 | 22 | Author::ALL_AUTHORS_ID => 'images/author.png', |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $this->activeFacet = $pactiveFacet; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function hrefXhtml () { |
|
| 33 | + public function hrefXhtml() { |
|
| 34 | 34 | return $this->href; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | public $facetGroup; |
| 22 | 22 | public $activeFacet; |
| 23 | 23 | |
| 24 | - public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
|
| 24 | + public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) |
|
| 25 | + { |
|
| 25 | 26 | $this->href = $phref; |
| 26 | 27 | $this->type = $ptype; |
| 27 | 28 | $this->rel = $prel; |
@@ -30,11 +31,13 @@ discard block |
||
| 30 | 31 | $this->activeFacet = $pactiveFacet; |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | - public function hrefXhtml () { |
|
| 34 | + public function hrefXhtml () |
|
| 35 | + { |
|
| 34 | 36 | return $this->href; |
| 35 | 37 | } |
| 36 | 38 | |
| 37 | - public function getScriptName() { |
|
| 39 | + public function getScriptName() |
|
| 40 | + { |
|
| 38 | 41 | $parts = explode('/', $_SERVER["SCRIPT_NAME"]); |
| 39 | 42 | return $parts[count($parts) - 1]; |
| 40 | 43 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public $facetGroup; |
| 22 | 22 | public $activeFacet; |
| 23 | 23 | |
| 24 | - public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
|
| 24 | + public function __construct($phref, $ptype, $prel = null, $ptitle = null, $pfacetGroup = null, $pactiveFacet = false) { |
|
| 25 | 25 | $this->href = $phref; |
| 26 | 26 | $this->type = $ptype; |
| 27 | 27 | $this->rel = $prel; |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAllAuthors extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | 13 | $this->title = localize("authors.title"); |
| 14 | - if (getCurrentOption ("author_split_first_letter") == 1) { |
|
| 14 | + if (getCurrentOption("author_split_first_letter") == 1) { |
|
| 15 | 15 | $this->entryArray = Author::getAllAuthorsByFirstLetter(); |
| 16 | 16 | } |
| 17 | 17 | else { |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | $this->title = localize ("allbooks.title"); |
| 14 | 14 | if (getCurrentOption ("titles_split_first_letter") == 1) { |
| 15 | 15 | $this->entryArray = Book::getAllBooks(); |
| 16 | - } |
|
| 17 | - else { |
|
| 16 | + } else { |
|
| 18 | 17 | list ($this->entryArray, $this->totalNumber) = Book::getBooks ($this->n); |
| 19 | 18 | } |
| 20 | 19 | $this->idPage = Book::ALL_BOOKS_ID; |
@@ -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 | } |
@@ -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 | } |
@@ -10,135 +10,135 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class JSONRenderer |
| 12 | 12 | { |
| 13 | - public static function getBookContentArray ($book) { |
|
| 13 | + public static function getBookContentArray($book) { |
|
| 14 | 14 | global $config; |
| 15 | 15 | $i = 0; |
| 16 | - $preferedData = array (); |
|
| 16 | + $preferedData = array(); |
|
| 17 | 17 | foreach ($config['cops_prefered_format'] as $format) |
| 18 | 18 | { |
| 19 | 19 | if ($i == 2) { break; } |
| 20 | - if ($data = $book->getDataFormat ($format)) { |
|
| 20 | + if ($data = $book->getDataFormat($format)) { |
|
| 21 | 21 | $i++; |
| 22 | - array_push ($preferedData, array ("url" => $data->getHtmlLink (), "name" => $format)); |
|
| 22 | + array_push($preferedData, array("url" => $data->getHtmlLink(), "name" => $format)); |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $publisher = $book->getPublisher(); |
| 27 | - if (is_null ($publisher)) { |
|
| 27 | + if (is_null($publisher)) { |
|
| 28 | 28 | $pn = ""; |
| 29 | 29 | $pu = ""; |
| 30 | 30 | } else { |
| 31 | 31 | $pn = $publisher->name; |
| 32 | - $link = new LinkNavigation ($publisher->getUri ()); |
|
| 33 | - $pu = $link->hrefXhtml (); |
|
| 32 | + $link = new LinkNavigation($publisher->getUri()); |
|
| 33 | + $pu = $link->hrefXhtml(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $serie = $book->getSerie (); |
|
| 37 | - if (is_null ($serie)) { |
|
| 36 | + $serie = $book->getSerie(); |
|
| 37 | + if (is_null($serie)) { |
|
| 38 | 38 | $sn = ""; |
| 39 | 39 | $scn = ""; |
| 40 | 40 | $su = ""; |
| 41 | 41 | } else { |
| 42 | 42 | $sn = $serie->name; |
| 43 | - $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name); |
|
| 44 | - $link = new LinkNavigation ($serie->getUri ()); |
|
| 45 | - $su = $link->hrefXhtml (); |
|
| 43 | + $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name); |
|
| 44 | + $link = new LinkNavigation($serie->getUri()); |
|
| 45 | + $su = $link->hrefXhtml(); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return array ("id" => $book->id, |
|
| 48 | + return array("id" => $book->id, |
|
| 49 | 49 | "hasCover" => $book->hasCover, |
| 50 | 50 | "preferedData" => $preferedData, |
| 51 | - "rating" => $book->getRating (), |
|
| 51 | + "rating" => $book->getRating(), |
|
| 52 | 52 | "publisherName" => $pn, |
| 53 | 53 | "publisherurl" => $pu, |
| 54 | - "pubDate" => $book->getPubDate (), |
|
| 55 | - "languagesName" => $book->getLanguages (), |
|
| 56 | - "authorsName" => $book->getAuthorsName (), |
|
| 57 | - "tagsName" => $book->getTagsName (), |
|
| 54 | + "pubDate" => $book->getPubDate(), |
|
| 55 | + "languagesName" => $book->getLanguages(), |
|
| 56 | + "authorsName" => $book->getAuthorsName(), |
|
| 57 | + "tagsName" => $book->getTagsName(), |
|
| 58 | 58 | "seriesName" => $sn, |
| 59 | 59 | "seriesIndex" => $book->seriesIndex, |
| 60 | 60 | "seriesCompleteName" => $scn, |
| 61 | 61 | "seriesurl" => $su); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public static function getFullBookContentArray ($book) { |
|
| 64 | + public static function getFullBookContentArray($book) { |
|
| 65 | 65 | global $config; |
| 66 | - $out = self::getBookContentArray ($book); |
|
| 67 | - $database = GetUrlParam (DB); |
|
| 68 | - |
|
| 69 | - $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); |
|
| 70 | - $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
| 71 | - $out ["content"] = $book->getComment (false); |
|
| 72 | - $out ["datas"] = array (); |
|
| 73 | - $dataKindle = $book->GetMostInterestingDataToSendToKindle (); |
|
| 66 | + $out = self::getBookContentArray($book); |
|
| 67 | + $database = GetUrlParam(DB); |
|
| 68 | + |
|
| 69 | + $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml(); |
|
| 70 | + $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml(); |
|
| 71 | + $out ["content"] = $book->getComment(false); |
|
| 72 | + $out ["datas"] = array(); |
|
| 73 | + $dataKindle = $book->GetMostInterestingDataToSendToKindle(); |
|
| 74 | 74 | foreach ($book->getDatas() as $data) { |
| 75 | - $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0, "readerUrl" => ""); |
|
| 76 | - if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) { |
|
| 75 | + $tab = array("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink(), "mail" => 0, "readerUrl" => ""); |
|
| 76 | + if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) { |
|
| 77 | 77 | $tab ["mail"] = 1; |
| 78 | 78 | } |
| 79 | 79 | if ($data->format == "EPUB") { |
| 80 | 80 | $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}"; |
| 81 | 81 | } |
| 82 | - array_push ($out ["datas"], $tab); |
|
| 82 | + array_push($out ["datas"], $tab); |
|
| 83 | 83 | } |
| 84 | - $out ["authors"] = array (); |
|
| 85 | - foreach ($book->getAuthors () as $author) { |
|
| 86 | - $link = new LinkNavigation ($author->getUri ()); |
|
| 87 | - array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ())); |
|
| 84 | + $out ["authors"] = array(); |
|
| 85 | + foreach ($book->getAuthors() as $author) { |
|
| 86 | + $link = new LinkNavigation($author->getUri()); |
|
| 87 | + array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml())); |
|
| 88 | 88 | } |
| 89 | - $out ["tags"] = array (); |
|
| 90 | - foreach ($book->getTags () as $tag) { |
|
| 91 | - $link = new LinkNavigation ($tag->getUri ()); |
|
| 92 | - array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ())); |
|
| 89 | + $out ["tags"] = array(); |
|
| 90 | + foreach ($book->getTags() as $tag) { |
|
| 91 | + $link = new LinkNavigation($tag->getUri()); |
|
| 92 | + array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml())); |
|
| 93 | 93 | } |
| 94 | 94 | ; |
| 95 | 95 | return $out; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public static function getContentArray ($entry) { |
|
| 98 | + public static function getContentArray($entry) { |
|
| 99 | 99 | if ($entry instanceof EntryBook) { |
| 100 | - $out = array ( "title" => $entry->title); |
|
| 101 | - $out ["book"] = self::getBookContentArray ($entry->book); |
|
| 100 | + $out = array("title" => $entry->title); |
|
| 101 | + $out ["book"] = self::getBookContentArray($entry->book); |
|
| 102 | 102 | return $out; |
| 103 | 103 | } |
| 104 | - return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
|
| 104 | + return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public static function getContentArrayTypeahead ($page) { |
|
| 108 | - $out = array (); |
|
| 107 | + public static function getContentArrayTypeahead($page) { |
|
| 108 | + $out = array(); |
|
| 109 | 109 | foreach ($page->entryArray as $entry) { |
| 110 | 110 | if ($entry instanceof EntryBook) { |
| 111 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); |
|
| 111 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl())); |
|
| 112 | 112 | } else { |
| 113 | - if (empty ($entry->className) xor Base::noDatabaseSelected ()) { |
|
| 114 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ())); |
|
| 113 | + if (empty ($entry->className) xor Base::noDatabaseSelected()) { |
|
| 114 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink())); |
|
| 115 | 115 | } else { |
| 116 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ())); |
|
| 116 | + array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink())); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | return $out; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public static function addCompleteArray ($in) { |
|
| 123 | + public static function addCompleteArray($in) { |
|
| 124 | 124 | global $config; |
| 125 | 125 | $out = $in; |
| 126 | 126 | |
| 127 | - $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
|
| 127 | + $out ["c"] = array("version" => VERSION, "i18n" => array( |
|
| 128 | 128 | "coverAlt" => localize("i18n.coversection"), |
| 129 | 129 | "authorsTitle" => localize("authors.title"), |
| 130 | 130 | "bookwordTitle" => localize("bookword.title"), |
| 131 | 131 | "tagsTitle" => localize("tags.title"), |
| 132 | 132 | "seriesTitle" => localize("series.title"), |
| 133 | - "customizeTitle" => localize ("customize.title"), |
|
| 134 | - "aboutTitle" => localize ("about.title"), |
|
| 135 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
| 136 | - "nextAlt" => localize ("paging.next.alternate"), |
|
| 137 | - "searchAlt" => localize ("search.alternate"), |
|
| 138 | - "sortAlt" => localize ("sort.alternate"), |
|
| 139 | - "homeAlt" => localize ("home.alternate"), |
|
| 140 | - "cogAlt" => localize ("cog.alternate"), |
|
| 141 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
| 133 | + "customizeTitle" => localize("customize.title"), |
|
| 134 | + "aboutTitle" => localize("about.title"), |
|
| 135 | + "previousAlt" => localize("paging.previous.alternate"), |
|
| 136 | + "nextAlt" => localize("paging.next.alternate"), |
|
| 137 | + "searchAlt" => localize("search.alternate"), |
|
| 138 | + "sortAlt" => localize("sort.alternate"), |
|
| 139 | + "homeAlt" => localize("home.alternate"), |
|
| 140 | + "cogAlt" => localize("cog.alternate"), |
|
| 141 | + "permalinkAlt" => localize("permalink.alternate"), |
|
| 142 | 142 | "publisherName" => localize("publisher.name"), |
| 143 | 143 | "pubdateTitle" => localize("pubdate.title"), |
| 144 | 144 | "languagesTitle" => localize("language.title"), |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | "sortorderAsc" => localize("search.sortorder.asc"), |
| 147 | 147 | "sortorderDesc" => localize("search.sortorder.desc"), |
| 148 | 148 | "customizeEmail" => localize("customize.email")), |
| 149 | - "url" => array ( |
|
| 149 | + "url" => array( |
|
| 150 | 150 | "detailUrl" => "index.php?page=13&id={0}&db={1}", |
| 151 | 151 | "coverUrl" => "fetch.php?id={0}&db={1}", |
| 152 | 152 | "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
| 153 | - "config" => array ( |
|
| 153 | + "config" => array( |
|
| 154 | 154 | "use_fancyapps" => $config ["cops_use_fancyapps"], |
| 155 | 155 | "max_item_per_page" => $config['cops_max_item_per_page'], |
| 156 | 156 | "kindleHack" => "", |
| 157 | - "server_side_rendering" => useServerSideRendering (), |
|
| 157 | + "server_side_rendering" => useServerSideRendering(), |
|
| 158 | 158 | "html_tag_filter" => $config['cops_html_tag_filter'])); |
| 159 | 159 | if ($config['cops_thumbnail_handling'] == "1") { |
| 160 | 160 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
@@ -167,32 +167,32 @@ discard block |
||
| 167 | 167 | return $out; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public static function getJson ($complete = false) { |
|
| 170 | + public static function getJson($complete = false) { |
|
| 171 | 171 | global $config; |
| 172 | - $page = getURLParam ("page", Base::PAGE_INDEX); |
|
| 173 | - $query = getURLParam ("query"); |
|
| 174 | - $search = getURLParam ("search"); |
|
| 175 | - $qid = getURLParam ("id"); |
|
| 176 | - $n = getURLParam ("n", "1"); |
|
| 177 | - $database = GetUrlParam (DB); |
|
| 172 | + $page = getURLParam("page", Base::PAGE_INDEX); |
|
| 173 | + $query = getURLParam("query"); |
|
| 174 | + $search = getURLParam("search"); |
|
| 175 | + $qid = getURLParam("id"); |
|
| 176 | + $n = getURLParam("n", "1"); |
|
| 177 | + $database = GetUrlParam(DB); |
|
| 178 | 178 | |
| 179 | - $currentPage = Page::getPage ($page, $qid, $query, $n); |
|
| 180 | - $currentPage->InitializeContent (); |
|
| 179 | + $currentPage = Page::getPage($page, $qid, $query, $n); |
|
| 180 | + $currentPage->InitializeContent(); |
|
| 181 | 181 | |
| 182 | 182 | if ($search) { |
| 183 | - return self::getContentArrayTypeahead ($currentPage); |
|
| 183 | + return self::getContentArrayTypeahead($currentPage); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $out = array ( "title" => $currentPage->title); |
|
| 187 | - $entries = array (); |
|
| 186 | + $out = array("title" => $currentPage->title); |
|
| 187 | + $entries = array(); |
|
| 188 | 188 | foreach ($currentPage->entryArray as $entry) { |
| 189 | - array_push ($entries, self::getContentArray ($entry)); |
|
| 189 | + array_push($entries, self::getContentArray($entry)); |
|
| 190 | 190 | } |
| 191 | - if (!is_null ($currentPage->book)) { |
|
| 192 | - $out ["book"] = self::getFullBookContentArray ($currentPage->book); |
|
| 191 | + if (!is_null($currentPage->book)) { |
|
| 192 | + $out ["book"] = self::getFullBookContentArray($currentPage->book); |
|
| 193 | 193 | } |
| 194 | - $out ["databaseId"] = GetUrlParam (DB, ""); |
|
| 195 | - $out ["databaseName"] = Base::getDbName (); |
|
| 194 | + $out ["databaseId"] = GetUrlParam(DB, ""); |
|
| 195 | + $out ["databaseName"] = Base::getDbName(); |
|
| 196 | 196 | if ($out ["databaseId"] == "") { |
| 197 | 197 | $out ["databaseName"] = ""; |
| 198 | 198 | } |
@@ -201,42 +201,42 @@ discard block |
||
| 201 | 201 | $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"]; |
| 202 | 202 | } |
| 203 | 203 | $out ["page"] = $page; |
| 204 | - $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0; |
|
| 204 | + $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0; |
|
| 205 | 205 | $out ["entries"] = $entries; |
| 206 | 206 | $out ["isPaginated"] = 0; |
| 207 | - if ($currentPage->isPaginated ()) { |
|
| 208 | - $prevLink = $currentPage->getPrevLink (); |
|
| 209 | - $nextLink = $currentPage->getNextLink (); |
|
| 207 | + if ($currentPage->isPaginated()) { |
|
| 208 | + $prevLink = $currentPage->getPrevLink(); |
|
| 209 | + $nextLink = $currentPage->getNextLink(); |
|
| 210 | 210 | $out ["isPaginated"] = 1; |
| 211 | 211 | $out ["prevLink"] = ""; |
| 212 | - if (!is_null ($prevLink)) { |
|
| 213 | - $out ["prevLink"] = $prevLink->hrefXhtml (); |
|
| 212 | + if (!is_null($prevLink)) { |
|
| 213 | + $out ["prevLink"] = $prevLink->hrefXhtml(); |
|
| 214 | 214 | } |
| 215 | 215 | $out ["nextLink"] = ""; |
| 216 | - if (!is_null ($nextLink)) { |
|
| 217 | - $out ["nextLink"] = $nextLink->hrefXhtml (); |
|
| 216 | + if (!is_null($nextLink)) { |
|
| 217 | + $out ["nextLink"] = $nextLink->hrefXhtml(); |
|
| 218 | 218 | } |
| 219 | - $out ["maxPage"] = $currentPage->getMaxPage (); |
|
| 219 | + $out ["maxPage"] = $currentPage->getMaxPage(); |
|
| 220 | 220 | $out ["currentPage"] = $currentPage->n; |
| 221 | 221 | } |
| 222 | - if (!is_null (getURLParam ("complete")) || $complete) { |
|
| 223 | - $out = self::addCompleteArray ($out); |
|
| 222 | + if (!is_null(getURLParam("complete")) || $complete) { |
|
| 223 | + $out = self::addCompleteArray($out); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $out ["containsBook"] = 0; |
| 227 | - if ($currentPage->containsBook ()) { |
|
| 227 | + if ($currentPage->containsBook()) { |
|
| 228 | 228 | $out ["containsBook"] = 1; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
| 231 | + $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
| 232 | 232 | |
| 233 | 233 | if ($page == Base::PAGE_ABOUT) { |
| 234 | - $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
| 234 | + $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
| 235 | 235 | $out ["fullhtml"] = $temp; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $out ["homeurl"] = "index.php"; |
| 239 | - if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
| 239 | + if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database); |
|
| 240 | 240 | |
| 241 | 241 | return $out; |
| 242 | 242 | } |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class JSONRenderer |
| 12 | 12 | { |
| 13 | - public static function getBookContentArray ($book) { |
|
| 13 | + public static function getBookContentArray ($book) |
|
| 14 | + { |
|
| 14 | 15 | global $config; |
| 15 | 16 | $i = 0; |
| 16 | 17 | $preferedData = array (); |
| 17 | - foreach ($config['cops_prefered_format'] as $format) |
|
| 18 | - { |
|
| 18 | + foreach ($config['cops_prefered_format'] as $format) { |
|
| 19 | 19 | if ($i == 2) { break; } |
| 20 | 20 | if ($data = $book->getDataFormat ($format)) { |
| 21 | 21 | $i++; |
@@ -61,7 +61,8 @@ discard block |
||
| 61 | 61 | "seriesurl" => $su); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public static function getFullBookContentArray ($book) { |
|
| 64 | + public static function getFullBookContentArray ($book) |
|
| 65 | + { |
|
| 65 | 66 | global $config; |
| 66 | 67 | $out = self::getBookContentArray ($book); |
| 67 | 68 | $database = GetUrlParam (DB); |
@@ -95,7 +96,8 @@ discard block |
||
| 95 | 96 | return $out; |
| 96 | 97 | } |
| 97 | 98 | |
| 98 | - public static function getContentArray ($entry) { |
|
| 99 | + public static function getContentArray ($entry) |
|
| 100 | + { |
|
| 99 | 101 | if ($entry instanceof EntryBook) { |
| 100 | 102 | $out = array ( "title" => $entry->title); |
| 101 | 103 | $out ["book"] = self::getBookContentArray ($entry->book); |
@@ -104,7 +106,8 @@ discard block |
||
| 104 | 106 | return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
| 105 | 107 | } |
| 106 | 108 | |
| 107 | - public static function getContentArrayTypeahead ($page) { |
|
| 109 | + public static function getContentArrayTypeahead ($page) |
|
| 110 | + { |
|
| 108 | 111 | $out = array (); |
| 109 | 112 | foreach ($page->entryArray as $entry) { |
| 110 | 113 | if ($entry instanceof EntryBook) { |
@@ -120,7 +123,8 @@ discard block |
||
| 120 | 123 | return $out; |
| 121 | 124 | } |
| 122 | 125 | |
| 123 | - public static function addCompleteArray ($in) { |
|
| 126 | + public static function addCompleteArray ($in) |
|
| 127 | + { |
|
| 124 | 128 | global $config; |
| 125 | 129 | $out = $in; |
| 126 | 130 | |
@@ -167,7 +171,8 @@ discard block |
||
| 167 | 171 | return $out; |
| 168 | 172 | } |
| 169 | 173 | |
| 170 | - public static function getJson ($complete = false) { |
|
| 174 | + public static function getJson ($complete = false) |
|
| 175 | + { |
|
| 171 | 176 | global $config; |
| 172 | 177 | $page = getURLParam ("page", Base::PAGE_INDEX); |
| 173 | 178 | $query = getURLParam ("query"); |
@@ -236,7 +241,9 @@ discard block |
||
| 236 | 241 | } |
| 237 | 242 | |
| 238 | 243 | $out ["homeurl"] = "index.php"; |
| 239 | - if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
| 244 | + if ($page != Base::PAGE_INDEX && !is_null ($database)) { |
|
| 245 | + $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
| 246 | + } |
|
| 240 | 247 | |
| 241 | 248 | return $out; |
| 242 | 249 | } |
@@ -66,8 +66,8 @@ |
||
| 66 | 66 | $out = self::getBookContentArray ($book); |
| 67 | 67 | $database = GetUrlParam (DB); |
| 68 | 68 | |
| 69 | - $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); |
|
| 70 | - $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
| 69 | + $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", null)->hrefXhtml (); |
|
| 70 | + $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", null, null, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
| 71 | 71 | $out ["content"] = $book->getComment (false); |
| 72 | 72 | $out ["datas"] = array (); |
| 73 | 73 | $dataKindle = $book->GetMostInterestingDataToSendToKindle (); |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list']); |
| 52 | 52 | |
| 53 | 53 | return array ("id" => $book->id, |
| 54 | - "hasCover" => $book->hasCover, |
|
| 55 | - "preferedData" => $preferedData, |
|
| 56 | - "rating" => $book->getRating (), |
|
| 57 | - "publisherName" => $pn, |
|
| 58 | - "publisherurl" => $pu, |
|
| 59 | - "pubDate" => $book->getPubDate (), |
|
| 60 | - "languagesName" => $book->getLanguages (), |
|
| 61 | - "authorsName" => $book->getAuthorsName (), |
|
| 62 | - "tagsName" => $book->getTagsName (), |
|
| 63 | - "seriesName" => $sn, |
|
| 64 | - "seriesIndex" => $book->seriesIndex, |
|
| 65 | - "seriesCompleteName" => $scn, |
|
| 66 | - "seriesurl" => $su, |
|
| 67 | - "customcolumns_list" => $cc); |
|
| 54 | + "hasCover" => $book->hasCover, |
|
| 55 | + "preferedData" => $preferedData, |
|
| 56 | + "rating" => $book->getRating (), |
|
| 57 | + "publisherName" => $pn, |
|
| 58 | + "publisherurl" => $pu, |
|
| 59 | + "pubDate" => $book->getPubDate (), |
|
| 60 | + "languagesName" => $book->getLanguages (), |
|
| 61 | + "authorsName" => $book->getAuthorsName (), |
|
| 62 | + "tagsName" => $book->getTagsName (), |
|
| 63 | + "seriesName" => $sn, |
|
| 64 | + "seriesIndex" => $book->seriesIndex, |
|
| 65 | + "seriesCompleteName" => $scn, |
|
| 66 | + "seriesurl" => $su, |
|
| 67 | + "customcolumns_list" => $cc); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -136,44 +136,44 @@ discard block |
||
| 136 | 136 | $out = $in; |
| 137 | 137 | |
| 138 | 138 | $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
| 139 | - "coverAlt" => localize("i18n.coversection"), |
|
| 140 | - "authorsTitle" => localize("authors.title"), |
|
| 141 | - "bookwordTitle" => localize("bookword.title"), |
|
| 142 | - "tagsTitle" => localize("tags.title"), |
|
| 143 | - "seriesTitle" => localize("series.title"), |
|
| 144 | - "customizeTitle" => localize ("customize.title"), |
|
| 145 | - "aboutTitle" => localize ("about.title"), |
|
| 146 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
| 147 | - "nextAlt" => localize ("paging.next.alternate"), |
|
| 148 | - "searchAlt" => localize ("search.alternate"), |
|
| 149 | - "sortAlt" => localize ("sort.alternate"), |
|
| 150 | - "homeAlt" => localize ("home.alternate"), |
|
| 151 | - "cogAlt" => localize ("cog.alternate"), |
|
| 152 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
| 153 | - "publisherName" => localize("publisher.name"), |
|
| 154 | - "pubdateTitle" => localize("pubdate.title"), |
|
| 155 | - "languagesTitle" => localize("language.title"), |
|
| 156 | - "contentTitle" => localize("content.summary"), |
|
| 157 | - "sortorderAsc" => localize("search.sortorder.asc"), |
|
| 158 | - "sortorderDesc" => localize("search.sortorder.desc"), |
|
| 159 | - "customizeEmail" => localize("customize.email")), |
|
| 160 | - "url" => array ( |
|
| 161 | - "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
| 162 | - "coverUrl" => "fetch.php?id={0}&db={1}", |
|
| 163 | - "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
| 164 | - "config" => array ( |
|
| 165 | - "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
| 166 | - "max_item_per_page" => $config['cops_max_item_per_page'], |
|
| 167 | - "kindleHack" => "", |
|
| 168 | - "server_side_rendering" => useServerSideRendering (), |
|
| 169 | - "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
| 139 | + "coverAlt" => localize("i18n.coversection"), |
|
| 140 | + "authorsTitle" => localize("authors.title"), |
|
| 141 | + "bookwordTitle" => localize("bookword.title"), |
|
| 142 | + "tagsTitle" => localize("tags.title"), |
|
| 143 | + "seriesTitle" => localize("series.title"), |
|
| 144 | + "customizeTitle" => localize ("customize.title"), |
|
| 145 | + "aboutTitle" => localize ("about.title"), |
|
| 146 | + "previousAlt" => localize ("paging.previous.alternate"), |
|
| 147 | + "nextAlt" => localize ("paging.next.alternate"), |
|
| 148 | + "searchAlt" => localize ("search.alternate"), |
|
| 149 | + "sortAlt" => localize ("sort.alternate"), |
|
| 150 | + "homeAlt" => localize ("home.alternate"), |
|
| 151 | + "cogAlt" => localize ("cog.alternate"), |
|
| 152 | + "permalinkAlt" => localize ("permalink.alternate"), |
|
| 153 | + "publisherName" => localize("publisher.name"), |
|
| 154 | + "pubdateTitle" => localize("pubdate.title"), |
|
| 155 | + "languagesTitle" => localize("language.title"), |
|
| 156 | + "contentTitle" => localize("content.summary"), |
|
| 157 | + "sortorderAsc" => localize("search.sortorder.asc"), |
|
| 158 | + "sortorderDesc" => localize("search.sortorder.desc"), |
|
| 159 | + "customizeEmail" => localize("customize.email")), |
|
| 160 | + "url" => array ( |
|
| 161 | + "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
| 162 | + "coverUrl" => "fetch.php?id={0}&db={1}", |
|
| 163 | + "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
| 164 | + "config" => array ( |
|
| 165 | + "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
| 166 | + "max_item_per_page" => $config['cops_max_item_per_page'], |
|
| 167 | + "kindleHack" => "", |
|
| 168 | + "server_side_rendering" => useServerSideRendering (), |
|
| 169 | + "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
| 170 | 170 | if ($config['cops_thumbnail_handling'] == "1") { |
| 171 | 171 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
| 172 | 172 | } else if (!empty ($config['cops_thumbnail_handling'])) { |
| 173 | 173 | $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling']; |
| 174 | 174 | } |
| 175 | 175 | if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) { |
| 176 | - $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
| 176 | + $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
| 177 | 177 | } |
| 178 | 178 | return $out; |
| 179 | 179 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | if (!is_null (getURLParam ("complete")) || $complete) { |
| 234 | 234 | $out = self::addCompleteArray ($out); |
| 235 | - } |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | 237 | $out ["containsBook"] = 0; |
| 238 | 238 | if ($currentPage->containsBook ()) { |
@@ -19,37 +19,42 @@ discard block |
||
| 19 | 19 | public $name; |
| 20 | 20 | public $sort; |
| 21 | 21 | |
| 22 | - public function __construct($post) { |
|
| 22 | + public function __construct($post) |
|
| 23 | + { |
|
| 23 | 24 | $this->id = $post->id; |
| 24 | 25 | $this->name = str_replace("|", ",", $post->name); |
| 25 | 26 | $this->sort = $post->sort; |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | - public function getUri () { |
|
| 29 | + public function getUri () |
|
| 30 | + { |
|
| 29 | 31 | return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id"; |
| 30 | 32 | } |
| 31 | 33 | |
| 32 | - public function getEntryId () { |
|
| 34 | + public function getEntryId () |
|
| 35 | + { |
|
| 33 | 36 | return self::ALL_AUTHORS_ID.":".$this->id; |
| 34 | 37 | } |
| 35 | 38 | |
| 36 | - public static function getEntryIdByLetter ($startingLetter) { |
|
| 39 | + public static function getEntryIdByLetter ($startingLetter) |
|
| 40 | + { |
|
| 37 | 41 | return self::ALL_AUTHORS_ID.":letter:".$startingLetter; |
| 38 | 42 | } |
| 39 | 43 | |
| 40 | - public static function getCount() { |
|
| 44 | + public static function getCount() |
|
| 45 | + { |
|
| 41 | 46 | // str_format (localize("authors.alphabetical", count(array)) |
| 42 | 47 | return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS); |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | - public static function getAllAuthorsByFirstLetter() { |
|
| 50 | + public static function getAllAuthorsByFirstLetter() |
|
| 51 | + { |
|
| 46 | 52 | list (, $result) = parent::executeQuery ("select {0} |
| 47 | 53 | from authors |
| 48 | 54 | group by substr (upper (sort), 1, 1) |
| 49 | 55 | order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1); |
| 50 | 56 | $entryArray = array(); |
| 51 | - while ($post = $result->fetchObject ()) |
|
| 52 | - { |
|
| 57 | + while ($post = $result->fetchObject ()) { |
|
| 53 | 58 | array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title), |
| 54 | 59 | str_format (localize("authorword", $post->count), $post->count), "text", |
| 55 | 60 | array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count)); |
@@ -57,30 +62,36 @@ discard block |
||
| 57 | 62 | return $entryArray; |
| 58 | 63 | } |
| 59 | 64 | |
| 60 | - public static function getAuthorsByStartingLetter($letter) { |
|
| 65 | + public static function getAuthorsByStartingLetter($letter) |
|
| 66 | + { |
|
| 61 | 67 | return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
| 62 | 68 | } |
| 63 | 69 | |
| 64 | - public static function getAuthorsForSearch($query) { |
|
| 70 | + public static function getAuthorsForSearch($query) |
|
| 71 | + { |
|
| 65 | 72 | return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
| 66 | 73 | } |
| 67 | 74 | |
| 68 | - public static function getAllAuthors() { |
|
| 75 | + public static function getAllAuthors() |
|
| 76 | + { |
|
| 69 | 77 | return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
| 70 | 78 | } |
| 71 | 79 | |
| 72 | - public static function getEntryArray ($query, $params) { |
|
| 80 | + public static function getEntryArray ($query, $params) |
|
| 81 | + { |
|
| 73 | 82 | return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
| 74 | 83 | } |
| 75 | 84 | |
| 76 | - public static function getAuthorById ($authorId) { |
|
| 85 | + public static function getAuthorById ($authorId) |
|
| 86 | + { |
|
| 77 | 87 | $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?'); |
| 78 | 88 | $result->execute (array ($authorId)); |
| 79 | 89 | $post = $result->fetchObject (); |
| 80 | 90 | return new Author ($post); |
| 81 | 91 | } |
| 82 | 92 | |
| 83 | - public static function getAuthorByBookId ($bookId) { |
|
| 93 | + public static function getAuthorByBookId ($bookId) |
|
| 94 | + { |
|
| 84 | 95 | $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link |
| 85 | 96 | where author = authors.id |
| 86 | 97 | and book = ?'); |
@@ -25,69 +25,69 @@ |
||
| 25 | 25 | $this->sort = $post->sort; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function getUri () { |
|
| 29 | - return "?page=".Base::PAGE_AUTHOR_DETAIL."&id=$this->id"; |
|
| 28 | + public function getUri() { |
|
| 29 | + return "?page=" . Base::PAGE_AUTHOR_DETAIL . "&id=$this->id"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getEntryId () { |
|
| 33 | - return self::ALL_AUTHORS_ID.":".$this->id; |
|
| 32 | + public function getEntryId() { |
|
| 33 | + return self::ALL_AUTHORS_ID . ":" . $this->id; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function getEntryIdByLetter ($startingLetter) { |
|
| 37 | - return self::ALL_AUTHORS_ID.":letter:".$startingLetter; |
|
| 36 | + public static function getEntryIdByLetter($startingLetter) { |
|
| 37 | + return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public static function getCount() { |
| 41 | 41 | // str_format (localize("authors.alphabetical", count(array)) |
| 42 | - return Base::getCountGeneric ("authors", self::ALL_AUTHORS_ID, Base::PAGE_ALL_AUTHORS); |
|
| 42 | + return Base::getCountGeneric("authors", self::ALL_AUTHORS_ID, Base::PAGE_ALL_AUTHORS); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function getAllAuthorsByFirstLetter() { |
| 46 | - list (, $result) = Base::executeQuery ("select {0} |
|
| 46 | + list (, $result) = Base::executeQuery("select {0} |
|
| 47 | 47 | from authors |
| 48 | 48 | group by substr (upper (sort), 1, 1) |
| 49 | -order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1); |
|
| 49 | +order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array(), -1); |
|
| 50 | 50 | $entryArray = array(); |
| 51 | - while ($post = $result->fetchObject ()) |
|
| 51 | + while ($post = $result->fetchObject()) |
|
| 52 | 52 | { |
| 53 | - array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title), |
|
| 54 | - str_format (localize("authorword", $post->count), $post->count), "text", |
|
| 55 | - array ( new LinkNavigation ("?page=".Base::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count)); |
|
| 53 | + array_push($entryArray, new Entry($post->title, Author::getEntryIdByLetter($post->title), |
|
| 54 | + str_format(localize("authorword", $post->count), $post->count), "text", |
|
| 55 | + array(new LinkNavigation("?page=" . Base::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))), "", $post->count)); |
|
| 56 | 56 | } |
| 57 | 57 | return $entryArray; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public static function getAuthorsByStartingLetter($letter) { |
| 61 | - return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
|
| 61 | + return self::getEntryArray(self::SQL_AUTHORS_BY_FIRST_LETTER, array($letter . "%")); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public static function getAuthorsForSearch($query) { |
| 65 | - return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
|
| 65 | + return self::getEntryArray(self::SQL_AUTHORS_FOR_SEARCH, array($query . "%", $query . "%")); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public static function getAllAuthors() { |
| 69 | - return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
|
| 69 | + return self::getEntryArray(self::SQL_ALL_AUTHORS, array()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public static function getEntryArray ($query, $params) { |
|
| 73 | - return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
|
| 72 | + public static function getEntryArray($query, $params) { |
|
| 73 | + return Base::getEntryArrayWithBookNumber($query, self::AUTHOR_COLUMNS, $params, "Author"); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public static function getAuthorById ($authorId) { |
|
| 77 | - $result = Base::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?'); |
|
| 78 | - $result->execute (array ($authorId)); |
|
| 79 | - $post = $result->fetchObject (); |
|
| 80 | - return new Author ($post); |
|
| 76 | + public static function getAuthorById($authorId) { |
|
| 77 | + $result = Base::getDb()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?'); |
|
| 78 | + $result->execute(array($authorId)); |
|
| 79 | + $post = $result->fetchObject(); |
|
| 80 | + return new Author($post); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public static function getAuthorByBookId ($bookId) { |
|
| 84 | - $result = Base::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link |
|
| 83 | + public static function getAuthorByBookId($bookId) { |
|
| 84 | + $result = Base::getDb()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link |
|
| 85 | 85 | where author = authors.id |
| 86 | 86 | and book = ?'); |
| 87 | - $result->execute (array ($bookId)); |
|
| 88 | - $authorArray = array (); |
|
| 89 | - while ($post = $result->fetchObject ()) { |
|
| 90 | - array_push ($authorArray, new Author ($post)); |
|
| 87 | + $result->execute(array($bookId)); |
|
| 88 | + $authorArray = array(); |
|
| 89 | + while ($post = $result->fetchObject()) { |
|
| 90 | + array_push($authorArray, new Author($post)); |
|
| 91 | 91 | } |
| 92 | 92 | return $authorArray; |
| 93 | 93 | } |