@@ -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 | /* @var $link LinkNavigation */ |
| 47 | 49 | |
@@ -52,7 +54,8 @@ discard block |
||
| 52 | 54 | return "#"; |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | - public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) { |
|
| 57 | + public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) |
|
| 58 | + { |
|
| 56 | 59 | global $config; |
| 57 | 60 | $this->title = $ptitle; |
| 58 | 61 | $this->id = $pid; |
@@ -62,10 +65,8 @@ discard block |
||
| 62 | 65 | $this->className = $pclass; |
| 63 | 66 | $this->numberOfElement = $pcount; |
| 64 | 67 | |
| 65 | - if ($config['cops_show_icons'] == 1) |
|
| 66 | - { |
|
| 67 | - foreach (self::$icons as $reg => $image) |
|
| 68 | - { |
|
| 68 | + if ($config['cops_show_icons'] == 1) { |
|
| 69 | + foreach (self::$icons as $reg => $image) { |
|
| 69 | 70 | if (preg_match ("/" . $reg . "/", $pid)) { |
| 70 | 71 | array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
| 71 | 72 | break; |
@@ -73,6 +74,8 @@ discard block |
||
| 73 | 74 | } |
| 74 | 75 | } |
| 75 | 76 | |
| 76 | - if (!is_null (GetUrlParam (DB))) $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
| 77 | + if (!is_null (GetUrlParam (DB))) { |
|
| 78 | + $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
| 79 | + } |
|
| 77 | 80 | } |
| 78 | 81 | } |
@@ -62,7 +62,9 @@ |
||
| 62 | 62 | public function getDescription() |
| 63 | 63 | { |
| 64 | 64 | $desc = $this->getDatabaseDescription(); |
| 65 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 65 | + if ($desc === NULL || empty($desc)) { |
|
| 66 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 67 | + } |
|
| 66 | 68 | return $desc; |
| 67 | 69 | } |
| 68 | 70 | |
@@ -62,7 +62,9 @@ |
||
| 62 | 62 | public function getDescription() |
| 63 | 63 | { |
| 64 | 64 | $desc = $this->getDatabaseDescription(); |
| 65 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 65 | + if ($desc === NULL || empty($desc)) { |
|
| 66 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 67 | + } |
|
| 66 | 68 | return $desc; |
| 67 | 69 | } |
| 68 | 70 | |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $result = Base::getDb()->query($query); |
| 69 | 69 | $entryArray = array(); |
| 70 | - while ($post = $result->fetchObject()) |
|
| 71 | - { |
|
| 70 | + while ($post = $result->fetchObject()) { |
|
| 72 | 71 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 73 | 72 | $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
| 74 | 73 | |
@@ -82,7 +81,9 @@ discard block |
||
| 82 | 81 | public function getDescription() |
| 83 | 82 | { |
| 84 | 83 | $desc = $this->getDatabaseDescription(); |
| 85 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 84 | + if ($desc === NULL || empty($desc)) { |
|
| 85 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 86 | + } |
|
| 86 | 87 | return $desc; |
| 87 | 88 | } |
| 88 | 89 | |
@@ -78,7 +78,8 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function __construct($pid, $pquery, $pn) { |
|
| 81 | + public function __construct($pid, $pquery, $pn) |
|
| 82 | + { |
|
| 82 | 83 | global $config; |
| 83 | 84 | |
| 84 | 85 | $this->idGet = $pid; |
@@ -111,23 +112,33 @@ discard block |
||
| 111 | 112 | } |
| 112 | 113 | if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) { |
| 113 | 114 | $series = Serie::getCount(); |
| 114 | - if (!is_null ($series)) array_push ($this->entryArray, $series); |
|
| 115 | + if (!is_null ($series)) { |
|
| 116 | + array_push ($this->entryArray, $series); |
|
| 117 | + } |
|
| 115 | 118 | } |
| 116 | 119 | if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) { |
| 117 | 120 | $publisher = Publisher::getCount(); |
| 118 | - if (!is_null ($publisher)) array_push ($this->entryArray, $publisher); |
|
| 121 | + if (!is_null ($publisher)) { |
|
| 122 | + array_push ($this->entryArray, $publisher); |
|
| 123 | + } |
|
| 119 | 124 | } |
| 120 | 125 | if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) { |
| 121 | 126 | $tags = Tag::getCount(); |
| 122 | - if (!is_null ($tags)) array_push ($this->entryArray, $tags); |
|
| 127 | + if (!is_null ($tags)) { |
|
| 128 | + array_push ($this->entryArray, $tags); |
|
| 129 | + } |
|
| 123 | 130 | } |
| 124 | 131 | if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) { |
| 125 | 132 | $rating = Rating::getCount(); |
| 126 | - if (!is_null ($rating)) array_push ($this->entryArray, $rating); |
|
| 133 | + if (!is_null ($rating)) { |
|
| 134 | + array_push ($this->entryArray, $rating); |
|
| 135 | + } |
|
| 127 | 136 | } |
| 128 | 137 | if (!in_array ("language", getCurrentOption ('ignored_categories'))) { |
| 129 | 138 | $languages = Language::getCount(); |
| 130 | - if (!is_null ($languages)) array_push ($this->entryArray, $languages); |
|
| 139 | + if (!is_null ($languages)) { |
|
| 140 | + array_push ($this->entryArray, $languages); |
|
| 141 | + } |
|
| 131 | 142 | } |
| 132 | 143 | foreach ($config['cops_calibre_custom_column'] as $lookup) { |
| 133 | 144 | $customColumn = CustomColumnType::createByLookup($lookup); |
@@ -137,7 +148,9 @@ discard block |
||
| 137 | 148 | } |
| 138 | 149 | $this->entryArray = array_merge ($this->entryArray, Book::getCount()); |
| 139 | 150 | |
| 140 | - if (Base::isMultipleDatabaseEnabled ()) $this->title = Base::getDbName (); |
|
| 151 | + if (Base::isMultipleDatabaseEnabled ()) { |
|
| 152 | + $this->title = Base::getDbName (); |
|
| 153 | + } |
|
| 141 | 154 | } |
| 142 | 155 | } |
| 143 | 156 | |
@@ -173,8 +186,12 @@ discard block |
||
| 173 | 186 | |
| 174 | 187 | public function containsBook () |
| 175 | 188 | { |
| 176 | - if (count ($this->entryArray) == 0) return false; |
|
| 177 | - if (get_class ($this->entryArray [0]) == "EntryBook") return true; |
|
| 189 | + if (count ($this->entryArray) == 0) { |
|
| 190 | + return false; |
|
| 191 | + } |
|
| 192 | + if (get_class ($this->entryArray [0]) == "EntryBook") { |
|
| 193 | + return true; |
|
| 194 | + } |
|
| 178 | 195 | return false; |
| 179 | 196 | } |
| 180 | 197 | } |
@@ -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=".Base::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 Base::getCountGeneric ("authors", self::ALL_AUTHORS_ID, Base::PAGE_ALL_AUTHORS); |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | - public static function getAllAuthorsByFirstLetter() { |
|
| 50 | + public static function getAllAuthorsByFirstLetter() |
|
| 51 | + { |
|
| 46 | 52 | list (, $result) = Base::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=".Base::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 = Base::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 = Base::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 = ?'); |
@@ -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 | } |
@@ -62,7 +62,9 @@ |
||
| 62 | 62 | public function getDescription() |
| 63 | 63 | { |
| 64 | 64 | $desc = $this->getDatabaseDescription(); |
| 65 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 65 | + if ($desc === NULL || empty($desc)) { |
|
| 66 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
| 67 | + } |
|
| 66 | 68 | return $desc; |
| 67 | 69 | } |
| 68 | 70 | |
@@ -13,20 +13,24 @@ discard block |
||
| 13 | 13 | public $id; |
| 14 | 14 | public $lang_code; |
| 15 | 15 | |
| 16 | - public function __construct($pid, $plang_code) { |
|
| 16 | + public function __construct($pid, $plang_code) |
|
| 17 | + { |
|
| 17 | 18 | $this->id = $pid; |
| 18 | 19 | $this->lang_code = $plang_code; |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | - public function getUri () { |
|
| 22 | + public function getUri () |
|
| 23 | + { |
|
| 22 | 24 | return "?page=".Base::PAGE_LANGUAGE_DETAIL."&id=$this->id"; |
| 23 | 25 | } |
| 24 | 26 | |
| 25 | - public function getEntryId () { |
|
| 27 | + public function getEntryId () |
|
| 28 | + { |
|
| 26 | 29 | return self::ALL_LANGUAGES_ID.":".$this->id; |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | - public static function getLanguageString ($code) { |
|
| 32 | + public static function getLanguageString ($code) |
|
| 33 | + { |
|
| 30 | 34 | $string = localize("languages.".$code); |
| 31 | 35 | if (preg_match ("/^languages/", $string)) { |
| 32 | 36 | return $code; |
@@ -34,12 +38,14 @@ discard block |
||
| 34 | 38 | return $string; |
| 35 | 39 | } |
| 36 | 40 | |
| 37 | - public static function getCount() { |
|
| 41 | + public static function getCount() |
|
| 42 | + { |
|
| 38 | 43 | // str_format (localize("languages.alphabetical", count(array)) |
| 39 | 44 | return Base::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, Base::PAGE_ALL_LANGUAGES); |
| 40 | 45 | } |
| 41 | 46 | |
| 42 | - public static function getLanguageById ($languageId) { |
|
| 47 | + public static function getLanguageById ($languageId) |
|
| 48 | + { |
|
| 43 | 49 | $result = Base::getDb ()->prepare('select id, lang_code from languages where id = ?'); |
| 44 | 50 | $result->execute (array ($languageId)); |
| 45 | 51 | if ($post = $result->fetchObject ()) { |
@@ -50,15 +56,15 @@ discard block |
||
| 50 | 56 | |
| 51 | 57 | |
| 52 | 58 | |
| 53 | - public static function getAllLanguages() { |
|
| 59 | + public static function getAllLanguages() |
|
| 60 | + { |
|
| 54 | 61 | $result = Base::getDb()->query('select languages.id as id, languages.lang_code as lang_code, count(*) as count |
| 55 | 62 | from languages, books_languages_link |
| 56 | 63 | where languages.id = books_languages_link.lang_code |
| 57 | 64 | group by languages.id, books_languages_link.lang_code |
| 58 | 65 | order by languages.lang_code'); |
| 59 | 66 | $entryArray = array(); |
| 60 | - while ($post = $result->fetchObject ()) |
|
| 61 | - { |
|
| 67 | + while ($post = $result->fetchObject ()) { |
|
| 62 | 68 | $language = new Language ($post->id, $post->lang_code); |
| 63 | 69 | array_push ($entryArray, new Entry (Language::getLanguageString ($language->lang_code), $language->getEntryId (), |
| 64 | 70 | str_format (localize("bookword", $post->count), $post->count), "text", |