@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | |
42 | 42 | protected function getAllCustomValuesFromDatabase() |
43 | 43 | { |
44 | - return NULL; |
|
44 | + return null; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getDescription() |
48 | 48 | { |
49 | 49 | $desc = $this->getDatabaseDescription(); |
50 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
50 | + if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
51 | 51 | return $desc; |
52 | 52 | } |
53 | 53 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if ($post = $result->fetchObject()) { |
61 | 61 | return new CustomColumn($post->id, $post->value, $this); |
62 | 62 | } |
63 | - return new CustomColumn(NULL, localize("customcolumn.float.unknown"), $this); |
|
63 | + return new CustomColumn(null, localize("customcolumn.float.unknown"), $this); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public function isSearchable() |
@@ -55,7 +55,9 @@ |
||
55 | 55 | public function getDescription() |
56 | 56 | { |
57 | 57 | $desc = $this->getDatabaseDescription(); |
58 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
58 | + if ($desc === NULL || empty($desc)) { |
|
59 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
60 | + } |
|
59 | 61 | return $desc; |
60 | 62 | } |
61 | 63 |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Book $book |
15 | 15 | * @return array |
16 | 16 | */ |
17 | - public static function getBookContentArray ($book) { |
|
17 | + public static function getBookContentArray ($book) |
|
18 | + { |
|
18 | 19 | global $config; |
19 | 20 | $i = 0; |
20 | 21 | $preferedData = array (); |
21 | - foreach ($config['cops_prefered_format'] as $format) |
|
22 | - { |
|
22 | + foreach ($config['cops_prefered_format'] as $format) { |
|
23 | 23 | if ($i == 2) { break; } |
24 | 24 | if ($data = $book->getDataFormat ($format)) { |
25 | 25 | $i++; |
@@ -71,7 +71,8 @@ discard block |
||
71 | 71 | * @param Book $book |
72 | 72 | * @return array |
73 | 73 | */ |
74 | - public static function getFullBookContentArray ($book) { |
|
74 | + public static function getFullBookContentArray ($book) |
|
75 | + { |
|
75 | 76 | global $config; |
76 | 77 | $out = self::getBookContentArray ($book); |
77 | 78 | $database = GetUrlParam (DB); |
@@ -106,7 +107,8 @@ discard block |
||
106 | 107 | return $out; |
107 | 108 | } |
108 | 109 | |
109 | - public static function getContentArray ($entry) { |
|
110 | + public static function getContentArray ($entry) |
|
111 | + { |
|
110 | 112 | if ($entry instanceof EntryBook) { |
111 | 113 | $out = array ( "title" => $entry->title); |
112 | 114 | $out ["book"] = self::getBookContentArray ($entry->book); |
@@ -115,7 +117,8 @@ discard block |
||
115 | 117 | return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
116 | 118 | } |
117 | 119 | |
118 | - public static function getContentArrayTypeahead ($page) { |
|
120 | + public static function getContentArrayTypeahead ($page) |
|
121 | + { |
|
119 | 122 | $out = array (); |
120 | 123 | foreach ($page->entryArray as $entry) { |
121 | 124 | if ($entry instanceof EntryBook) { |
@@ -131,7 +134,8 @@ discard block |
||
131 | 134 | return $out; |
132 | 135 | } |
133 | 136 | |
134 | - public static function addCompleteArray ($in) { |
|
137 | + public static function addCompleteArray ($in) |
|
138 | + { |
|
135 | 139 | global $config; |
136 | 140 | $out = $in; |
137 | 141 | |
@@ -178,7 +182,8 @@ discard block |
||
178 | 182 | return $out; |
179 | 183 | } |
180 | 184 | |
181 | - public static function getJson ($complete = false) { |
|
185 | + public static function getJson ($complete = false) |
|
186 | + { |
|
182 | 187 | global $config; |
183 | 188 | $page = getURLParam ("page", Base::PAGE_INDEX); |
184 | 189 | $query = getURLParam ("query"); |
@@ -247,7 +252,9 @@ discard block |
||
247 | 252 | } |
248 | 253 | |
249 | 254 | $out ["homeurl"] = "index.php"; |
250 | - if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
255 | + if ($page != Base::PAGE_INDEX && !is_null ($database)) { |
|
256 | + $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
257 | + } |
|
251 | 258 | |
252 | 259 | return $out; |
253 | 260 | } |
@@ -76,8 +76,8 @@ |
||
76 | 76 | $out = self::getBookContentArray ($book); |
77 | 77 | $database = GetUrlParam (DB); |
78 | 78 | |
79 | - $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); |
|
80 | - $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
79 | + $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", null)->hrefXhtml (); |
|
80 | + $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", null, null, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
81 | 81 | $out ["content"] = $book->getComment (false); |
82 | 82 | $out ["datas"] = array (); |
83 | 83 | $dataKindle = $book->GetMostInterestingDataToSendToKindle (); |
@@ -14,53 +14,53 @@ discard block |
||
14 | 14 | * @param Book $book |
15 | 15 | * @return array |
16 | 16 | */ |
17 | - public static function getBookContentArray ($book) { |
|
17 | + public static function getBookContentArray($book) { |
|
18 | 18 | global $config; |
19 | 19 | $i = 0; |
20 | - $preferedData = array (); |
|
20 | + $preferedData = array(); |
|
21 | 21 | foreach ($config['cops_prefered_format'] as $format) |
22 | 22 | { |
23 | 23 | if ($i == 2) { break; } |
24 | - if ($data = $book->getDataFormat ($format)) { |
|
24 | + if ($data = $book->getDataFormat($format)) { |
|
25 | 25 | $i++; |
26 | - array_push ($preferedData, array ("url" => $data->getHtmlLink (), |
|
27 | - "viewUrl" => $data->getViewHtmlLink (), "name" => $format)); |
|
26 | + array_push($preferedData, array("url" => $data->getHtmlLink(), |
|
27 | + "viewUrl" => $data->getViewHtmlLink(), "name" => $format)); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | $publisher = $book->getPublisher(); |
32 | - if (is_null ($publisher)) { |
|
32 | + if (is_null($publisher)) { |
|
33 | 33 | $pn = ""; |
34 | 34 | $pu = ""; |
35 | 35 | } else { |
36 | 36 | $pn = $publisher->name; |
37 | - $link = new LinkNavigation ($publisher->getUri ()); |
|
38 | - $pu = $link->hrefXhtml (); |
|
37 | + $link = new LinkNavigation($publisher->getUri()); |
|
38 | + $pu = $link->hrefXhtml(); |
|
39 | 39 | } |
40 | 40 | |
41 | - $serie = $book->getSerie (); |
|
42 | - if (is_null ($serie)) { |
|
41 | + $serie = $book->getSerie(); |
|
42 | + if (is_null($serie)) { |
|
43 | 43 | $sn = ""; |
44 | 44 | $scn = ""; |
45 | 45 | $su = ""; |
46 | 46 | } else { |
47 | 47 | $sn = $serie->name; |
48 | - $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name); |
|
49 | - $link = new LinkNavigation ($serie->getUri ()); |
|
50 | - $su = $link->hrefXhtml (); |
|
48 | + $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name); |
|
49 | + $link = new LinkNavigation($serie->getUri()); |
|
50 | + $su = $link->hrefXhtml(); |
|
51 | 51 | } |
52 | 52 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
53 | 53 | |
54 | - return array ("id" => $book->id, |
|
54 | + return array("id" => $book->id, |
|
55 | 55 | "hasCover" => $book->hasCover, |
56 | 56 | "preferedData" => $preferedData, |
57 | - "rating" => $book->getRating (), |
|
57 | + "rating" => $book->getRating(), |
|
58 | 58 | "publisherName" => $pn, |
59 | 59 | "publisherurl" => $pu, |
60 | - "pubDate" => $book->getPubDate (), |
|
61 | - "languagesName" => $book->getLanguages (), |
|
62 | - "authorsName" => $book->getAuthorsName (), |
|
63 | - "tagsName" => $book->getTagsName (), |
|
60 | + "pubDate" => $book->getPubDate(), |
|
61 | + "languagesName" => $book->getLanguages(), |
|
62 | + "authorsName" => $book->getAuthorsName(), |
|
63 | + "tagsName" => $book->getTagsName(), |
|
64 | 64 | "seriesName" => $sn, |
65 | 65 | "seriesIndex" => $book->seriesIndex, |
66 | 66 | "seriesCompleteName" => $scn, |
@@ -72,90 +72,90 @@ discard block |
||
72 | 72 | * @param Book $book |
73 | 73 | * @return array |
74 | 74 | */ |
75 | - public static function getFullBookContentArray ($book) { |
|
75 | + public static function getFullBookContentArray($book) { |
|
76 | 76 | global $config; |
77 | - $out = self::getBookContentArray ($book); |
|
78 | - $database = GetUrlParam (DB); |
|
77 | + $out = self::getBookContentArray($book); |
|
78 | + $database = GetUrlParam(DB); |
|
79 | 79 | |
80 | - $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); |
|
81 | - $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
82 | - $out ["content"] = $book->getComment (false); |
|
83 | - $out ["datas"] = array (); |
|
84 | - $dataKindle = $book->GetMostInterestingDataToSendToKindle (); |
|
80 | + $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml(); |
|
81 | + $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml(); |
|
82 | + $out ["content"] = $book->getComment(false); |
|
83 | + $out ["datas"] = array(); |
|
84 | + $dataKindle = $book->GetMostInterestingDataToSendToKindle(); |
|
85 | 85 | foreach ($book->getDatas() as $data) { |
86 | - $tab = array ("id" => $data->id, |
|
86 | + $tab = array("id" => $data->id, |
|
87 | 87 | "format" => $data->format, |
88 | - "url" => $data->getHtmlLink (), |
|
89 | - "viewUrl" => $data->getViewHtmlLink (), |
|
88 | + "url" => $data->getHtmlLink(), |
|
89 | + "viewUrl" => $data->getViewHtmlLink(), |
|
90 | 90 | "mail" => 0, |
91 | 91 | "readerUrl" => ""); |
92 | - if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) { |
|
92 | + if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) { |
|
93 | 93 | $tab ["mail"] = 1; |
94 | 94 | } |
95 | 95 | if ($data->format == "EPUB") { |
96 | 96 | $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}"; |
97 | 97 | } |
98 | - array_push ($out ["datas"], $tab); |
|
98 | + array_push($out ["datas"], $tab); |
|
99 | 99 | } |
100 | - $out ["authors"] = array (); |
|
101 | - foreach ($book->getAuthors () as $author) { |
|
102 | - $link = new LinkNavigation ($author->getUri ()); |
|
103 | - array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ())); |
|
100 | + $out ["authors"] = array(); |
|
101 | + foreach ($book->getAuthors() as $author) { |
|
102 | + $link = new LinkNavigation($author->getUri()); |
|
103 | + array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml())); |
|
104 | 104 | } |
105 | - $out ["tags"] = array (); |
|
106 | - foreach ($book->getTags () as $tag) { |
|
107 | - $link = new LinkNavigation ($tag->getUri ()); |
|
108 | - array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ())); |
|
105 | + $out ["tags"] = array(); |
|
106 | + foreach ($book->getTags() as $tag) { |
|
107 | + $link = new LinkNavigation($tag->getUri()); |
|
108 | + array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml())); |
|
109 | 109 | } |
110 | 110 | $out ["customcolumns_preview"] = $book->getCustomColumnValues($config['cops_calibre_custom_column_preview'], true); |
111 | 111 | |
112 | 112 | return $out; |
113 | 113 | } |
114 | 114 | |
115 | - public static function getContentArray ($entry) { |
|
115 | + public static function getContentArray($entry) { |
|
116 | 116 | if ($entry instanceof EntryBook) { |
117 | - $out = array ( "title" => $entry->title); |
|
118 | - $out ["book"] = self::getBookContentArray ($entry->book); |
|
117 | + $out = array("title" => $entry->title); |
|
118 | + $out ["book"] = self::getBookContentArray($entry->book); |
|
119 | 119 | return $out; |
120 | 120 | } |
121 | - return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
|
121 | + return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement); |
|
122 | 122 | } |
123 | 123 | |
124 | - public static function getContentArrayTypeahead ($page) { |
|
125 | - $out = array (); |
|
124 | + public static function getContentArrayTypeahead($page) { |
|
125 | + $out = array(); |
|
126 | 126 | foreach ($page->entryArray as $entry) { |
127 | 127 | if ($entry instanceof EntryBook) { |
128 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); |
|
128 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl())); |
|
129 | 129 | } else { |
130 | - if (empty ($entry->className) xor Base::noDatabaseSelected ()) { |
|
131 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ())); |
|
130 | + if (empty ($entry->className) xor Base::noDatabaseSelected()) { |
|
131 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink())); |
|
132 | 132 | } else { |
133 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ())); |
|
133 | + array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink())); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | } |
137 | 137 | return $out; |
138 | 138 | } |
139 | 139 | |
140 | - public static function addCompleteArray ($in) { |
|
140 | + public static function addCompleteArray($in) { |
|
141 | 141 | global $config; |
142 | 142 | $out = $in; |
143 | 143 | |
144 | - $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
|
144 | + $out ["c"] = array("version" => VERSION, "i18n" => array( |
|
145 | 145 | "coverAlt" => localize("i18n.coversection"), |
146 | 146 | "authorsTitle" => localize("authors.title"), |
147 | 147 | "bookwordTitle" => localize("bookword.title"), |
148 | 148 | "tagsTitle" => localize("tags.title"), |
149 | 149 | "seriesTitle" => localize("series.title"), |
150 | - "customizeTitle" => localize ("customize.title"), |
|
151 | - "aboutTitle" => localize ("about.title"), |
|
152 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
153 | - "nextAlt" => localize ("paging.next.alternate"), |
|
154 | - "searchAlt" => localize ("search.alternate"), |
|
155 | - "sortAlt" => localize ("sort.alternate"), |
|
156 | - "homeAlt" => localize ("home.alternate"), |
|
157 | - "cogAlt" => localize ("cog.alternate"), |
|
158 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
150 | + "customizeTitle" => localize("customize.title"), |
|
151 | + "aboutTitle" => localize("about.title"), |
|
152 | + "previousAlt" => localize("paging.previous.alternate"), |
|
153 | + "nextAlt" => localize("paging.next.alternate"), |
|
154 | + "searchAlt" => localize("search.alternate"), |
|
155 | + "sortAlt" => localize("sort.alternate"), |
|
156 | + "homeAlt" => localize("home.alternate"), |
|
157 | + "cogAlt" => localize("cog.alternate"), |
|
158 | + "permalinkAlt" => localize("permalink.alternate"), |
|
159 | 159 | "publisherName" => localize("publisher.name"), |
160 | 160 | "pubdateTitle" => localize("pubdate.title"), |
161 | 161 | "languagesTitle" => localize("language.title"), |
@@ -163,15 +163,15 @@ discard block |
||
163 | 163 | "sortorderAsc" => localize("search.sortorder.asc"), |
164 | 164 | "sortorderDesc" => localize("search.sortorder.desc"), |
165 | 165 | "customizeEmail" => localize("customize.email")), |
166 | - "url" => array ( |
|
166 | + "url" => array( |
|
167 | 167 | "detailUrl" => "index.php?page=13&id={0}&db={1}", |
168 | 168 | "coverUrl" => "fetch.php?id={0}&db={1}", |
169 | 169 | "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
170 | - "config" => array ( |
|
170 | + "config" => array( |
|
171 | 171 | "use_fancyapps" => $config ["cops_use_fancyapps"], |
172 | 172 | "max_item_per_page" => $config['cops_max_item_per_page'], |
173 | 173 | "kindleHack" => "", |
174 | - "server_side_rendering" => useServerSideRendering (), |
|
174 | + "server_side_rendering" => useServerSideRendering(), |
|
175 | 175 | "html_tag_filter" => $config['cops_html_tag_filter'])); |
176 | 176 | if ($config['cops_thumbnail_handling'] == "1") { |
177 | 177 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
@@ -184,32 +184,32 @@ discard block |
||
184 | 184 | return $out; |
185 | 185 | } |
186 | 186 | |
187 | - public static function getJson ($complete = false) { |
|
187 | + public static function getJson($complete = false) { |
|
188 | 188 | global $config; |
189 | - $page = getURLParam ("page", Base::PAGE_INDEX); |
|
190 | - $query = getURLParam ("query"); |
|
191 | - $search = getURLParam ("search"); |
|
192 | - $qid = getURLParam ("id"); |
|
193 | - $n = getURLParam ("n", "1"); |
|
194 | - $database = GetUrlParam (DB); |
|
189 | + $page = getURLParam("page", Base::PAGE_INDEX); |
|
190 | + $query = getURLParam("query"); |
|
191 | + $search = getURLParam("search"); |
|
192 | + $qid = getURLParam("id"); |
|
193 | + $n = getURLParam("n", "1"); |
|
194 | + $database = GetUrlParam(DB); |
|
195 | 195 | |
196 | - $currentPage = Page::getPage ($page, $qid, $query, $n); |
|
197 | - $currentPage->InitializeContent (); |
|
196 | + $currentPage = Page::getPage($page, $qid, $query, $n); |
|
197 | + $currentPage->InitializeContent(); |
|
198 | 198 | |
199 | 199 | if ($search) { |
200 | - return self::getContentArrayTypeahead ($currentPage); |
|
200 | + return self::getContentArrayTypeahead($currentPage); |
|
201 | 201 | } |
202 | 202 | |
203 | - $out = array ( "title" => $currentPage->title); |
|
204 | - $entries = array (); |
|
203 | + $out = array("title" => $currentPage->title); |
|
204 | + $entries = array(); |
|
205 | 205 | foreach ($currentPage->entryArray as $entry) { |
206 | - array_push ($entries, self::getContentArray ($entry)); |
|
206 | + array_push($entries, self::getContentArray($entry)); |
|
207 | 207 | } |
208 | - if (!is_null ($currentPage->book)) { |
|
209 | - $out ["book"] = self::getFullBookContentArray ($currentPage->book); |
|
208 | + if (!is_null($currentPage->book)) { |
|
209 | + $out ["book"] = self::getFullBookContentArray($currentPage->book); |
|
210 | 210 | } |
211 | - $out ["databaseId"] = GetUrlParam (DB, ""); |
|
212 | - $out ["databaseName"] = Base::getDbName (); |
|
211 | + $out ["databaseId"] = GetUrlParam(DB, ""); |
|
212 | + $out ["databaseName"] = Base::getDbName(); |
|
213 | 213 | if ($out ["databaseId"] == "") { |
214 | 214 | $out ["databaseName"] = ""; |
215 | 215 | } |
@@ -218,42 +218,42 @@ discard block |
||
218 | 218 | $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"]; |
219 | 219 | } |
220 | 220 | $out ["page"] = $page; |
221 | - $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0; |
|
221 | + $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0; |
|
222 | 222 | $out ["entries"] = $entries; |
223 | 223 | $out ["isPaginated"] = 0; |
224 | - if ($currentPage->isPaginated ()) { |
|
225 | - $prevLink = $currentPage->getPrevLink (); |
|
226 | - $nextLink = $currentPage->getNextLink (); |
|
224 | + if ($currentPage->isPaginated()) { |
|
225 | + $prevLink = $currentPage->getPrevLink(); |
|
226 | + $nextLink = $currentPage->getNextLink(); |
|
227 | 227 | $out ["isPaginated"] = 1; |
228 | 228 | $out ["prevLink"] = ""; |
229 | - if (!is_null ($prevLink)) { |
|
230 | - $out ["prevLink"] = $prevLink->hrefXhtml (); |
|
229 | + if (!is_null($prevLink)) { |
|
230 | + $out ["prevLink"] = $prevLink->hrefXhtml(); |
|
231 | 231 | } |
232 | 232 | $out ["nextLink"] = ""; |
233 | - if (!is_null ($nextLink)) { |
|
234 | - $out ["nextLink"] = $nextLink->hrefXhtml (); |
|
233 | + if (!is_null($nextLink)) { |
|
234 | + $out ["nextLink"] = $nextLink->hrefXhtml(); |
|
235 | 235 | } |
236 | - $out ["maxPage"] = $currentPage->getMaxPage (); |
|
236 | + $out ["maxPage"] = $currentPage->getMaxPage(); |
|
237 | 237 | $out ["currentPage"] = $currentPage->n; |
238 | 238 | } |
239 | - if (!is_null (getURLParam ("complete")) || $complete) { |
|
240 | - $out = self::addCompleteArray ($out); |
|
239 | + if (!is_null(getURLParam("complete")) || $complete) { |
|
240 | + $out = self::addCompleteArray($out); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $out ["containsBook"] = 0; |
244 | - if ($currentPage->containsBook ()) { |
|
244 | + if ($currentPage->containsBook()) { |
|
245 | 245 | $out ["containsBook"] = 1; |
246 | 246 | } |
247 | 247 | |
248 | - $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
248 | + $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
249 | 249 | |
250 | 250 | if ($page == Base::PAGE_ABOUT) { |
251 | - $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
251 | + $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
252 | 252 | $out ["fullhtml"] = $temp; |
253 | 253 | } |
254 | 254 | |
255 | 255 | $out ["homeurl"] = "index.php"; |
256 | - if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
256 | + if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database); |
|
257 | 257 | |
258 | 258 | return $out; |
259 | 259 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | if ($data = $book->getDataFormat ($format)) { |
25 | 25 | $i++; |
26 | 26 | array_push ($preferedData, array ("url" => $data->getHtmlLink (), |
27 | - "viewUrl" => $data->getViewHtmlLink (), "name" => $format)); |
|
27 | + "viewUrl" => $data->getViewHtmlLink (), "name" => $format)); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
53 | 53 | |
54 | 54 | return array ("id" => $book->id, |
55 | - "hasCover" => $book->hasCover, |
|
56 | - "preferedData" => $preferedData, |
|
57 | - "rating" => $book->getRating (), |
|
58 | - "publisherName" => $pn, |
|
59 | - "publisherurl" => $pu, |
|
60 | - "pubDate" => $book->getPubDate (), |
|
61 | - "languagesName" => $book->getLanguages (), |
|
62 | - "authorsName" => $book->getAuthorsName (), |
|
63 | - "tagsName" => $book->getTagsName (), |
|
64 | - "seriesName" => $sn, |
|
65 | - "seriesIndex" => $book->seriesIndex, |
|
66 | - "seriesCompleteName" => $scn, |
|
67 | - "seriesurl" => $su, |
|
68 | - "customcolumns_list" => $cc); |
|
55 | + "hasCover" => $book->hasCover, |
|
56 | + "preferedData" => $preferedData, |
|
57 | + "rating" => $book->getRating (), |
|
58 | + "publisherName" => $pn, |
|
59 | + "publisherurl" => $pu, |
|
60 | + "pubDate" => $book->getPubDate (), |
|
61 | + "languagesName" => $book->getLanguages (), |
|
62 | + "authorsName" => $book->getAuthorsName (), |
|
63 | + "tagsName" => $book->getTagsName (), |
|
64 | + "seriesName" => $sn, |
|
65 | + "seriesIndex" => $book->seriesIndex, |
|
66 | + "seriesCompleteName" => $scn, |
|
67 | + "seriesurl" => $su, |
|
68 | + "customcolumns_list" => $cc); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -142,45 +142,45 @@ discard block |
||
142 | 142 | $out = $in; |
143 | 143 | |
144 | 144 | $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
145 | - "coverAlt" => localize("i18n.coversection"), |
|
146 | - "authorsTitle" => localize("authors.title"), |
|
147 | - "bookwordTitle" => localize("bookword.title"), |
|
148 | - "tagsTitle" => localize("tags.title"), |
|
149 | - "seriesTitle" => localize("series.title"), |
|
150 | - "customizeTitle" => localize ("customize.title"), |
|
151 | - "aboutTitle" => localize ("about.title"), |
|
152 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
153 | - "nextAlt" => localize ("paging.next.alternate"), |
|
154 | - "searchAlt" => localize ("search.alternate"), |
|
155 | - "sortAlt" => localize ("sort.alternate"), |
|
156 | - "homeAlt" => localize ("home.alternate"), |
|
157 | - "cogAlt" => localize ("cog.alternate"), |
|
158 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
159 | - "publisherName" => localize("publisher.name"), |
|
160 | - "pubdateTitle" => localize("pubdate.title"), |
|
161 | - "languagesTitle" => localize("language.title"), |
|
162 | - "contentTitle" => localize("content.summary"), |
|
163 | - "filterClearAll" => localize("filter.clearall"), |
|
164 | - "sortorderAsc" => localize("search.sortorder.asc"), |
|
165 | - "sortorderDesc" => localize("search.sortorder.desc"), |
|
166 | - "customizeEmail" => localize("customize.email")), |
|
167 | - "url" => array ( |
|
168 | - "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
169 | - "coverUrl" => "fetch.php?id={0}&db={1}", |
|
170 | - "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
171 | - "config" => array ( |
|
172 | - "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
173 | - "max_item_per_page" => $config['cops_max_item_per_page'], |
|
174 | - "kindleHack" => "", |
|
175 | - "server_side_rendering" => useServerSideRendering (), |
|
176 | - "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
145 | + "coverAlt" => localize("i18n.coversection"), |
|
146 | + "authorsTitle" => localize("authors.title"), |
|
147 | + "bookwordTitle" => localize("bookword.title"), |
|
148 | + "tagsTitle" => localize("tags.title"), |
|
149 | + "seriesTitle" => localize("series.title"), |
|
150 | + "customizeTitle" => localize ("customize.title"), |
|
151 | + "aboutTitle" => localize ("about.title"), |
|
152 | + "previousAlt" => localize ("paging.previous.alternate"), |
|
153 | + "nextAlt" => localize ("paging.next.alternate"), |
|
154 | + "searchAlt" => localize ("search.alternate"), |
|
155 | + "sortAlt" => localize ("sort.alternate"), |
|
156 | + "homeAlt" => localize ("home.alternate"), |
|
157 | + "cogAlt" => localize ("cog.alternate"), |
|
158 | + "permalinkAlt" => localize ("permalink.alternate"), |
|
159 | + "publisherName" => localize("publisher.name"), |
|
160 | + "pubdateTitle" => localize("pubdate.title"), |
|
161 | + "languagesTitle" => localize("language.title"), |
|
162 | + "contentTitle" => localize("content.summary"), |
|
163 | + "filterClearAll" => localize("filter.clearall"), |
|
164 | + "sortorderAsc" => localize("search.sortorder.asc"), |
|
165 | + "sortorderDesc" => localize("search.sortorder.desc"), |
|
166 | + "customizeEmail" => localize("customize.email")), |
|
167 | + "url" => array ( |
|
168 | + "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
169 | + "coverUrl" => "fetch.php?id={0}&db={1}", |
|
170 | + "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
171 | + "config" => array ( |
|
172 | + "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
173 | + "max_item_per_page" => $config['cops_max_item_per_page'], |
|
174 | + "kindleHack" => "", |
|
175 | + "server_side_rendering" => useServerSideRendering (), |
|
176 | + "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
177 | 177 | if ($config['cops_thumbnail_handling'] == "1") { |
178 | 178 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
179 | 179 | } else if (!empty ($config['cops_thumbnail_handling'])) { |
180 | 180 | $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling']; |
181 | 181 | } |
182 | 182 | if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) { |
183 | - $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
183 | + $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
184 | 184 | } |
185 | 185 | return $out; |
186 | 186 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | if (!is_null (getURLParam ("complete")) || $complete) { |
241 | 241 | $out = self::addCompleteArray ($out); |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | 244 | $out ["containsBook"] = 0; |
245 | 245 | if ($currentPage->containsBook ()) { |
@@ -8,14 +8,14 @@ |
||
8 | 8 | |
9 | 9 | class PageAllBooks extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | - $this->title = localize ("allbooks.title"); |
|
14 | - if (getCurrentOption ("titles_split_first_letter") == 1) { |
|
13 | + $this->title = localize("allbooks.title"); |
|
14 | + if (getCurrentOption("titles_split_first_letter") == 1) { |
|
15 | 15 | $this->entryArray = Book::getAllBooks(); |
16 | 16 | } |
17 | 17 | else { |
18 | - list ($this->entryArray, $this->totalNumber) = Book::getBooks ($this->n); |
|
18 | + list ($this->entryArray, $this->totalNumber) = Book::getBooks($this->n); |
|
19 | 19 | } |
20 | 20 | $this->idPage = Book::ALL_BOOKS_ID; |
21 | 21 | } |
@@ -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; |
@@ -22,45 +22,45 @@ |
||
22 | 22 | $this->name = $post->name; |
23 | 23 | } |
24 | 24 | |
25 | - public function getUri () { |
|
26 | - return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id"; |
|
25 | + public function getUri() { |
|
26 | + return "?page=" . parent::PAGE_PUBLISHER_DETAIL . "&id=$this->id"; |
|
27 | 27 | } |
28 | 28 | |
29 | - public function getEntryId () { |
|
30 | - return self::ALL_PUBLISHERS_ID.":".$this->id; |
|
29 | + public function getEntryId() { |
|
30 | + return self::ALL_PUBLISHERS_ID . ":" . $this->id; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public static function getCount() { |
34 | 34 | // str_format (localize("publishers.alphabetical", count(array)) |
35 | - return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
|
35 | + return parent::getCountGeneric("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
|
36 | 36 | } |
37 | 37 | |
38 | - public static function getPublisherByBookId ($bookId) { |
|
39 | - $result = parent::getDb ()->prepare('select publishers.id as id, name |
|
38 | + public static function getPublisherByBookId($bookId) { |
|
39 | + $result = parent::getDb()->prepare('select publishers.id as id, name |
|
40 | 40 | from books_publishers_link, publishers |
41 | 41 | where publishers.id = publisher and book = ?'); |
42 | - $result->execute (array ($bookId)); |
|
43 | - if ($post = $result->fetchObject ()) { |
|
44 | - return new Publisher ($post); |
|
42 | + $result->execute(array($bookId)); |
|
43 | + if ($post = $result->fetchObject()) { |
|
44 | + return new Publisher($post); |
|
45 | 45 | } |
46 | 46 | return NULL; |
47 | 47 | } |
48 | 48 | |
49 | - public static function getPublisherById ($publisherId) { |
|
50 | - $result = parent::getDb ()->prepare('select id, name |
|
49 | + public static function getPublisherById($publisherId) { |
|
50 | + $result = parent::getDb()->prepare('select id, name |
|
51 | 51 | from publishers where id = ?'); |
52 | - $result->execute (array ($publisherId)); |
|
53 | - if ($post = $result->fetchObject ()) { |
|
54 | - return new Publisher ($post); |
|
52 | + $result->execute(array($publisherId)); |
|
53 | + if ($post = $result->fetchObject()) { |
|
54 | + return new Publisher($post); |
|
55 | 55 | } |
56 | 56 | return NULL; |
57 | 57 | } |
58 | 58 | |
59 | 59 | public static function getAllPublishers() { |
60 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher"); |
|
60 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array(), "Publisher"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public static function getAllPublishersByQuery($query) { |
64 | - return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher"); |
|
64 | + return Base::getEntryArrayWithBookNumber(self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array('%' . $query . '%'), "Publisher"); |
|
65 | 65 | } |
66 | 66 | } |
@@ -17,25 +17,30 @@ discard block |
||
17 | 17 | public $id; |
18 | 18 | public $name; |
19 | 19 | |
20 | - public function __construct($post) { |
|
20 | + public function __construct($post) |
|
21 | + { |
|
21 | 22 | $this->id = $post->id; |
22 | 23 | $this->name = $post->name; |
23 | 24 | } |
24 | 25 | |
25 | - public function getUri () { |
|
26 | + public function getUri () |
|
27 | + { |
|
26 | 28 | return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id"; |
27 | 29 | } |
28 | 30 | |
29 | - public function getEntryId () { |
|
31 | + public function getEntryId () |
|
32 | + { |
|
30 | 33 | return self::ALL_PUBLISHERS_ID.":".$this->id; |
31 | 34 | } |
32 | 35 | |
33 | - public static function getCount() { |
|
36 | + public static function getCount() |
|
37 | + { |
|
34 | 38 | // str_format (localize("publishers.alphabetical", count(array)) |
35 | 39 | return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
36 | 40 | } |
37 | 41 | |
38 | - public static function getPublisherByBookId ($bookId) { |
|
42 | + public static function getPublisherByBookId ($bookId) |
|
43 | + { |
|
39 | 44 | $result = parent::getDb ()->prepare('select publishers.id as id, name |
40 | 45 | from books_publishers_link, publishers |
41 | 46 | where publishers.id = publisher and book = ?'); |
@@ -46,7 +51,8 @@ discard block |
||
46 | 51 | return NULL; |
47 | 52 | } |
48 | 53 | |
49 | - public static function getPublisherById ($publisherId) { |
|
54 | + public static function getPublisherById ($publisherId) |
|
55 | + { |
|
50 | 56 | $result = parent::getDb ()->prepare('select id, name |
51 | 57 | from publishers where id = ?'); |
52 | 58 | $result->execute (array ($publisherId)); |
@@ -56,11 +62,13 @@ discard block |
||
56 | 62 | return NULL; |
57 | 63 | } |
58 | 64 | |
59 | - public static function getAllPublishers() { |
|
65 | + public static function getAllPublishers() |
|
66 | + { |
|
60 | 67 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher"); |
61 | 68 | } |
62 | 69 | |
63 | - public static function getAllPublishersByQuery($query) { |
|
70 | + public static function getAllPublishersByQuery($query) |
|
71 | + { |
|
64 | 72 | return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher"); |
65 | 73 | } |
66 | 74 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if ($post = $result->fetchObject ()) { |
44 | 44 | return new Publisher ($post); |
45 | 45 | } |
46 | - return NULL; |
|
46 | + return null; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public static function getPublisherById ($publisherId) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if ($post = $result->fetchObject ()) { |
54 | 54 | return new Publisher ($post); |
55 | 55 | } |
56 | - return NULL; |
|
56 | + return null; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public static function getAllPublishers() { |
@@ -60,6 +60,9 @@ |
||
60 | 60 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher"); |
61 | 61 | } |
62 | 62 | |
63 | + /** |
|
64 | + * @param string $query |
|
65 | + */ |
|
63 | 66 | public static function getAllPublishersByQuery($query) { |
64 | 67 | return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher"); |
65 | 68 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | |
9 | 9 | class PagePublisherDetail extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | - $publisher = Publisher::getPublisherById ($this->idGet); |
|
13 | + $publisher = Publisher::getPublisherById($this->idGet); |
|
14 | 14 | $this->title = $publisher->name; |
15 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByPublisher ($this->idGet, $this->n); |
|
16 | - $this->idPage = $publisher->getEntryId (); |
|
15 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByPublisher($this->idGet, $this->n); |
|
16 | + $this->idPage = $publisher->getEntryId(); |
|
17 | 17 | } |
18 | 18 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllRating extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("ratings.title"); |
14 | 14 | $this->entryArray = Rating::getAllRatings(); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllTags extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("tags.title"); |
14 | 14 | $this->entryArray = Tag::getAllTags(); |
@@ -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 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | |
9 | 9 | class PageLanguageDetail extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | - $language = Language::getLanguageById ($this->idGet); |
|
14 | - $this->idPage = $language->getEntryId (); |
|
13 | + $language = Language::getLanguageById($this->idGet); |
|
14 | + $this->idPage = $language->getEntryId(); |
|
15 | 15 | $this->title = $language->lang_code; |
16 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage ($this->idGet, $this->n); |
|
16 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage($this->idGet, $this->n); |
|
17 | 17 | } |
18 | 18 | } |