Completed
Push — master ( e0dd35...f294bb )
by Markus
08:06 queued 57s
created
lib/Language.php 3 patches
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,20 +13,24 @@  discard block
 block discarded – undo
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=".parent::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
 block discarded – undo
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 parent::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, parent::PAGE_ALL_LANGUAGES);
40 45
     }
41 46
 
42
-    public static function getLanguageById ($languageId) {
47
+    public static function getLanguageById ($languageId)
48
+    {
43 49
         $result = parent::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
 block discarded – undo
50 56
 
51 57
 
52 58
 
53
-    public static function getAllLanguages() {
59
+    public static function getAllLanguages()
60
+    {
54 61
         $result = parent::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",
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         if ($post = $result->fetchObject ()) {
45 45
             return new Language ($post->id, Language::getLanguageString ($post->lang_code));
46 46
         }
47
-        return NULL;
47
+        return null;
48 48
     }
49 49
 
50 50
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
lib/PageQueryResult.php 3 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
     const SCOPE_BOOK = "book";
16 16
     const SCOPE_PUBLISHER = "publisher";
17 17
 
18
-    private function useTypeahead () {
19
-        return !is_null (getURLParam ("search"));
18
+    private function useTypeahead() {
19
+        return !is_null(getURLParam("search"));
20 20
     }
21 21
 
22
-    private function searchByScope ($scope, $limit = FALSE) {
22
+    private function searchByScope($scope, $limit = FALSE) {
23 23
         $n = $this->n;
24 24
         $numberPerPage = NULL;
25 25
         $queryNormedAndUp = $this->query;
26
-        if (useNormAndUp ()) {
27
-            $queryNormedAndUp = normAndUp ($this->query);
26
+        if (useNormAndUp()) {
27
+            $queryNormedAndUp = normAndUp($this->query);
28 28
         }
29 29
         if ($limit) {
30 30
             $n = 1;
@@ -32,59 +32,59 @@  discard block
 block discarded – undo
32 32
         }
33 33
         switch ($scope) {
34 34
             case self::SCOPE_BOOK :
35
-                $array = Book::getBooksByStartingLetter ('%' . $queryNormedAndUp, $n, NULL, $numberPerPage);
35
+                $array = Book::getBooksByStartingLetter('%' . $queryNormedAndUp, $n, NULL, $numberPerPage);
36 36
                 break;
37 37
             case self::SCOPE_AUTHOR :
38
-                $array = Author::getAuthorsForSearch ('%' . $queryNormedAndUp);
38
+                $array = Author::getAuthorsForSearch('%' . $queryNormedAndUp);
39 39
                 break;
40 40
             case self::SCOPE_SERIES :
41
-                $array = Serie::getAllSeriesByQuery ($queryNormedAndUp);
41
+                $array = Serie::getAllSeriesByQuery($queryNormedAndUp);
42 42
                 break;
43 43
             case self::SCOPE_TAG :
44
-                $array = Tag::getAllTagsByQuery ($queryNormedAndUp, $n, NULL, $numberPerPage);
44
+                $array = Tag::getAllTagsByQuery($queryNormedAndUp, $n, NULL, $numberPerPage);
45 45
                 break;
46 46
             case self::SCOPE_PUBLISHER :
47
-                $array = Publisher::getAllPublishersByQuery ($queryNormedAndUp);
47
+                $array = Publisher::getAllPublishersByQuery($queryNormedAndUp);
48 48
                 break;
49 49
             default:
50
-                $array = Book::getBooksByQuery (
51
-                    array ("all" => "%" . $queryNormedAndUp . "%"), $n);
50
+                $array = Book::getBooksByQuery(
51
+                    array("all" => "%" . $queryNormedAndUp . "%"), $n);
52 52
         }
53 53
 
54 54
         return $array;
55 55
     }
56 56
 
57
-    public function doSearchByCategory () {
58
-        $database = GetUrlParam (DB);
59
-        $out = array ();
57
+    public function doSearchByCategory() {
58
+        $database = GetUrlParam(DB);
59
+        $out = array();
60 60
         $pagequery = Base::PAGE_OPENSEARCH_QUERY;
61
-        $dbArray = array ("");
61
+        $dbArray = array("");
62 62
         $d = $database;
63 63
         $query = $this->query;
64 64
         // Special case when no databases were chosen, we search on all databases
65
-        if (Base::noDatabaseSelected ()) {
66
-            $dbArray = Base::getDbNameList ();
65
+        if (Base::noDatabaseSelected()) {
66
+            $dbArray = Base::getDbNameList();
67 67
             $d = 0;
68 68
         }
69 69
         foreach ($dbArray as $key) {
70
-            if (Base::noDatabaseSelected ()) {
71
-                array_push ($this->entryArray, new Entry ($key, DB . ":query:{$d}",
70
+            if (Base::noDatabaseSelected()) {
71
+                array_push($this->entryArray, new Entry($key, DB . ":query:{$d}",
72 72
                                         " ", "text",
73
-                                        array ( new LinkNavigation ("?" . DB . "={$d}")), "tt-header"));
74
-                Base::getDb ($d);
73
+                                        array(new LinkNavigation("?" . DB . "={$d}")), "tt-header"));
74
+                Base::getDb($d);
75 75
             }
76
-            foreach (array (PageQueryResult::SCOPE_BOOK,
76
+            foreach (array(PageQueryResult::SCOPE_BOOK,
77 77
                             PageQueryResult::SCOPE_AUTHOR,
78 78
                             PageQueryResult::SCOPE_SERIES,
79 79
                             PageQueryResult::SCOPE_TAG,
80 80
                             PageQueryResult::SCOPE_PUBLISHER) as $key) {
81
-                if (in_array($key, getCurrentOption ('ignored_categories'))) {
81
+                if (in_array($key, getCurrentOption('ignored_categories'))) {
82 82
                     continue;
83 83
                 }
84
-                $array = $this->searchByScope ($key, TRUE);
84
+                $array = $this->searchByScope($key, TRUE);
85 85
 
86 86
                 $i = 0;
87
-                if (count ($array) == 2 && is_array ($array [0])) {
87
+                if (count($array) == 2 && is_array($array [0])) {
88 88
                     $total = $array [1];
89 89
                     $array = $array [0];
90 90
                 } else {
@@ -97,32 +97,32 @@  discard block
 block discarded – undo
97 97
                     // str_format (localize("seriesword", count($array))
98 98
                     // str_format (localize("tagword", count($array))
99 99
                     // str_format (localize("publisherword", count($array))
100
-                    array_push ($this->entryArray, new Entry (str_format (localize ("search.result.{$key}"), $this->query), DB . ":query:{$d}:{$key}",
101
-                                        str_format (localize("{$key}word", $total), $total), "text",
102
-                                        array ( new LinkNavigation ("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")),
103
-                                        Base::noDatabaseSelected () ? "" : "tt-header", $total));
100
+                    array_push($this->entryArray, new Entry(str_format(localize("search.result.{$key}"), $this->query), DB . ":query:{$d}:{$key}",
101
+                                        str_format(localize("{$key}word", $total), $total), "text",
102
+                                        array(new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")),
103
+                                        Base::noDatabaseSelected()?"":"tt-header", $total));
104 104
                 }
105
-                if (!Base::noDatabaseSelected () && $this->useTypeahead ()) {
105
+                if (!Base::noDatabaseSelected() && $this->useTypeahead()) {
106 106
                     foreach ($array as $entry) {
107
-                        array_push ($this->entryArray, $entry);
107
+                        array_push($this->entryArray, $entry);
108 108
                         $i++;
109 109
                         if ($i > 4) { break; };
110 110
                     }
111 111
                 }
112 112
             }
113 113
             $d++;
114
-            if (Base::noDatabaseSelected ()) {
115
-                Base::clearDb ();
114
+            if (Base::noDatabaseSelected()) {
115
+                Base::clearDb();
116 116
             }
117 117
         }
118 118
         return $out;
119 119
     }
120 120
 
121
-    public function InitializeContent ()
121
+    public function InitializeContent()
122 122
     {
123
-        $scope = getURLParam ("scope");
123
+        $scope = getURLParam("scope");
124 124
         if (empty ($scope)) {
125
-            $this->title = str_format (localize ("search.result"), $this->query);
125
+            $this->title = str_format(localize("search.result"), $this->query);
126 126
         } else {
127 127
             // Comment to help the perl i18n script
128 128
             // str_format (localize ("search.result.author"), $this->query)
@@ -130,31 +130,31 @@  discard block
 block discarded – undo
130 130
             // str_format (localize ("search.result.series"), $this->query)
131 131
             // str_format (localize ("search.result.book"), $this->query)
132 132
             // str_format (localize ("search.result.publisher"), $this->query)
133
-            $this->title = str_format (localize ("search.result.{$scope}"), $this->query);
133
+            $this->title = str_format(localize("search.result.{$scope}"), $this->query);
134 134
         }
135 135
 
136 136
         $crit = "%" . $this->query . "%";
137 137
 
138 138
         // Special case when we are doing a search and no database is selected
139
-        if (Base::noDatabaseSelected () && !$this->useTypeahead ()) {
139
+        if (Base::noDatabaseSelected() && !$this->useTypeahead()) {
140 140
             $i = 0;
141
-            foreach (Base::getDbNameList () as $key) {
142
-                Base::clearDb ();
143
-                list ($array, $totalNumber) = Book::getBooksByQuery (array ("all" => $crit), 1, $i, 1);
144
-                array_push ($this->entryArray, new Entry ($key, DB . ":query:{$i}",
145
-                                        str_format (localize ("bookword", $totalNumber), $totalNumber), "text",
146
-                                        array ( new LinkNavigation ("?" . DB . "={$i}&page=9&query=" . $this->query)), "", $totalNumber));
141
+            foreach (Base::getDbNameList() as $key) {
142
+                Base::clearDb();
143
+                list ($array, $totalNumber) = Book::getBooksByQuery(array("all" => $crit), 1, $i, 1);
144
+                array_push($this->entryArray, new Entry($key, DB . ":query:{$i}",
145
+                                        str_format(localize("bookword", $totalNumber), $totalNumber), "text",
146
+                                        array(new LinkNavigation("?" . DB . "={$i}&page=9&query=" . $this->query)), "", $totalNumber));
147 147
                 $i++;
148 148
             }
149 149
             return;
150 150
         }
151 151
         if (empty ($scope)) {
152
-            $this->doSearchByCategory ();
152
+            $this->doSearchByCategory();
153 153
             return;
154 154
         }
155 155
 
156
-        $array = $this->searchByScope ($scope);
157
-        if (count ($array) == 2 && is_array ($array [0])) {
156
+        $array = $this->searchByScope($scope);
157
+        if (count($array) == 2 && is_array($array [0])) {
158 158
             list ($this->entryArray, $this->totalNumber) = $array;
159 159
         } else {
160 160
             $this->entryArray = $array;
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,11 +15,13 @@  discard block
 block discarded – undo
15 15
     const SCOPE_BOOK = "book";
16 16
     const SCOPE_PUBLISHER = "publisher";
17 17
 
18
-    private function useTypeahead () {
18
+    private function useTypeahead ()
19
+    {
19 20
         return !is_null (getURLParam ("search"));
20 21
     }
21 22
 
22
-    private function searchByScope ($scope, $limit = FALSE) {
23
+    private function searchByScope ($scope, $limit = FALSE)
24
+    {
23 25
         $n = $this->n;
24 26
         $numberPerPage = NULL;
25 27
         $queryNormedAndUp = $this->query;
@@ -54,7 +56,8 @@  discard block
 block discarded – undo
54 56
         return $array;
55 57
     }
56 58
 
57
-    public function doSearchByCategory () {
59
+    public function doSearchByCategory ()
60
+    {
58 61
         $database = GetUrlParam (DB);
59 62
         $out = array ();
60 63
         $pagequery = Base::PAGE_OPENSEARCH_QUERY;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
         return !is_null (getURLParam ("search"));
20 20
     }
21 21
 
22
-    private function searchByScope ($scope, $limit = FALSE) {
22
+    private function searchByScope ($scope, $limit = false) {
23 23
         $n = $this->n;
24
-        $numberPerPage = NULL;
24
+        $numberPerPage = null;
25 25
         $queryNormedAndUp = $this->query;
26 26
         if (useNormAndUp ()) {
27 27
             $queryNormedAndUp = normAndUp ($this->query);
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         }
33 33
         switch ($scope) {
34 34
             case self::SCOPE_BOOK :
35
-                $array = Book::getBooksByStartingLetter ('%' . $queryNormedAndUp, $n, NULL, $numberPerPage);
35
+                $array = Book::getBooksByStartingLetter ('%' . $queryNormedAndUp, $n, null, $numberPerPage);
36 36
                 break;
37 37
             case self::SCOPE_AUTHOR :
38 38
                 $array = Author::getAuthorsForSearch ('%' . $queryNormedAndUp);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                 $array = Serie::getAllSeriesByQuery ($queryNormedAndUp);
42 42
                 break;
43 43
             case self::SCOPE_TAG :
44
-                $array = Tag::getAllTagsByQuery ($queryNormedAndUp, $n, NULL, $numberPerPage);
44
+                $array = Tag::getAllTagsByQuery ($queryNormedAndUp, $n, null, $numberPerPage);
45 45
                 break;
46 46
             case self::SCOPE_PUBLISHER :
47 47
                 $array = Publisher::getAllPublishersByQuery ($queryNormedAndUp);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 if (in_array($key, getCurrentOption ('ignored_categories'))) {
82 82
                     continue;
83 83
                 }
84
-                $array = $this->searchByScope ($key, TRUE);
84
+                $array = $this->searchByScope ($key, true);
85 85
 
86 86
                 $i = 0;
87 87
                 if (count ($array) == 2 && is_array ($array [0])) {
Please login to merge, or discard this patch.
lib/PageBookDetail.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
 
9 9
 class PageBookDetail extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $this->book = Book::getBookById ($this->idGet);
13
+        $this->book = Book::getBookById($this->idGet);
14 14
         $this->title = $this->book->title;
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
lib/Page.php 3 patches
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,7 +76,8 @@  discard block
 block discarded – undo
76 76
         }
77 77
     }
78 78
 
79
-    public function __construct($pid, $pquery, $pn) {
79
+    public function __construct($pid, $pquery, $pn)
80
+    {
80 81
         global $config;
81 82
 
82 83
         $this->idGet = $pid;
@@ -109,23 +110,33 @@  discard block
 block discarded – undo
109 110
             }
110 111
             if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) {
111 112
                 $series = Serie::getCount();
112
-                if (!is_null ($series)) array_push ($this->entryArray, $series);
113
+                if (!is_null ($series)) {
114
+                    array_push ($this->entryArray, $series);
115
+                }
113 116
             }
114 117
             if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) {
115 118
                 $publisher = Publisher::getCount();
116
-                if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
119
+                if (!is_null ($publisher)) {
120
+                    array_push ($this->entryArray, $publisher);
121
+                }
117 122
             }
118 123
             if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) {
119 124
                 $tags = Tag::getCount();
120
-                if (!is_null ($tags)) array_push ($this->entryArray, $tags);
125
+                if (!is_null ($tags)) {
126
+                    array_push ($this->entryArray, $tags);
127
+                }
121 128
             }
122 129
             if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) {
123 130
                 $rating = Rating::getCount();
124
-                if (!is_null ($rating)) array_push ($this->entryArray, $rating);
131
+                if (!is_null ($rating)) {
132
+                    array_push ($this->entryArray, $rating);
133
+                }
125 134
             }
126 135
             if (!in_array ("language", getCurrentOption ('ignored_categories'))) {
127 136
                 $languages = Language::getCount();
128
-                if (!is_null ($languages)) array_push ($this->entryArray, $languages);
137
+                if (!is_null ($languages)) {
138
+                    array_push ($this->entryArray, $languages);
139
+                }
129 140
             }
130 141
             foreach ($config['cops_calibre_custom_column'] as $lookup) {
131 142
                 $customId = CustomColumn::getCustomId ($lookup);
@@ -135,7 +146,9 @@  discard block
 block discarded – undo
135 146
             }
136 147
             $this->entryArray = array_merge ($this->entryArray, Book::getCount());
137 148
 
138
-            if (Base::isMultipleDatabaseEnabled ()) $this->title =  Base::getDbName ();
149
+            if (Base::isMultipleDatabaseEnabled ()) {
150
+                $this->title =  Base::getDbName ();
151
+            }
139 152
         }
140 153
     }
141 154
 
@@ -171,8 +184,12 @@  discard block
 block discarded – undo
171 184
 
172 185
     public function containsBook ()
173 186
     {
174
-        if (count ($this->entryArray) == 0) return false;
175
-        if (get_class ($this->entryArray [0]) == "EntryBook") return true;
187
+        if (count ($this->entryArray) == 0) {
188
+            return false;
189
+        }
190
+        if (get_class ($this->entryArray [0]) == "EntryBook") {
191
+            return true;
192
+        }
176 193
         return false;
177 194
     }
178 195
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         if ($post = $result->fetchObject ()) {
61 61
             return $post->id;
62 62
         }
63
-        return NULL;
63
+        return null;
64 64
     }
65 65
 
66 66
     public static function getCount($customId) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         if ($post = $result->fetchObject ()) {
78 78
             return new CustomColumn ($post->id, $post->name, $customId);
79 79
         }
80
-        return NULL;
80
+        return null;
81 81
     }
82 82
 
83 83
     public static function getAllCustoms($customId) {
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -24,55 +24,55 @@  discard block
 block discarded – undo
24 24
     /* @var Entry[] */
25 25
     public $entryArray = array();
26 26
 
27
-    public static function getPage ($pageId, $id, $query, $n)
27
+    public static function getPage($pageId, $id, $query, $n)
28 28
     {
29 29
         switch ($pageId) {
30 30
             case Base::PAGE_ALL_AUTHORS :
31
-                return new PageAllAuthors ($id, $query, $n);
31
+                return new PageAllAuthors($id, $query, $n);
32 32
             case Base::PAGE_AUTHORS_FIRST_LETTER :
33
-                return new PageAllAuthorsLetter ($id, $query, $n);
33
+                return new PageAllAuthorsLetter($id, $query, $n);
34 34
             case Base::PAGE_AUTHOR_DETAIL :
35
-                return new PageAuthorDetail ($id, $query, $n);
35
+                return new PageAuthorDetail($id, $query, $n);
36 36
             case Base::PAGE_ALL_TAGS :
37
-                return new PageAllTags ($id, $query, $n);
37
+                return new PageAllTags($id, $query, $n);
38 38
             case Base::PAGE_TAG_DETAIL :
39
-                return new PageTagDetail ($id, $query, $n);
39
+                return new PageTagDetail($id, $query, $n);
40 40
             case Base::PAGE_ALL_LANGUAGES :
41
-                return new PageAllLanguages ($id, $query, $n);
41
+                return new PageAllLanguages($id, $query, $n);
42 42
             case Base::PAGE_LANGUAGE_DETAIL :
43
-                return new PageLanguageDetail ($id, $query, $n);
43
+                return new PageLanguageDetail($id, $query, $n);
44 44
             case Base::PAGE_ALL_CUSTOMS :
45
-                return new PageAllCustoms ($id, $query, $n);
45
+                return new PageAllCustoms($id, $query, $n);
46 46
             case Base::PAGE_CUSTOM_DETAIL :
47
-                return new PageCustomDetail ($id, $query, $n);
47
+                return new PageCustomDetail($id, $query, $n);
48 48
             case Base::PAGE_ALL_RATINGS :
49
-                return new PageAllRating ($id, $query, $n);
49
+                return new PageAllRating($id, $query, $n);
50 50
             case Base::PAGE_RATING_DETAIL :
51
-                return new PageRatingDetail ($id, $query, $n);
51
+                return new PageRatingDetail($id, $query, $n);
52 52
             case Base::PAGE_ALL_SERIES :
53
-                return new PageAllSeries ($id, $query, $n);
53
+                return new PageAllSeries($id, $query, $n);
54 54
             case Base::PAGE_ALL_BOOKS :
55
-                return new PageAllBooks ($id, $query, $n);
55
+                return new PageAllBooks($id, $query, $n);
56 56
             case Base::PAGE_ALL_BOOKS_LETTER:
57
-                return new PageAllBooksLetter ($id, $query, $n);
57
+                return new PageAllBooksLetter($id, $query, $n);
58 58
             case Base::PAGE_ALL_RECENT_BOOKS :
59
-                return new PageRecentBooks ($id, $query, $n);
59
+                return new PageRecentBooks($id, $query, $n);
60 60
             case Base::PAGE_SERIE_DETAIL :
61
-                return new PageSerieDetail ($id, $query, $n);
61
+                return new PageSerieDetail($id, $query, $n);
62 62
             case Base::PAGE_OPENSEARCH_QUERY :
63
-                return new PageQueryResult ($id, $query, $n);
63
+                return new PageQueryResult($id, $query, $n);
64 64
             case Base::PAGE_BOOK_DETAIL :
65
-                return new PageBookDetail ($id, $query, $n);
65
+                return new PageBookDetail($id, $query, $n);
66 66
             case Base::PAGE_ALL_PUBLISHERS:
67
-                return new PageAllPublishers ($id, $query, $n);
67
+                return new PageAllPublishers($id, $query, $n);
68 68
             case Base::PAGE_PUBLISHER_DETAIL :
69
-                return new PagePublisherDetail ($id, $query, $n);
69
+                return new PagePublisherDetail($id, $query, $n);
70 70
             case Base::PAGE_ABOUT :
71
-                return new PageAbout ($id, $query, $n);
71
+                return new PageAbout($id, $query, $n);
72 72
             case Base::PAGE_CUSTOMIZE :
73
-                return new PageCustomize ($id, $query, $n);
73
+                return new PageCustomize($id, $query, $n);
74 74
             default:
75
-                $page = new Page ($id, $query, $n);
75
+                $page = new Page($id, $query, $n);
76 76
                 $page->idPage = "cops:catalog";
77 77
                 return $page;
78 78
         }
@@ -85,96 +85,96 @@  discard block
 block discarded – undo
85 85
         $this->query = $pquery;
86 86
         $this->n = $pn;
87 87
         $this->favicon = $config['cops_icon'];
88
-        $this->authorName = empty($config['cops_author_name']) ? utf8_encode('Sébastien Lucas') : $config['cops_author_name'];
89
-        $this->authorUri = empty($config['cops_author_uri']) ? 'http://blog.slucas.fr' : $config['cops_author_uri'];
90
-        $this->authorEmail = empty($config['cops_author_email']) ? '[email protected]' : $config['cops_author_email'];
88
+        $this->authorName = empty($config['cops_author_name'])?utf8_encode('Sébastien Lucas'):$config['cops_author_name'];
89
+        $this->authorUri = empty($config['cops_author_uri'])?'http://blog.slucas.fr':$config['cops_author_uri'];
90
+        $this->authorEmail = empty($config['cops_author_email'])?'[email protected]':$config['cops_author_email'];
91 91
     }
92 92
 
93
-    public function InitializeContent ()
93
+    public function InitializeContent()
94 94
     {
95 95
         global $config;
96 96
         $this->title = $config['cops_title_default'];
97 97
         $this->subtitle = $config['cops_subtitle_default'];
98
-        if (Base::noDatabaseSelected ()) {
98
+        if (Base::noDatabaseSelected()) {
99 99
             $i = 0;
100
-            foreach (Base::getDbNameList () as $key) {
101
-                $nBooks = Book::getBookCount ($i);
102
-                array_push ($this->entryArray, new Entry ($key, "cops:{$i}:catalog",
103
-                                        str_format (localize ("bookword", $nBooks), $nBooks), "text",
104
-                                        array ( new LinkNavigation ("?" . DB . "={$i}")), "", $nBooks));
100
+            foreach (Base::getDbNameList() as $key) {
101
+                $nBooks = Book::getBookCount($i);
102
+                array_push($this->entryArray, new Entry($key, "cops:{$i}:catalog",
103
+                                        str_format(localize("bookword", $nBooks), $nBooks), "text",
104
+                                        array(new LinkNavigation("?" . DB . "={$i}")), "", $nBooks));
105 105
                 $i++;
106
-                Base::clearDb ();
106
+                Base::clearDb();
107 107
             }
108 108
         } else {
109
-            if (!in_array (PageQueryResult::SCOPE_AUTHOR, getCurrentOption ('ignored_categories'))) {
110
-                array_push ($this->entryArray, Author::getCount());
109
+            if (!in_array(PageQueryResult::SCOPE_AUTHOR, getCurrentOption('ignored_categories'))) {
110
+                array_push($this->entryArray, Author::getCount());
111 111
             }
112
-            if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) {
112
+            if (!in_array(PageQueryResult::SCOPE_SERIES, getCurrentOption('ignored_categories'))) {
113 113
                 $series = Serie::getCount();
114
-                if (!is_null ($series)) array_push ($this->entryArray, $series);
114
+                if (!is_null($series)) array_push($this->entryArray, $series);
115 115
             }
116
-            if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) {
116
+            if (!in_array(PageQueryResult::SCOPE_PUBLISHER, getCurrentOption('ignored_categories'))) {
117 117
                 $publisher = Publisher::getCount();
118
-                if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
118
+                if (!is_null($publisher)) array_push($this->entryArray, $publisher);
119 119
             }
120
-            if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) {
120
+            if (!in_array(PageQueryResult::SCOPE_TAG, getCurrentOption('ignored_categories'))) {
121 121
                 $tags = Tag::getCount();
122
-                if (!is_null ($tags)) array_push ($this->entryArray, $tags);
122
+                if (!is_null($tags)) array_push($this->entryArray, $tags);
123 123
             }
124
-            if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) {
124
+            if (!in_array(PageQueryResult::SCOPE_RATING, getCurrentOption('ignored_categories'))) {
125 125
                 $rating = Rating::getCount();
126
-                if (!is_null ($rating)) array_push ($this->entryArray, $rating);
126
+                if (!is_null($rating)) array_push($this->entryArray, $rating);
127 127
             }
128
-            if (!in_array ("language", getCurrentOption ('ignored_categories'))) {
128
+            if (!in_array("language", getCurrentOption('ignored_categories'))) {
129 129
                 $languages = Language::getCount();
130
-                if (!is_null ($languages)) array_push ($this->entryArray, $languages);
130
+                if (!is_null($languages)) array_push($this->entryArray, $languages);
131 131
             }
132 132
             foreach ($config['cops_calibre_custom_column'] as $lookup) {
133 133
                 $customColumn = CustomColumnType::createByLookup($lookup);
134
-                if (!is_null ($customColumn) && $customColumn->isSearchable()) {
135
-                    array_push ($this->entryArray, $customColumn->getCount());
134
+                if (!is_null($customColumn) && $customColumn->isSearchable()) {
135
+                    array_push($this->entryArray, $customColumn->getCount());
136 136
                 }
137 137
             }
138
-            $this->entryArray = array_merge ($this->entryArray, Book::getCount());
138
+            $this->entryArray = array_merge($this->entryArray, Book::getCount());
139 139
 
140
-            if (Base::isMultipleDatabaseEnabled ()) $this->title =  Base::getDbName ();
140
+            if (Base::isMultipleDatabaseEnabled()) $this->title = Base::getDbName();
141 141
         }
142 142
     }
143 143
 
144
-    public function isPaginated ()
144
+    public function isPaginated()
145 145
     {
146
-        return (getCurrentOption ("max_item_per_page") != -1 &&
146
+        return (getCurrentOption("max_item_per_page") != -1 &&
147 147
                 $this->totalNumber != -1 &&
148
-                $this->totalNumber > getCurrentOption ("max_item_per_page"));
148
+                $this->totalNumber > getCurrentOption("max_item_per_page"));
149 149
     }
150 150
 
151
-    public function getNextLink ()
151
+    public function getNextLink()
152 152
     {
153
-        $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ());
154
-        if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) {
155
-            return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate"));
153
+        $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString());
154
+        if (($this->n) * getCurrentOption("max_item_per_page") < $this->totalNumber) {
155
+            return new LinkNavigation($currentUrl . "&n=" . ($this->n + 1), "next", localize("paging.next.alternate"));
156 156
         }
157 157
         return NULL;
158 158
     }
159 159
 
160
-    public function getPrevLink ()
160
+    public function getPrevLink()
161 161
     {
162
-        $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ());
162
+        $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString());
163 163
         if ($this->n > 1) {
164
-            return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate"));
164
+            return new LinkNavigation($currentUrl . "&n=" . ($this->n - 1), "previous", localize("paging.previous.alternate"));
165 165
         }
166 166
         return NULL;
167 167
     }
168 168
 
169
-    public function getMaxPage ()
169
+    public function getMaxPage()
170 170
     {
171
-        return ceil ($this->totalNumber / getCurrentOption ("max_item_per_page"));
171
+        return ceil($this->totalNumber / getCurrentOption("max_item_per_page"));
172 172
     }
173 173
 
174
-    public function containsBook ()
174
+    public function containsBook()
175 175
     {
176
-        if (count ($this->entryArray) == 0) return false;
177
-        if (get_class ($this->entryArray [0]) == "EntryBook") return true;
176
+        if (count($this->entryArray) == 0) return false;
177
+        if (get_class($this->entryArray [0]) == "EntryBook") return true;
178 178
         return false;
179 179
     }
180 180
 }
Please login to merge, or discard this patch.
lib/Data.php 4 patches
Braces   +42 added lines, -29 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
         'zip'   => 'application/zip'
56 56
     );
57 57
 
58
-    public function __construct($post, $book = null) {
58
+    public function __construct($post, $book = null)
59
+    {
59 60
         $this->id = $post->id;
60 61
         $this->name = $post->name;
61 62
         $this->format = $post->format;
@@ -64,19 +65,20 @@  discard block
 block discarded – undo
64 65
         $this->book = $book;
65 66
     }
66 67
 
67
-    public function isKnownType () {
68
+    public function isKnownType ()
69
+    {
68 70
         return array_key_exists ($this->extension, self::$mimetypes);
69 71
     }
70 72
 
71
-    public function getMimeType () {
73
+    public function getMimeType ()
74
+    {
72 75
         $result = "application/octet-stream";
73 76
         if ($this->isKnownType ()) {
74 77
             return self::$mimetypes [$this->extension];
75 78
         } elseif (function_exists('finfo_open') === true) {
76 79
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
77 80
 
78
-            if (is_resource($finfo) === true)
79
-            {
81
+            if (is_resource($finfo) === true) {
80 82
                 $result = finfo_file($finfo, $this->getLocalPath ());
81 83
             }
82 84
 
@@ -86,27 +88,33 @@  discard block
 block discarded – undo
86 88
         return $result;
87 89
     }
88 90
 
89
-    public function isEpubValidOnKobo () {
91
+    public function isEpubValidOnKobo ()
92
+    {
90 93
         return $this->format == "EPUB" || $this->format == "KEPUB";
91 94
     }
92 95
 
93
-    public function getFilename () {
96
+    public function getFilename ()
97
+    {
94 98
         return $this->name . "." . strtolower ($this->format);
95 99
     }
96 100
 
97
-    public function getUpdatedFilename () {
101
+    public function getUpdatedFilename ()
102
+    {
98 103
         return $this->book->getAuthorsSort () . " - " . $this->book->title;
99 104
     }
100 105
 
101
-    public function getUpdatedFilenameEpub () {
106
+    public function getUpdatedFilenameEpub ()
107
+    {
102 108
         return $this->getUpdatedFilename () . ".epub";
103 109
     }
104 110
 
105
-    public function getUpdatedFilenameKepub () {
111
+    public function getUpdatedFilenameKepub ()
112
+    {
106 113
         return $this->getUpdatedFilename () . ".kepub.epub";
107 114
     }
108 115
 
109
-    public function getDataLink ($rel, $title = NULL) {
116
+    public function getDataLink ($rel, $title = NULL)
117
+    {
110 118
         global $config;
111 119
 
112 120
         if ($rel == Link::OPDS_ACQUISITION_TYPE && $config['cops_use_url_rewriting'] == "1") {
@@ -116,19 +124,24 @@  discard block
 block discarded – undo
116 124
         return self::getLink ($this->book, $this->extension, $this->getMimeType (), $rel, $this->getFilename (), $this->id, $title);
117 125
     }
118 126
 
119
-    public function getHtmlLink () {
127
+    public function getHtmlLink ()
128
+    {
120 129
         return $this->getDataLink(Link::OPDS_ACQUISITION_TYPE)->href;
121 130
     }
122 131
 
123
-    public function getLocalPath () {
132
+    public function getLocalPath ()
133
+    {
124 134
         return $this->book->path . "/" . $this->getFilename ();
125 135
     }
126 136
 
127
-    public function getHtmlLinkWithRewriting ($title = NULL) {
137
+    public function getHtmlLinkWithRewriting ($title = NULL)
138
+    {
128 139
         global $config;
129 140
 
130 141
         $database = "";
131
-        if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/";
142
+        if (!is_null (GetUrlParam (DB))) {
143
+            $database = GetUrlParam (DB) . "/";
144
+        }
132 145
 
133 146
         $href = "download/" . $this->id . "/" . $database;
134 147
 
@@ -142,28 +155,27 @@  discard block
 block discarded – undo
142 155
         return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title);
143 156
     }
144 157
 
145
-    public static function getDataByBook ($book) {
158
+    public static function getDataByBook ($book)
159
+    {
146 160
         $out = array ();
147 161
         $result = parent::getDb ()->prepare('select id, format, name
148 162
                                              from data where book = ?');
149 163
         $result->execute (array ($book->id));
150 164
 
151
-        while ($post = $result->fetchObject ())
152
-        {
165
+        while ($post = $result->fetchObject ()) {
153 166
             array_push ($out, new Data ($post, $book));
154 167
         }
155 168
         return $out;
156 169
     }
157 170
 
158
-    public static function handleThumbnailLink ($urlParam, $height) {
171
+    public static function handleThumbnailLink ($urlParam, $height)
172
+    {
159 173
         global $config;
160 174
 
161 175
         if (is_null ($height)) {
162 176
             if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) {
163 177
                 $height = $config['cops_opds_thumbnail_height'];
164
-            }
165
-            else
166
-            {
178
+            } else {
167 179
                 $height = $config['cops_html_thumbnail_height'];
168 180
             }
169 181
         }
@@ -182,14 +194,17 @@  discard block
 block discarded – undo
182 194
 
183 195
         if (Base::useAbsolutePath () ||
184 196
             $rel == Link::OPDS_THUMBNAIL_TYPE ||
185
-            ($type == "epub" && $config['cops_update_epub-metadata']))
186
-        {
187
-            if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type);
197
+            ($type == "epub" && $config['cops_update_epub-metadata'])) {
198
+            if ($type != "jpg") {
199
+                $urlParam = addURLParameter($urlParam, "type", $type);
200
+            }
188 201
             if ($rel == Link::OPDS_THUMBNAIL_TYPE) {
189 202
                 $urlParam = self::handleThumbnailLink($urlParam, $height);
190 203
             }
191 204
             $urlParam = addURLParameter($urlParam, "id", $book->id);
192
-            if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
205
+            if (!is_null (GetUrlParam (DB))) {
206
+                $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
207
+            }
193 208
             if ($config['cops_thumbnail_handling'] != "1" &&
194 209
                 !empty ($config['cops_thumbnail_handling']) &&
195 210
                 $rel == Link::OPDS_THUMBNAIL_TYPE) {
@@ -197,9 +212,7 @@  discard block
 block discarded – undo
197 212
             } else {
198 213
                 return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title);
199 214
             }
200
-        }
201
-        else
202
-        {
215
+        } else {
203 216
             return new Link (str_replace('%2F','/',rawurlencode ($book->path."/".$filename)), $mime, $rel, $title);
204 217
         }
205 218
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         return $this->getUpdatedFilename () . ".kepub.epub";
106 106
     }
107 107
 
108
-    public function getDataLink ($rel, $title = NULL) {
108
+    public function getDataLink ($rel, $title = null) {
109 109
         global $config;
110 110
 
111 111
         if ($rel == Link::OPDS_ACQUISITION_TYPE && $config['cops_use_url_rewriting'] == "1") {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         return $this->book->path . "/" . $this->getFilename ();
124 124
     }
125 125
 
126
-    public function getHtmlLinkWithRewriting ($title = NULL) {
126
+    public function getHtmlLinkWithRewriting ($title = null) {
127 127
         global $config;
128 128
 
129 129
         $database = "";
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         return $urlParam;
174 174
     }
175 175
 
176
-    public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL)
176
+    public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = null, $height = null)
177 177
     {
178 178
         global $config;
179 179
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
     public function getUpdatedFilenameKepub () {
106 106
         $str = $this->getUpdatedFilename () . ".kepub.epub";
107 107
         return str_replace(array(':', '#', '&'),
108
-                           array('-', '-', ' '), $str );
108
+                            array('-', '-', ' '), $str );
109 109
     }
110 110
 
111 111
     public function getDataLink ($rel, $title = NULL) {
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -59,25 +59,25 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/PageAllBooksLetter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@
 block discarded – undo
8 8
 
9 9
 class PageAllBooksLetter extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksByStartingLetter ($this->idGet, $this->n);
14
-        $this->idPage = Book::getEntryIdByLetter ($this->idGet);
13
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksByStartingLetter($this->idGet, $this->n);
14
+        $this->idPage = Book::getEntryIdByLetter($this->idGet);
15 15
 
16 16
         $count = $this->totalNumber;
17 17
         if ($count == -1)
18
-            $count = count ($this->entryArray);
18
+            $count = count($this->entryArray);
19 19
 
20
-        $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("bookword", $count), $count), $this->idGet);
20
+        $this->title = str_format(localize("splitByLetter.letter"), str_format(localize("bookword", $count), $count), $this->idGet);
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
         $this->idPage = Book::getEntryIdByLetter ($this->idGet);
15 15
 
16 16
         $count = $this->totalNumber;
17
-        if ($count == -1)
18
-            $count = count ($this->entryArray);
17
+        if ($count == -1) {
18
+                    $count = count ($this->entryArray);
19
+        }
19 20
 
20 21
         $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("bookword", $count), $count), $this->idGet);
21 22
     }
Please login to merge, or discard this patch.
lib/PageLanguageDetail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/PageAllAuthorsLetter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 
9 9
 class PageAllAuthorsLetter extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $this->idPage = Author::getEntryIdByLetter ($this->idGet);
14
-        $this->entryArray = Author::getAuthorsByStartingLetter ($this->idGet);
15
-        $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("authorword", count ($this->entryArray)), count ($this->entryArray)), $this->idGet);
13
+        $this->idPage = Author::getEntryIdByLetter($this->idGet);
14
+        $this->entryArray = Author::getAuthorsByStartingLetter($this->idGet);
15
+        $this->title = str_format(localize("splitByLetter.letter"), str_format(localize("authorword", count($this->entryArray)), count($this->entryArray)), $this->idGet);
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
lib/EntryBook.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
     public $book;
12 12
 
13 13
     public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
14
-        parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
14
+        parent::__construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
15 15
         $this->book = $pbook;
16 16
         $this->localUpdated = $pbook->timestamp;
17 17
     }
18 18
 
19
-    public function getCoverThumbnail () {
19
+    public function getCoverThumbnail() {
20 20
         foreach ($this->linkArray as $link) {
21 21
             if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
22
-                return $link->hrefXhtml ();
22
+                return $link->hrefXhtml();
23 23
         }
24 24
         return null;
25 25
     }
26 26
 
27
-    public function getCover () {
27
+    public function getCover() {
28 28
         foreach ($this->linkArray as $link) {
29 29
             if ($link->rel == Link::OPDS_IMAGE_TYPE)
30
-                return $link->hrefXhtml ();
30
+                return $link->hrefXhtml();
31 31
         }
32 32
         return null;
33 33
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,24 +10,29 @@
 block discarded – undo
10 10
 {
11 11
     public $book;
12 12
 
13
-    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
13
+    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook)
14
+    {
14 15
         parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
15 16
         $this->book = $pbook;
16 17
         $this->localUpdated = $pbook->timestamp;
17 18
     }
18 19
 
19
-    public function getCoverThumbnail () {
20
+    public function getCoverThumbnail ()
21
+    {
20 22
         foreach ($this->linkArray as $link) {
21
-            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
22
-                return $link->hrefXhtml ();
23
+            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) {
24
+                            return $link->hrefXhtml ();
25
+            }
23 26
         }
24 27
         return null;
25 28
     }
26 29
 
27
-    public function getCover () {
30
+    public function getCover ()
31
+    {
28 32
         foreach ($this->linkArray as $link) {
29
-            if ($link->rel == Link::OPDS_IMAGE_TYPE)
30
-                return $link->hrefXhtml ();
33
+            if ($link->rel == Link::OPDS_IMAGE_TYPE) {
34
+                            return $link->hrefXhtml ();
35
+            }
31 36
         }
32 37
         return null;
33 38
     }
Please login to merge, or discard this patch.