@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | |
22 | 22 | public function getUri() |
23 | 23 | { |
24 | - return "?page=".parent::PAGE_LANGUAGE_DETAIL."&id=$this->id"; |
|
24 | + return "?page=" . parent::PAGE_LANGUAGE_DETAIL . "&id=$this->id"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function getEntryId() |
28 | 28 | { |
29 | - return self::ALL_LANGUAGES_ID.":".$this->id; |
|
29 | + return self::ALL_LANGUAGES_ID . ":" . $this->id; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public static function getLanguageString($code) |
33 | 33 | { |
34 | - $string = localize("languages.".$code); |
|
34 | + $string = localize("languages." . $code); |
|
35 | 35 | if (preg_match("/^languages/", $string)) { |
36 | 36 | return $code; |
37 | 37 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $language->getEntryId(), |
72 | 72 | str_format(localize("bookword", $post->count), $post->count), |
73 | 73 | "text", |
74 | - [ new LinkNavigation($language->getUri())], |
|
74 | + [new LinkNavigation($language->getUri())], |
|
75 | 75 | "", |
76 | 76 | $post->count |
77 | 77 | )); |
@@ -117,7 +117,7 @@ |
||
117 | 117 | $content = ""; |
118 | 118 | foreach ($ignoredBaseArray as $key) { |
119 | 119 | $keyPlural = preg_replace('/(ss)$/', 's', $key . "s"); |
120 | - $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked("ignored_categories", $key) . ' > ' . localize("{$keyPlural}.title") . '</input> '; |
|
120 | + $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked("ignored_categories", $key) . ' > ' . localize("{$keyPlural}.title") . '</input> '; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | array_push($this->entryArray, new Entry( |
@@ -59,11 +59,11 @@ |
||
59 | 59 | $this->entryArray = []; |
60 | 60 | |
61 | 61 | $ignoredBaseArray = [PageQueryResult::SCOPE_AUTHOR, |
62 | - PageQueryResult::SCOPE_TAG, |
|
63 | - PageQueryResult::SCOPE_SERIES, |
|
64 | - PageQueryResult::SCOPE_PUBLISHER, |
|
65 | - PageQueryResult::SCOPE_RATING, |
|
66 | - "language"]; |
|
62 | + PageQueryResult::SCOPE_TAG, |
|
63 | + PageQueryResult::SCOPE_SERIES, |
|
64 | + PageQueryResult::SCOPE_PUBLISHER, |
|
65 | + PageQueryResult::SCOPE_RATING, |
|
66 | + "language"]; |
|
67 | 67 | |
68 | 68 | $content = ""; |
69 | 69 | if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { |
@@ -24,12 +24,12 @@ |
||
24 | 24 | |
25 | 25 | public function getUri() |
26 | 26 | { |
27 | - return "?page=".parent::PAGE_SERIE_DETAIL."&id=$this->id"; |
|
27 | + return "?page=" . parent::PAGE_SERIE_DETAIL . "&id=$this->id"; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function getEntryId() |
31 | 31 | { |
32 | - return self::ALL_SERIES_ID.":".$this->id; |
|
32 | + return self::ALL_SERIES_ID . ":" . $this->id; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public static function getCount() |
@@ -25,12 +25,12 @@ |
||
25 | 25 | |
26 | 26 | public function getUri() |
27 | 27 | { |
28 | - return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id"; |
|
28 | + return "?page=" . parent::PAGE_PUBLISHER_DETAIL . "&id=$this->id"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function getEntryId() |
32 | 32 | { |
33 | - return self::ALL_PUBLISHERS_ID.":".$this->id; |
|
33 | + return self::ALL_PUBLISHERS_ID . ":" . $this->id; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public static function getCount() |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | public static function getContentArray($entry) |
119 | 119 | { |
120 | 120 | if ($entry instanceof EntryBook) { |
121 | - $out = [ "title" => $entry->title]; |
|
121 | + $out = ["title" => $entry->title]; |
|
122 | 122 | $out ["book"] = self::getBookContentArray($entry->book); |
123 | 123 | return $out; |
124 | 124 | } |
125 | - return [ "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement ]; |
|
125 | + return ["title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement]; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | public static function getContentArrayTypeahead($page) |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return self::getContentArrayTypeahead($currentPage); |
209 | 209 | } |
210 | 210 | |
211 | - $out = [ "title" => $currentPage->title]; |
|
211 | + $out = ["title" => $currentPage->title]; |
|
212 | 212 | $entries = []; |
213 | 213 | foreach ($currentPage->entryArray as $entry) { |
214 | 214 | array_push($entries, self::getContentArray($entry)); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"]; |
227 | 227 | } |
228 | 228 | $out ["page"] = $page; |
229 | - $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled() ? 1 : 0; |
|
229 | + $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0; |
|
230 | 230 | $out ["entries"] = $entries; |
231 | 231 | $out ["isPaginated"] = 0; |
232 | 232 | if ($currentPage->isPaginated()) { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | $out ["homeurl"] = "index.php"; |
264 | 264 | if ($page != Base::PAGE_INDEX && !is_null($database)) { |
265 | - $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database); |
|
265 | + $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | return $out; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ($data = $book->getDataFormat($format)) { |
27 | 27 | $i++; |
28 | 28 | array_push($preferedData, ["url" => $data->getHtmlLink(), |
29 | - "viewUrl" => $data->getViewHtmlLink(), "name" => $format]); |
|
29 | + "viewUrl" => $data->getViewHtmlLink(), "name" => $format]); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
55 | 55 | |
56 | 56 | return ["id" => $book->id, |
57 | - "hasCover" => $book->hasCover, |
|
58 | - "preferedData" => $preferedData, |
|
59 | - "rating" => $book->getRating(), |
|
60 | - "publisherName" => $pn, |
|
61 | - "publisherurl" => $pu, |
|
62 | - "pubDate" => $book->getPubDate(), |
|
63 | - "languagesName" => $book->getLanguages(), |
|
64 | - "authorsName" => $book->getAuthorsName(), |
|
65 | - "tagsName" => $book->getTagsName(), |
|
66 | - "seriesName" => $sn, |
|
67 | - "seriesIndex" => $book->seriesIndex, |
|
68 | - "seriesCompleteName" => $scn, |
|
69 | - "seriesurl" => $su, |
|
70 | - "customcolumns_list" => $cc]; |
|
57 | + "hasCover" => $book->hasCover, |
|
58 | + "preferedData" => $preferedData, |
|
59 | + "rating" => $book->getRating(), |
|
60 | + "publisherName" => $pn, |
|
61 | + "publisherurl" => $pu, |
|
62 | + "pubDate" => $book->getPubDate(), |
|
63 | + "languagesName" => $book->getLanguages(), |
|
64 | + "authorsName" => $book->getAuthorsName(), |
|
65 | + "tagsName" => $book->getTagsName(), |
|
66 | + "seriesName" => $sn, |
|
67 | + "seriesIndex" => $book->seriesIndex, |
|
68 | + "seriesCompleteName" => $scn, |
|
69 | + "seriesurl" => $su, |
|
70 | + "customcolumns_list" => $cc]; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -154,39 +154,39 @@ discard block |
||
154 | 154 | $out = $in; |
155 | 155 | |
156 | 156 | $out ["c"] = ["version" => VERSION, "i18n" => [ |
157 | - "coverAlt" => localize("i18n.coversection"), |
|
158 | - "authorsTitle" => localize("authors.title"), |
|
159 | - "bookwordTitle" => localize("bookword.title"), |
|
160 | - "tagsTitle" => localize("tags.title"), |
|
161 | - "linksTitle" => localize("links.title"), |
|
162 | - "seriesTitle" => localize("series.title"), |
|
163 | - "customizeTitle" => localize("customize.title"), |
|
164 | - "aboutTitle" => localize("about.title"), |
|
165 | - "previousAlt" => localize("paging.previous.alternate"), |
|
166 | - "nextAlt" => localize("paging.next.alternate"), |
|
167 | - "searchAlt" => localize("search.alternate"), |
|
168 | - "sortAlt" => localize("sort.alternate"), |
|
169 | - "homeAlt" => localize("home.alternate"), |
|
170 | - "cogAlt" => localize("cog.alternate"), |
|
171 | - "permalinkAlt" => localize("permalink.alternate"), |
|
172 | - "publisherName" => localize("publisher.name"), |
|
173 | - "pubdateTitle" => localize("pubdate.title"), |
|
174 | - "languagesTitle" => localize("language.title"), |
|
175 | - "contentTitle" => localize("content.summary"), |
|
176 | - "filterClearAll" => localize("filter.clearall"), |
|
177 | - "sortorderAsc" => localize("search.sortorder.asc"), |
|
178 | - "sortorderDesc" => localize("search.sortorder.desc"), |
|
179 | - "customizeEmail" => localize("customize.email")], |
|
180 | - "url" => [ |
|
181 | - "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
182 | - "coverUrl" => "fetch.php?id={0}&db={1}", |
|
183 | - "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"], |
|
184 | - "config" => [ |
|
185 | - "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
186 | - "max_item_per_page" => $config['cops_max_item_per_page'], |
|
187 | - "kindleHack" => "", |
|
188 | - "server_side_rendering" => useServerSideRendering(), |
|
189 | - "html_tag_filter" => $config['cops_html_tag_filter']]]; |
|
157 | + "coverAlt" => localize("i18n.coversection"), |
|
158 | + "authorsTitle" => localize("authors.title"), |
|
159 | + "bookwordTitle" => localize("bookword.title"), |
|
160 | + "tagsTitle" => localize("tags.title"), |
|
161 | + "linksTitle" => localize("links.title"), |
|
162 | + "seriesTitle" => localize("series.title"), |
|
163 | + "customizeTitle" => localize("customize.title"), |
|
164 | + "aboutTitle" => localize("about.title"), |
|
165 | + "previousAlt" => localize("paging.previous.alternate"), |
|
166 | + "nextAlt" => localize("paging.next.alternate"), |
|
167 | + "searchAlt" => localize("search.alternate"), |
|
168 | + "sortAlt" => localize("sort.alternate"), |
|
169 | + "homeAlt" => localize("home.alternate"), |
|
170 | + "cogAlt" => localize("cog.alternate"), |
|
171 | + "permalinkAlt" => localize("permalink.alternate"), |
|
172 | + "publisherName" => localize("publisher.name"), |
|
173 | + "pubdateTitle" => localize("pubdate.title"), |
|
174 | + "languagesTitle" => localize("language.title"), |
|
175 | + "contentTitle" => localize("content.summary"), |
|
176 | + "filterClearAll" => localize("filter.clearall"), |
|
177 | + "sortorderAsc" => localize("search.sortorder.asc"), |
|
178 | + "sortorderDesc" => localize("search.sortorder.desc"), |
|
179 | + "customizeEmail" => localize("customize.email")], |
|
180 | + "url" => [ |
|
181 | + "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
182 | + "coverUrl" => "fetch.php?id={0}&db={1}", |
|
183 | + "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"], |
|
184 | + "config" => [ |
|
185 | + "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
186 | + "max_item_per_page" => $config['cops_max_item_per_page'], |
|
187 | + "kindleHack" => "", |
|
188 | + "server_side_rendering" => useServerSideRendering(), |
|
189 | + "html_tag_filter" => $config['cops_html_tag_filter']]]; |
|
190 | 190 | if ($config['cops_thumbnail_handling'] == "1") { |
191 | 191 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
192 | 192 | } elseif (!empty($config['cops_thumbnail_handling'])) { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | public static function getDbFileName($database = null) |
113 | 113 | { |
114 | - return self::getDbDirectory($database) .'metadata.db'; |
|
114 | + return self::getDbDirectory($database) . 'metadata.db'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | private static function error($database) |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if (is_null(self::$db)) { |
128 | 128 | try { |
129 | 129 | if (is_readable(self::getDbFileName($database))) { |
130 | - self::$db = new PDO('sqlite:'. self::getDbFileName($database)); |
|
130 | + self::$db = new PDO('sqlite:' . self::getDbFileName($database)); |
|
131 | 131 | if (useNormAndUp()) { |
132 | 132 | self::$db->sqliteCreateFunction('normAndUp', 'normAndUp', 1); |
133 | 133 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $id, |
179 | 179 | str_format(localize($numberOfString, $count), $count), |
180 | 180 | "text", |
181 | - [ new LinkNavigation("?page=".$pageId)], |
|
181 | + [new LinkNavigation("?page=" . $pageId)], |
|
182 | 182 | "", |
183 | 183 | $count |
184 | 184 | ); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $instance->getEntryId(), |
206 | 206 | str_format(localize("bookword", $post->count), $post->count), |
207 | 207 | "text", |
208 | - [ new LinkNavigation($instance->getUri())], |
|
208 | + [new LinkNavigation($instance->getUri())], |
|
209 | 209 | "", |
210 | 210 | $post->count |
211 | 211 | )); |
@@ -11,8 +11,8 @@ |
||
11 | 11 | // PHP pre 5.6 does not support const arrays |
12 | 12 | private $BOOLEAN_NAMES = [ |
13 | 13 | -1 => "customcolumn.boolean.unknown", // localize("customcolumn.boolean.unknown") |
14 | - 0 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no") |
|
15 | - +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes") |
|
14 | + 0 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no") |
|
15 | + +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes") |
|
16 | 16 | ]; |
17 | 17 | |
18 | 18 | protected function __construct($pcustomId) |
@@ -37,13 +37,13 @@ |
||
37 | 37 | Monocle.DEBUG = true; |
38 | 38 | var bookData = { |
39 | 39 | getComponents: function() { |
40 | - <?php echo 'return [' . implode(', ', array_map(function ($comp) { |
|
40 | + <?php echo 'return [' . implode(', ', array_map(function($comp) { |
|
41 | 41 | return "'" . $comp . "'"; |
42 | 42 | }, $book->components())) . '];'; ?> |
43 | 43 | }, |
44 | 44 | getContents: function() { |
45 | - <?php echo 'return [' . implode(', ', array_map(function ($content) { |
|
46 | - return "{title: '" . addslashes($content['title']) . "', src: '". $content['src'] . "'}"; |
|
45 | + <?php echo 'return [' . implode(', ', array_map(function($content) { |
|
46 | + return "{title: '" . addslashes($content['title']) . "', src: '" . $content['src'] . "'}"; |
|
47 | 47 | }, $book->contents())) . '];'; ?> |
48 | 48 | }, |
49 | 49 | getComponent: function (componentId) { |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | // Generate the function for the template |
34 | 34 | $template = new doT(); |
35 | 35 | $dot = $template->template($page, ['bookdetail' => $bookdetail, |
36 | - 'header' => $header, |
|
37 | - 'footer' => $footer, |
|
38 | - 'main' => $main]); |
|
36 | + 'header' => $header, |
|
37 | + 'footer' => $footer, |
|
38 | + 'main' => $main]); |
|
39 | 39 | // If there is a syntax error in the function created |
40 | 40 | // $dot will be equal to FALSE |
41 | 41 | if (!$dot) { |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $return .= trim($error->message) . |
138 | - "\n Line: " . $error->line . |
|
139 | - "\n Column: " . $error->column; |
|
138 | + "\n Line: " . $error->line . |
|
139 | + "\n Column: " . $error->column; |
|
140 | 140 | |
141 | 141 | if ($error->file) { |
142 | 142 | $return .= "\n File: " . $error->file; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | function notFound() |
61 | 61 | { |
62 | - header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); |
|
62 | + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); |
|
63 | 63 | header('Status: 404 Not Found'); |
64 | 64 | |
65 | 65 | $_SERVER['REDIRECT_STATUS'] = 404; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | function xml2xhtml($xml) |
109 | 109 | { |
110 | - return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', function ($m) { |
|
110 | + return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', function($m) { |
|
111 | 111 | $xhtml_tags = ['br', 'hr', 'input', 'frame', 'img', 'area', 'link', 'col', 'base', 'basefont', 'param']; |
112 | 112 | if (in_array($m[1], $xhtml_tags)) { |
113 | 113 | return '<' . $m[1] . $m[2] . ' />'; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | libxml_use_internal_errors(true); |
164 | 164 | |
165 | 165 | $doc->loadHTML('<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>' . |
166 | - $html . '</body></html>'); // Load the HTML |
|
166 | + $html . '</body></html>'); // Load the HTML |
|
167 | 167 | $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream |
168 | 168 | $output = xml2xhtml($output); |
169 | 169 | if (preg_match('#<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></meta></head><body>(.*)</body></html>#ms', $output, $matches)) { |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | //echo var_dump($langs); |
271 | 271 | $lang_file = null; |
272 | 272 | foreach ($langs as $language => $val) { |
273 | - $temp_file = dirname(__FILE__). '/lang/Localization_' . $language . '.json'; |
|
273 | + $temp_file = dirname(__FILE__) . '/lang/Localization_' . $language . '.json'; |
|
274 | 274 | if (file_exists($temp_file)) { |
275 | 275 | $lang = $language; |
276 | 276 | $lang_file = $temp_file; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | } |
280 | 280 | if (empty($lang_file)) { |
281 | - $lang_file = dirname(__FILE__). '/lang/Localization_' . $lang . '.json'; |
|
281 | + $lang_file = dirname(__FILE__) . '/lang/Localization_' . $lang . '.json'; |
|
282 | 282 | } |
283 | 283 | return [$lang, $lang_file]; |
284 | 284 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * This method is based on this page |
288 | 288 | * http://www.mind-it.info/2010/02/22/a-simple-approach-to-localization-in-php/ |
289 | 289 | */ |
290 | -function localize($phrase, $count=-1, $reset=false) |
|
290 | +function localize($phrase, $count = -1, $reset = false) |
|
291 | 291 | { |
292 | 292 | global $config; |
293 | 293 | if ($count == 0) { |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $lang_file_en = null; |
311 | 311 | [$lang, $lang_file] = getLangAndTranslationFile(); |
312 | 312 | if ($lang != 'en') { |
313 | - $lang_file_en = dirname(__FILE__). '/lang/' . 'Localization_en.json'; |
|
313 | + $lang_file_en = dirname(__FILE__) . '/lang/' . 'Localization_en.json'; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | $lang_file_content = file_get_contents($lang_file); |