@@ -21,45 +21,45 @@ |
||
| 21 | 21 | $this->name = $post->name; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function getUri () { |
|
| 25 | - return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id"; |
|
| 24 | + public function getUri() { |
|
| 25 | + return "?page=" . parent::PAGE_PUBLISHER_DETAIL . "&id=$this->id"; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function getEntryId () { |
|
| 29 | - return self::ALL_PUBLISHERS_ID.":".$this->id; |
|
| 28 | + public function getEntryId() { |
|
| 29 | + return self::ALL_PUBLISHERS_ID . ":" . $this->id; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public static function getCount() { |
| 33 | 33 | // str_format (localize("publishers.alphabetical", count(array)) |
| 34 | - return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
|
| 34 | + return parent::getCountGeneric("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public static function getPublisherByBookId ($bookId) { |
|
| 38 | - $result = parent::getDb ()->prepare('select publishers.id as id, name |
|
| 37 | + public static function getPublisherByBookId($bookId) { |
|
| 38 | + $result = parent::getDb()->prepare('select publishers.id as id, name |
|
| 39 | 39 | from books_publishers_link, publishers |
| 40 | 40 | where publishers.id = publisher and book = ?'); |
| 41 | - $result->execute (array ($bookId)); |
|
| 42 | - if ($post = $result->fetchObject ()) { |
|
| 43 | - return new Publisher ($post); |
|
| 41 | + $result->execute(array($bookId)); |
|
| 42 | + if ($post = $result->fetchObject()) { |
|
| 43 | + return new Publisher($post); |
|
| 44 | 44 | } |
| 45 | 45 | return NULL; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public static function getPublisherById ($publisherId) { |
|
| 49 | - $result = parent::getDb ()->prepare('select id, name |
|
| 48 | + public static function getPublisherById($publisherId) { |
|
| 49 | + $result = parent::getDb()->prepare('select id, name |
|
| 50 | 50 | from publishers where id = ?'); |
| 51 | - $result->execute (array ($publisherId)); |
|
| 52 | - if ($post = $result->fetchObject ()) { |
|
| 53 | - return new Publisher ($post); |
|
| 51 | + $result->execute(array($publisherId)); |
|
| 52 | + if ($post = $result->fetchObject()) { |
|
| 53 | + return new Publisher($post); |
|
| 54 | 54 | } |
| 55 | 55 | return NULL; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public static function getAllPublishers() { |
| 59 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher"); |
|
| 59 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array(), "Publisher"); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public static function getAllPublishersByQuery($query) { |
| 63 | - return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher"); |
|
| 63 | + return Base::getEntryArrayWithBookNumber(self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array('%' . $query . '%'), "Publisher"); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -19,44 +19,44 @@ |
||
| 19 | 19 | $this->name = $post->name; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function getUri () { |
|
| 23 | - return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id"; |
|
| 22 | + public function getUri() { |
|
| 23 | + return "?page=" . parent::PAGE_TAG_DETAIL . "&id=$this->id"; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function getEntryId () { |
|
| 27 | - return self::ALL_TAGS_ID.":".$this->id; |
|
| 26 | + public function getEntryId() { |
|
| 27 | + return self::ALL_TAGS_ID . ":" . $this->id; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public static function getCount() { |
| 31 | 31 | // str_format (localize("tags.alphabetical", count(array)) |
| 32 | - return parent::getCountGeneric ("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS); |
|
| 32 | + return parent::getCountGeneric("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public static function getTagById ($tagId) { |
|
| 36 | - $result = parent::getDb ()->prepare('select id, name from tags where id = ?'); |
|
| 37 | - $result->execute (array ($tagId)); |
|
| 38 | - if ($post = $result->fetchObject ()) { |
|
| 39 | - return new Tag ($post); |
|
| 35 | + public static function getTagById($tagId) { |
|
| 36 | + $result = parent::getDb()->prepare('select id, name from tags where id = ?'); |
|
| 37 | + $result->execute(array($tagId)); |
|
| 38 | + if ($post = $result->fetchObject()) { |
|
| 39 | + return new Tag($post); |
|
| 40 | 40 | } |
| 41 | 41 | return NULL; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public static function getAllTags() { |
| 45 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
|
| 45 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_TAGS, self::TAG_COLUMNS, array(), "Tag"); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
| 49 | - $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
| 49 | + $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
|
| 50 | 50 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
| 51 | - list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage); |
|
| 51 | + list ($totalNumber, $result) = parent::executeQuery($sql, $columns, "", array('%' . $query . '%'), $n, $database, $numberPerPage); |
|
| 52 | 52 | $entryArray = array(); |
| 53 | - while ($post = $result->fetchObject ()) |
|
| 53 | + while ($post = $result->fetchObject()) |
|
| 54 | 54 | { |
| 55 | - $tag = new Tag ($post); |
|
| 56 | - array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (), |
|
| 57 | - str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 58 | - array ( new LinkNavigation ($tag->getUri ())))); |
|
| 55 | + $tag = new Tag($post); |
|
| 56 | + array_push($entryArray, new Entry($tag->name, $tag->getEntryId(), |
|
| 57 | + str_format(localize("bookword", $post->count), $post->count), "text", |
|
| 58 | + array(new LinkNavigation($tag->getUri())))); |
|
| 59 | 59 | } |
| 60 | - return array ($entryArray, $totalNumber); |
|
| 60 | + return array($entryArray, $totalNumber); |
|
| 61 | 61 | } |
| 62 | 62 | } |
@@ -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 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAllSeries extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | 13 | $this->title = localize("series.title"); |
| 14 | 14 | $this->entryArray = Serie::getAllSeries(); |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | class LinkFacet extends Link |
| 10 | 10 | { |
| 11 | 11 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
| 12 | - parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
|
| 13 | - if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
|
| 12 | + parent::__construct($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
|
| 13 | + if (!is_null(GetUrlParam(DB))) $this->href = addURLParameter($this->href, DB, GetUrlParam(DB)); |
|
| 14 | 14 | $this->href = parent::getScriptName() . $this->href; |
| 15 | 15 | } |
| 16 | 16 | } |
@@ -8,10 +8,10 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class PageCustomize extends Page |
| 10 | 10 | { |
| 11 | - private function isChecked ($key, $testedValue = 1) { |
|
| 12 | - $value = getCurrentOption ($key); |
|
| 13 | - if (is_array ($value)) { |
|
| 14 | - if (in_array ($testedValue, $value)) { |
|
| 11 | + private function isChecked($key, $testedValue = 1) { |
|
| 12 | + $value = getCurrentOption($key); |
|
| 13 | + if (is_array($value)) { |
|
| 14 | + if (in_array($testedValue, $value)) { |
|
| 15 | 15 | return "checked='checked'"; |
| 16 | 16 | } |
| 17 | 17 | } else { |
@@ -22,29 +22,29 @@ discard block |
||
| 22 | 22 | return ""; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - private function isSelected ($key, $value) { |
|
| 26 | - if (getCurrentOption ($key) == $value) { |
|
| 25 | + private function isSelected($key, $value) { |
|
| 26 | + if (getCurrentOption($key) == $value) { |
|
| 27 | 27 | return "selected='selected'"; |
| 28 | 28 | } |
| 29 | 29 | return ""; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private function getStyleList () { |
|
| 33 | - $result = array (); |
|
| 34 | - foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) { |
|
| 35 | - if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) { |
|
| 36 | - array_push ($result, $m [1]); |
|
| 32 | + private function getStyleList() { |
|
| 33 | + $result = array(); |
|
| 34 | + foreach (glob("templates/" . getCurrentTemplate() . "/styles/style-*.css") as $filename) { |
|
| 35 | + if (preg_match('/styles\/style-(.*?)\.css/', $filename, $m)) { |
|
| 36 | + array_push($result, $m [1]); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | return $result; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function InitializeContent () |
|
| 42 | + public function InitializeContent() |
|
| 43 | 43 | { |
| 44 | - $this->title = localize ("customize.title"); |
|
| 45 | - $this->entryArray = array (); |
|
| 44 | + $this->title = localize("customize.title"); |
|
| 45 | + $this->entryArray = array(); |
|
| 46 | 46 | |
| 47 | - $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR, |
|
| 47 | + $ignoredBaseArray = array(PageQueryResult::SCOPE_AUTHOR, |
|
| 48 | 48 | PageQueryResult::SCOPE_TAG, |
| 49 | 49 | PageQueryResult::SCOPE_SERIES, |
| 50 | 50 | PageQueryResult::SCOPE_PUBLISHER, |
@@ -52,49 +52,49 @@ discard block |
||
| 52 | 52 | "language"); |
| 53 | 53 | |
| 54 | 54 | $content = ""; |
| 55 | - array_push ($this->entryArray, new Entry ("Template", "", |
|
| 55 | + array_push($this->entryArray, new Entry("Template", "", |
|
| 56 | 56 | "<span style='cursor: pointer;' onclick='$.cookie(\"template\", \"bootstrap\", { expires: 365 });window.location=$(\".headleft\").attr(\"href\");'>Click to switch to Bootstrap</span>", "text", |
| 57 | - array ())); |
|
| 57 | + array())); |
|
| 58 | 58 | if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { |
| 59 | 59 | $content .= '<select id="style" onchange="updateCookie (this);">'; |
| 60 | - foreach ($this-> getStyleList () as $filename) { |
|
| 61 | - $content .= "<option value='{$filename}' " . $this->isSelected ("style", $filename) . ">{$filename}</option>"; |
|
| 60 | + foreach ($this-> getStyleList() as $filename) { |
|
| 61 | + $content .= "<option value='{$filename}' " . $this->isSelected("style", $filename) . ">{$filename}</option>"; |
|
| 62 | 62 | } |
| 63 | 63 | $content .= '</select>'; |
| 64 | 64 | } else { |
| 65 | - foreach ($this-> getStyleList () as $filename) { |
|
| 66 | - $content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' " . $this->isChecked ("style", $filename) . " /><label for='style-{$filename}'> {$filename} </label>"; |
|
| 65 | + foreach ($this-> getStyleList() as $filename) { |
|
| 66 | + $content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' " . $this->isChecked("style", $filename) . " /><label for='style-{$filename}'> {$filename} </label>"; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | - array_push ($this->entryArray, new Entry (localize ("customize.style"), "", |
|
| 69 | + array_push($this->entryArray, new Entry(localize("customize.style"), "", |
|
| 70 | 70 | $content, "text", |
| 71 | - array ())); |
|
| 72 | - if (!useServerSideRendering ()) { |
|
| 73 | - $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $this->isChecked ("use_fancyapps") . ' />'; |
|
| 74 | - array_push ($this->entryArray, new Entry (localize ("customize.fancybox"), "", |
|
| 71 | + array())); |
|
| 72 | + if (!useServerSideRendering()) { |
|
| 73 | + $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $this->isChecked("use_fancyapps") . ' />'; |
|
| 74 | + array_push($this->entryArray, new Entry(localize("customize.fancybox"), "", |
|
| 75 | 75 | $content, "text", |
| 76 | - array ())); |
|
| 76 | + array())); |
|
| 77 | 77 | } |
| 78 | - $content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption ("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />'; |
|
| 79 | - array_push ($this->entryArray, new Entry (localize ("customize.paging"), "", |
|
| 78 | + $content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />'; |
|
| 79 | + array_push($this->entryArray, new Entry(localize("customize.paging"), "", |
|
| 80 | 80 | $content, "text", |
| 81 | - array ())); |
|
| 82 | - $content = '<input type="text" onchange="updateCookie (this);" id="email" value="' . getCurrentOption ("email") . '" />'; |
|
| 83 | - array_push ($this->entryArray, new Entry (localize ("customize.email"), "", |
|
| 81 | + array())); |
|
| 82 | + $content = '<input type="text" onchange="updateCookie (this);" id="email" value="' . getCurrentOption("email") . '" />'; |
|
| 83 | + array_push($this->entryArray, new Entry(localize("customize.email"), "", |
|
| 84 | 84 | $content, "text", |
| 85 | - array ())); |
|
| 86 | - $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="html_tag_filter" ' . $this->isChecked ("html_tag_filter") . ' />'; |
|
| 87 | - array_push ($this->entryArray, new Entry (localize ("customize.filter"), "", |
|
| 85 | + array())); |
|
| 86 | + $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="html_tag_filter" ' . $this->isChecked("html_tag_filter") . ' />'; |
|
| 87 | + array_push($this->entryArray, new Entry(localize("customize.filter"), "", |
|
| 88 | 88 | $content, "text", |
| 89 | - array ())); |
|
| 89 | + array())); |
|
| 90 | 90 | $content = ""; |
| 91 | 91 | foreach ($ignoredBaseArray as $key) { |
| 92 | - $keyPlural = preg_replace ('/(ss)$/', 's', $key . "s"); |
|
| 93 | - $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked ("ignored_categories", $key) . ' > ' . localize ("{$keyPlural}.title") . '</input> '; |
|
| 92 | + $keyPlural = preg_replace('/(ss)$/', 's', $key . "s"); |
|
| 93 | + $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked("ignored_categories", $key) . ' > ' . localize("{$keyPlural}.title") . '</input> '; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - array_push ($this->entryArray, new Entry (localize ("customize.ignored"), "", |
|
| 96 | + array_push($this->entryArray, new Entry(localize("customize.ignored"), "", |
|
| 97 | 97 | $content, "text", |
| 98 | - array ())); |
|
| 98 | + array())); |
|
| 99 | 99 | } |
| 100 | 100 | } |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAbout extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $this->title = localize ("about.title"); |
|
| 13 | + $this->title = localize("about.title"); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -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 PageAllSeries extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | 13 | $this->title = localize("series.title"); |
| 14 | 14 | $this->entryArray = Serie::getAllSeries(); |