@@ -70,7 +70,7 @@ |
||
| 70 | 70 | while ($post = $result->fetchObject()) |
| 71 | 71 | { |
| 72 | 72 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 73 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
|
| 73 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id))); |
|
| 74 | 74 | |
| 75 | 75 | $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
| 76 | 76 | |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | // PHP pre 5.6 does not support const arrays |
| 12 | 12 | private $BOOLEAN_NAMES = array( |
| 13 | 13 | -1 => "customcolumn.boolean.unknown", // localize("customcolumn.boolean.unknown") |
| 14 | - 00 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no") |
|
| 15 | - +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes") |
|
| 14 | + 00 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no") |
|
| 15 | + +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes") |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | protected function __construct($pcustomId) |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $entryArray = array(); |
| 61 | 61 | while ($post = $result->fetchObject()) { |
| 62 | 62 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 63 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
|
| 63 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id))); |
|
| 64 | 64 | |
| 65 | 65 | $entry = new Entry(localize($this->BOOLEAN_NAMES[$post->id]), $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
| 66 | 66 | |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $id = $date->format("Y-m-d"); |
| 50 | 50 | |
| 51 | 51 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 52 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($id))); |
|
| 52 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($id))); |
|
| 53 | 53 | |
| 54 | 54 | $entry = new Entry($date->format(localize("customcolumn.date.format")), $this->getEntryId($id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
| 55 | 55 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | public function getCustom($id) |
| 59 | 59 | { |
| 60 | - return new CustomColumn ($id, str_format(localize("customcolumn.stars", $id / 2), $id / 2), $this); |
|
| 60 | + return new CustomColumn($id, str_format(localize("customcolumn.stars", $id / 2), $id / 2), $this); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | protected function getAllCustomValuesFromDatabase() |
@@ -21,44 +21,44 @@ |
||
| 21 | 21 | $this->name = $post->name; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function getUri () { |
|
| 25 | - return "?page=".Base::PAGE_SERIE_DETAIL."&id=$this->id"; |
|
| 24 | + public function getUri() { |
|
| 25 | + return "?page=" . Base::PAGE_SERIE_DETAIL . "&id=$this->id"; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function getEntryId () { |
|
| 29 | - return self::ALL_SERIES_ID.":".$this->id; |
|
| 28 | + public function getEntryId() { |
|
| 29 | + return self::ALL_SERIES_ID . ":" . $this->id; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public static function getCount() { |
| 33 | 33 | // str_format (localize("series.alphabetical", count(array)) |
| 34 | - return Base::getCountGeneric ("series", self::ALL_SERIES_ID, Base::PAGE_ALL_SERIES); |
|
| 34 | + return Base::getCountGeneric("series", self::ALL_SERIES_ID, Base::PAGE_ALL_SERIES); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public static function getSerieByBookId ($bookId) { |
|
| 38 | - $result = Base::getDb ()->prepare('select series.id as id, name |
|
| 37 | + public static function getSerieByBookId($bookId) { |
|
| 38 | + $result = Base::getDb()->prepare('select series.id as id, name |
|
| 39 | 39 | from books_series_link, series |
| 40 | 40 | where series.id = series and book = ?'); |
| 41 | - $result->execute (array ($bookId)); |
|
| 42 | - if ($post = $result->fetchObject ()) { |
|
| 43 | - return new Serie ($post); |
|
| 41 | + $result->execute(array($bookId)); |
|
| 42 | + if ($post = $result->fetchObject()) { |
|
| 43 | + return new Serie($post); |
|
| 44 | 44 | } |
| 45 | 45 | return NULL; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public static function getSerieById ($serieId) { |
|
| 49 | - $result = Base::getDb ()->prepare('select id, name from series where id = ?'); |
|
| 50 | - $result->execute (array ($serieId)); |
|
| 51 | - if ($post = $result->fetchObject ()) { |
|
| 52 | - return new Serie ($post); |
|
| 48 | + public static function getSerieById($serieId) { |
|
| 49 | + $result = Base::getDb()->prepare('select id, name from series where id = ?'); |
|
| 50 | + $result->execute(array($serieId)); |
|
| 51 | + if ($post = $result->fetchObject()) { |
|
| 52 | + return new Serie($post); |
|
| 53 | 53 | } |
| 54 | 54 | return NULL; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public static function getAllSeries() { |
| 58 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array (), "Serie"); |
|
| 58 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array(), "Serie"); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public static function getAllSeriesByQuery($query) { |
| 62 | - return Base::getEntryArrayWithBookNumber (self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array ('%' . $query . '%'), "Serie"); |
|
| 62 | + return Base::getEntryArrayWithBookNumber(self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array('%' . $query . '%'), "Serie"); |
|
| 63 | 63 | } |
| 64 | 64 | } |
@@ -59,25 +59,25 @@ discard block |
||
| 59 | 59 | $this->id = $post->id; |
| 60 | 60 | $this->name = $post->name; |
| 61 | 61 | $this->format = $post->format; |
| 62 | - $this->realFormat = str_replace ("ORIGINAL_", "", $post->format); |
|
| 63 | - $this->extension = strtolower ($this->realFormat); |
|
| 62 | + $this->realFormat = str_replace("ORIGINAL_", "", $post->format); |
|
| 63 | + $this->extension = strtolower($this->realFormat); |
|
| 64 | 64 | $this->book = $book; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public function isKnownType () { |
|
| 68 | - return array_key_exists ($this->extension, self::$mimetypes); |
|
| 67 | + public function isKnownType() { |
|
| 68 | + return array_key_exists($this->extension, self::$mimetypes); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function getMimeType () { |
|
| 71 | + public function getMimeType() { |
|
| 72 | 72 | $result = "application/octet-stream"; |
| 73 | - if ($this->isKnownType ()) { |
|
| 73 | + if ($this->isKnownType()) { |
|
| 74 | 74 | return self::$mimetypes [$this->extension]; |
| 75 | 75 | } elseif (function_exists('finfo_open') === true) { |
| 76 | 76 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
| 77 | 77 | |
| 78 | 78 | if (is_resource($finfo) === true) |
| 79 | 79 | { |
| 80 | - $result = finfo_file($finfo, $this->getLocalPath ()); |
|
| 80 | + $result = finfo_file($finfo, $this->getLocalPath()); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | finfo_close($finfo); |
@@ -86,82 +86,82 @@ discard block |
||
| 86 | 86 | return $result; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function isEpubValidOnKobo () { |
|
| 89 | + public function isEpubValidOnKobo() { |
|
| 90 | 90 | return $this->format == "EPUB" || $this->format == "KEPUB"; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function getFilename () { |
|
| 94 | - return $this->name . "." . strtolower ($this->format); |
|
| 93 | + public function getFilename() { |
|
| 94 | + return $this->name . "." . strtolower($this->format); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function getUpdatedFilename () { |
|
| 98 | - return $this->book->getAuthorsSort () . " - " . $this->book->title; |
|
| 97 | + public function getUpdatedFilename() { |
|
| 98 | + return $this->book->getAuthorsSort() . " - " . $this->book->title; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function getUpdatedFilenameEpub () { |
|
| 102 | - return $this->getUpdatedFilename () . ".epub"; |
|
| 101 | + public function getUpdatedFilenameEpub() { |
|
| 102 | + return $this->getUpdatedFilename() . ".epub"; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function getUpdatedFilenameKepub () { |
|
| 106 | - $str = $this->getUpdatedFilename () . ".kepub.epub"; |
|
| 105 | + public function getUpdatedFilenameKepub() { |
|
| 106 | + $str = $this->getUpdatedFilename() . ".kepub.epub"; |
|
| 107 | 107 | return str_replace(array(':', '#', '&'), |
| 108 | - array('-', '-', ' '), $str ); |
|
| 108 | + array('-', '-', ' '), $str); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function getDataLink ($rel, $title = NULL) { |
|
| 111 | + public function getDataLink($rel, $title = NULL) { |
|
| 112 | 112 | global $config; |
| 113 | 113 | |
| 114 | 114 | if ($rel == Link::OPDS_ACQUISITION_TYPE && $config['cops_use_url_rewriting'] == "1") { |
| 115 | 115 | return $this->getHtmlLinkWithRewriting($title); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - return self::getLink ($this->book, $this->extension, $this->getMimeType (), $rel, $this->getFilename (), $this->id, $title); |
|
| 118 | + return self::getLink($this->book, $this->extension, $this->getMimeType(), $rel, $this->getFilename(), $this->id, $title); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function getHtmlLink () { |
|
| 121 | + public function getHtmlLink() { |
|
| 122 | 122 | return $this->getDataLink(Link::OPDS_ACQUISITION_TYPE)->href; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function getLocalPath () { |
|
| 126 | - return $this->book->path . "/" . $this->getFilename (); |
|
| 125 | + public function getLocalPath() { |
|
| 126 | + return $this->book->path . "/" . $this->getFilename(); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function getHtmlLinkWithRewriting ($title = NULL) { |
|
| 129 | + public function getHtmlLinkWithRewriting($title = NULL) { |
|
| 130 | 130 | global $config; |
| 131 | 131 | |
| 132 | 132 | $database = ""; |
| 133 | - if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/"; |
|
| 133 | + if (!is_null(GetUrlParam(DB))) $database = GetUrlParam(DB) . "/"; |
|
| 134 | 134 | |
| 135 | 135 | $href = "download/" . $this->id . "/" . $database; |
| 136 | 136 | |
| 137 | 137 | if ($config['cops_provide_kepub'] == "1" && |
| 138 | - $this->isEpubValidOnKobo () && |
|
| 138 | + $this->isEpubValidOnKobo() && |
|
| 139 | 139 | preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) { |
| 140 | - $href .= rawurlencode ($this->getUpdatedFilenameKepub ()); |
|
| 140 | + $href .= rawurlencode($this->getUpdatedFilenameKepub()); |
|
| 141 | 141 | } else { |
| 142 | - $href .= rawurlencode ($this->getFilename ()); |
|
| 142 | + $href .= rawurlencode($this->getFilename()); |
|
| 143 | 143 | } |
| 144 | - return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title); |
|
| 144 | + return new Link($href, $this->getMimeType(), Link::OPDS_ACQUISITION_TYPE, $title); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - public static function getDataByBook ($book) { |
|
| 148 | - $out = array (); |
|
| 149 | - $result = Base::getDb ()->prepare('select id, format, name |
|
| 147 | + public static function getDataByBook($book) { |
|
| 148 | + $out = array(); |
|
| 149 | + $result = Base::getDb()->prepare('select id, format, name |
|
| 150 | 150 | from data where book = ?'); |
| 151 | - $result->execute (array ($book->id)); |
|
| 151 | + $result->execute(array($book->id)); |
|
| 152 | 152 | |
| 153 | - while ($post = $result->fetchObject ()) |
|
| 153 | + while ($post = $result->fetchObject()) |
|
| 154 | 154 | { |
| 155 | - array_push ($out, new Data ($post, $book)); |
|
| 155 | + array_push($out, new Data($post, $book)); |
|
| 156 | 156 | } |
| 157 | 157 | return $out; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public static function handleThumbnailLink ($urlParam, $height) { |
|
| 160 | + public static function handleThumbnailLink($urlParam, $height) { |
|
| 161 | 161 | global $config; |
| 162 | 162 | |
| 163 | - if (is_null ($height)) { |
|
| 164 | - if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { |
|
| 163 | + if (is_null($height)) { |
|
| 164 | + if (preg_match('/feed.php/', $_SERVER["SCRIPT_NAME"])) { |
|
| 165 | 165 | $height = $config['cops_opds_thumbnail_height']; |
| 166 | 166 | } |
| 167 | 167 | else |
@@ -176,13 +176,13 @@ discard block |
||
| 176 | 176 | return $urlParam; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
|
| 179 | + public static function getLink($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
|
| 180 | 180 | { |
| 181 | 181 | global $config; |
| 182 | 182 | |
| 183 | 183 | $urlParam = addURLParameter("", "data", $idData); |
| 184 | 184 | |
| 185 | - if (Base::useAbsolutePath () || |
|
| 185 | + if (Base::useAbsolutePath() || |
|
| 186 | 186 | $rel == Link::OPDS_THUMBNAIL_TYPE || |
| 187 | 187 | ($type == "epub" && $config['cops_update_epub-metadata'])) |
| 188 | 188 | { |
@@ -191,18 +191,18 @@ discard block |
||
| 191 | 191 | $urlParam = self::handleThumbnailLink($urlParam, $height); |
| 192 | 192 | } |
| 193 | 193 | $urlParam = addURLParameter($urlParam, "id", $book->id); |
| 194 | - if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); |
|
| 194 | + if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam(DB)); |
|
| 195 | 195 | if ($config['cops_thumbnail_handling'] != "1" && |
| 196 | 196 | !empty ($config['cops_thumbnail_handling']) && |
| 197 | 197 | $rel == Link::OPDS_THUMBNAIL_TYPE) { |
| 198 | - return new Link ($config['cops_thumbnail_handling'], $mime, $rel, $title); |
|
| 198 | + return new Link($config['cops_thumbnail_handling'], $mime, $rel, $title); |
|
| 199 | 199 | } else { |
| 200 | - return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title); |
|
| 200 | + return new Link("fetch.php?" . $urlParam, $mime, $rel, $title); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | else |
| 204 | 204 | { |
| 205 | - return new Link (str_replace('%2F','/',rawurlencode ($book->path."/".$filename)), $mime, $rel, $title); |
|
| 205 | + return new Link(str_replace('%2F', '/', rawurlencode($book->path . "/" . $filename)), $mime, $rel, $title); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -22,45 +22,45 @@ |
||
| 22 | 22 | $this->name = $post->name; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getUri () { |
|
| 26 | - return "?page=".Base::PAGE_PUBLISHER_DETAIL."&id=$this->id"; |
|
| 25 | + public function getUri() { |
|
| 26 | + return "?page=" . Base::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 Base::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, Base::PAGE_ALL_PUBLISHERS); |
|
| 35 | + return Base::getCountGeneric("publishers", self::ALL_PUBLISHERS_ID, Base::PAGE_ALL_PUBLISHERS); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public static function getPublisherByBookId ($bookId) { |
|
| 39 | - $result = Base::getDb ()->prepare('select publishers.id as id, name |
|
| 38 | + public static function getPublisherByBookId($bookId) { |
|
| 39 | + $result = Base::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 = Base::getDb ()->prepare('select id, name |
|
| 49 | + public static function getPublisherById($publisherId) { |
|
| 50 | + $result = Base::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 | } |
@@ -20,44 +20,44 @@ |
||
| 20 | 20 | $this->name = $post->name; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function getUri () { |
|
| 24 | - return "?page=".Base::PAGE_TAG_DETAIL."&id=$this->id"; |
|
| 23 | + public function getUri() { |
|
| 24 | + return "?page=" . Base::PAGE_TAG_DETAIL . "&id=$this->id"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function getEntryId () { |
|
| 28 | - return self::ALL_TAGS_ID.":".$this->id; |
|
| 27 | + public function getEntryId() { |
|
| 28 | + return self::ALL_TAGS_ID . ":" . $this->id; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function getCount() { |
| 32 | 32 | // str_format (localize("tags.alphabetical", count(array)) |
| 33 | - return Base::getCountGeneric ("tags", self::ALL_TAGS_ID, Base::PAGE_ALL_TAGS); |
|
| 33 | + return Base::getCountGeneric("tags", self::ALL_TAGS_ID, Base::PAGE_ALL_TAGS); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function getTagById ($tagId) { |
|
| 37 | - $result = Base::getDb ()->prepare('select id, name from tags where id = ?'); |
|
| 38 | - $result->execute (array ($tagId)); |
|
| 39 | - if ($post = $result->fetchObject ()) { |
|
| 40 | - return new Tag ($post); |
|
| 36 | + public static function getTagById($tagId) { |
|
| 37 | + $result = Base::getDb()->prepare('select id, name from tags where id = ?'); |
|
| 38 | + $result->execute(array($tagId)); |
|
| 39 | + if ($post = $result->fetchObject()) { |
|
| 40 | + return new Tag($post); |
|
| 41 | 41 | } |
| 42 | 42 | return NULL; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function getAllTags() { |
| 46 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
|
| 46 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_TAGS, self::TAG_COLUMNS, array(), "Tag"); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
| 50 | - $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
| 50 | + $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
| 51 | 51 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
| 52 | - list ($totalNumber, $result) = Base::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage); |
|
| 52 | + list ($totalNumber, $result) = Base::executeQuery($sql, $columns, "", array('%' . $query . '%'), $n, $database, $numberPerPage); |
|
| 53 | 53 | $entryArray = array(); |
| 54 | - while ($post = $result->fetchObject ()) |
|
| 54 | + while ($post = $result->fetchObject()) |
|
| 55 | 55 | { |
| 56 | - $tag = new Tag ($post); |
|
| 57 | - array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (), |
|
| 58 | - str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 59 | - array ( new LinkNavigation ($tag->getUri ())))); |
|
| 56 | + $tag = new Tag($post); |
|
| 57 | + array_push($entryArray, new Entry($tag->name, $tag->getEntryId(), |
|
| 58 | + str_format(localize("bookword", $post->count), $post->count), "text", |
|
| 59 | + array(new LinkNavigation($tag->getUri())))); |
|
| 60 | 60 | } |
| 61 | - return array ($entryArray, $totalNumber); |
|
| 61 | + return array($entryArray, $totalNumber); |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | $this->lang_code = $plang_code; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getUri () { |
|
| 22 | - return "?page=".Base::PAGE_LANGUAGE_DETAIL."&id=$this->id"; |
|
| 21 | + public function getUri() { |
|
| 22 | + return "?page=" . Base::PAGE_LANGUAGE_DETAIL . "&id=$this->id"; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getEntryId () { |
|
| 26 | - return self::ALL_LANGUAGES_ID.":".$this->id; |
|
| 25 | + public function getEntryId() { |
|
| 26 | + return self::ALL_LANGUAGES_ID . ":" . $this->id; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public static function getLanguageString ($code) { |
|
| 30 | - $string = localize("languages.".$code); |
|
| 31 | - if (preg_match ("/^languages/", $string)) { |
|
| 29 | + public static function getLanguageString($code) { |
|
| 30 | + $string = localize("languages." . $code); |
|
| 31 | + if (preg_match("/^languages/", $string)) { |
|
| 32 | 32 | return $code; |
| 33 | 33 | } |
| 34 | 34 | return $string; |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public static function getCount() { |
| 38 | 38 | // str_format (localize("languages.alphabetical", count(array)) |
| 39 | - return Base::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, Base::PAGE_ALL_LANGUAGES); |
|
| 39 | + return Base::getCountGeneric("languages", self::ALL_LANGUAGES_ID, Base::PAGE_ALL_LANGUAGES); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public static function getLanguageById ($languageId) { |
|
| 43 | - $result = Base::getDb ()->prepare('select id, lang_code from languages where id = ?'); |
|
| 44 | - $result->execute (array ($languageId)); |
|
| 45 | - if ($post = $result->fetchObject ()) { |
|
| 46 | - return new Language ($post->id, Language::getLanguageString ($post->lang_code)); |
|
| 42 | + public static function getLanguageById($languageId) { |
|
| 43 | + $result = Base::getDb()->prepare('select id, lang_code from languages where id = ?'); |
|
| 44 | + $result->execute(array($languageId)); |
|
| 45 | + if ($post = $result->fetchObject()) { |
|
| 46 | + return new Language($post->id, Language::getLanguageString($post->lang_code)); |
|
| 47 | 47 | } |
| 48 | 48 | return NULL; |
| 49 | 49 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | group by languages.id, books_languages_link.lang_code |
| 58 | 58 | order by languages.lang_code'); |
| 59 | 59 | $entryArray = array(); |
| 60 | - while ($post = $result->fetchObject ()) |
|
| 60 | + while ($post = $result->fetchObject()) |
|
| 61 | 61 | { |
| 62 | - $language = new Language ($post->id, $post->lang_code); |
|
| 63 | - array_push ($entryArray, new Entry (Language::getLanguageString ($language->lang_code), $language->getEntryId (), |
|
| 64 | - str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 65 | - array ( new LinkNavigation ($language->getUri ())), "", $post->count)); |
|
| 62 | + $language = new Language($post->id, $post->lang_code); |
|
| 63 | + array_push($entryArray, new Entry(Language::getLanguageString($language->lang_code), $language->getEntryId(), |
|
| 64 | + str_format(localize("bookword", $post->count), $post->count), "text", |
|
| 65 | + array(new LinkNavigation($language->getUri())), "", $post->count)); |
|
| 66 | 66 | } |
| 67 | 67 | return $entryArray; |
| 68 | 68 | } |