Test Setup Failed
Push — master ( f65537...7828cc )
by Sébastien
01:05
created
lib/Language.php 3 patches
Spacing   +19 added lines, -19 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=".parent::PAGE_LANGUAGE_DETAIL."&id=$this->id";
21
+    public function getUri() {
22
+        return "?page=" . parent::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 parent::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, parent::PAGE_ALL_LANGUAGES);
39
+        return parent::getCountGeneric("languages", self::ALL_LANGUAGES_ID, parent::PAGE_ALL_LANGUAGES);
40 40
     }
41 41
 
42
-    public static function getLanguageById ($languageId) {
43
-        $result = parent::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 = parent::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
     }
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 
52 52
 
53 53
     public static function getAllLanguages() {
54
-        $result = parent::getDb ()->query('select languages.id as id, languages.lang_code as lang_code, count(*) as count
54
+        $result = parent::getDb()->query('select languages.id as id, languages.lang_code as lang_code, count(*) as count
55 55
 from languages, books_languages_link
56 56
 where languages.id = books_languages_link.lang_code
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.
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
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         if ($post = $result->fetchObject ()) {
46 46
             return new Language ($post->id, Language::getLanguageString ($post->lang_code));
47 47
         }
48
-        return NULL;
48
+        return null;
49 49
     }
50 50
 
51 51
 
Please login to merge, or discard this patch.
lib/CustomColumnTypeComment.php 2 patches
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 
42 42
     protected function getAllCustomValuesFromDatabase()
43 43
     {
44
-        return NULL;
44
+        return null;
45 45
     }
46 46
 
47 47
     public function getDescription()
48 48
     {
49 49
         $desc = $this->getDatabaseDescription();
50
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
50
+        if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
51 51
         return $desc;
52 52
     }
53 53
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         if ($post = $result->fetchObject()) {
61 61
             return new CustomColumn($post->id, $post->value, $this);
62 62
         }
63
-        return new CustomColumn(NULL, localize("customcolumn.float.unknown"), $this);
63
+        return new CustomColumn(null, localize("customcolumn.float.unknown"), $this);
64 64
     }
65 65
 
66 66
     public function isSearchable()
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === NULL || empty($desc)) {
59
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
60
+        }
59 61
         return $desc;
60 62
     }
61 63
 
Please login to merge, or discard this patch.
lib/JSON_renderer.php 4 patches
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
      * @param Book $book
15 15
      * @return array
16 16
      */
17
-    public static function getBookContentArray ($book) {
17
+    public static function getBookContentArray ($book)
18
+    {
18 19
         global $config;
19 20
         $i = 0;
20 21
         $preferedData = array ();
21
-        foreach ($config['cops_prefered_format'] as $format)
22
-        {
22
+        foreach ($config['cops_prefered_format'] as $format) {
23 23
             if ($i == 2) { break; }
24 24
             if ($data = $book->getDataFormat ($format)) {
25 25
                 $i++;
@@ -71,7 +71,8 @@  discard block
 block discarded – undo
71 71
      * @param Book $book
72 72
      * @return array
73 73
      */
74
-    public static function getFullBookContentArray ($book) {
74
+    public static function getFullBookContentArray ($book)
75
+    {
75 76
         global $config;
76 77
         $out = self::getBookContentArray ($book);
77 78
         $database = GetUrlParam (DB);
@@ -106,7 +107,8 @@  discard block
 block discarded – undo
106 107
         return $out;
107 108
     }
108 109
 
109
-    public static function getContentArray ($entry) {
110
+    public static function getContentArray ($entry)
111
+    {
110 112
         if ($entry instanceof EntryBook) {
111 113
             $out = array ( "title" => $entry->title);
112 114
             $out ["book"] = self::getBookContentArray ($entry->book);
@@ -115,7 +117,8 @@  discard block
 block discarded – undo
115 117
         return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement );
116 118
     }
117 119
 
118
-    public static function getContentArrayTypeahead ($page) {
120
+    public static function getContentArrayTypeahead ($page)
121
+    {
119 122
         $out = array ();
120 123
         foreach ($page->entryArray as $entry) {
121 124
             if ($entry instanceof EntryBook) {
@@ -131,7 +134,8 @@  discard block
 block discarded – undo
131 134
         return $out;
132 135
     }
133 136
 
134
-    public static function addCompleteArray ($in) {
137
+    public static function addCompleteArray ($in)
138
+    {
135 139
         global $config;
136 140
         $out = $in;
137 141
 
@@ -178,7 +182,8 @@  discard block
 block discarded – undo
178 182
         return $out;
179 183
     }
180 184
 
181
-    public static function getJson ($complete = false) {
185
+    public static function getJson ($complete = false)
186
+    {
182 187
         global $config;
183 188
         $page = getURLParam ("page", Base::PAGE_INDEX);
184 189
         $query = getURLParam ("query");
@@ -247,7 +252,9 @@  discard block
 block discarded – undo
247 252
         }
248 253
 
249 254
         $out ["homeurl"] = "index.php";
250
-        if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
255
+        if ($page != Base::PAGE_INDEX && !is_null ($database)) {
256
+            $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
257
+        }
251 258
 
252 259
         return $out;
253 260
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@
 block discarded – undo
76 76
         $out = self::getBookContentArray ($book);
77 77
         $database = GetUrlParam (DB);
78 78
 
79
-        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
80
-        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
79
+        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", null)->hrefXhtml ();
80
+        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", null, null, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
81 81
         $out ["content"] = $book->getComment (false);
82 82
         $out ["datas"] = array ();
83 83
         $dataKindle = $book->GetMostInterestingDataToSendToKindle ();
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -14,53 +14,53 @@  discard block
 block discarded – undo
14 14
      * @param Book $book
15 15
      * @return array
16 16
      */
17
-    public static function getBookContentArray ($book) {
17
+    public static function getBookContentArray($book) {
18 18
         global $config;
19 19
         $i = 0;
20
-        $preferedData = array ();
20
+        $preferedData = array();
21 21
         foreach ($config['cops_prefered_format'] as $format)
22 22
         {
23 23
             if ($i == 2) { break; }
24
-            if ($data = $book->getDataFormat ($format)) {
24
+            if ($data = $book->getDataFormat($format)) {
25 25
                 $i++;
26
-                array_push ($preferedData, array ("url" => $data->getHtmlLink (),
27
-                  "viewUrl" => $data->getViewHtmlLink (), "name" => $format));
26
+                array_push($preferedData, array("url" => $data->getHtmlLink(),
27
+                  "viewUrl" => $data->getViewHtmlLink(), "name" => $format));
28 28
             }
29 29
         }
30 30
 
31 31
         $publisher = $book->getPublisher();
32
-        if (is_null ($publisher)) {
32
+        if (is_null($publisher)) {
33 33
             $pn = "";
34 34
             $pu = "";
35 35
         } else {
36 36
             $pn = $publisher->name;
37
-            $link = new LinkNavigation ($publisher->getUri ());
38
-            $pu = $link->hrefXhtml ();
37
+            $link = new LinkNavigation($publisher->getUri());
38
+            $pu = $link->hrefXhtml();
39 39
         }
40 40
 
41
-        $serie = $book->getSerie ();
42
-        if (is_null ($serie)) {
41
+        $serie = $book->getSerie();
42
+        if (is_null($serie)) {
43 43
             $sn = "";
44 44
             $scn = "";
45 45
             $su = "";
46 46
         } else {
47 47
             $sn = $serie->name;
48
-            $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name);
49
-            $link = new LinkNavigation ($serie->getUri ());
50
-            $su = $link->hrefXhtml ();
48
+            $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name);
49
+            $link = new LinkNavigation($serie->getUri());
50
+            $su = $link->hrefXhtml();
51 51
         }
52 52
         $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true);
53 53
 
54
-        return array ("id" => $book->id,
54
+        return array("id" => $book->id,
55 55
                       "hasCover" => $book->hasCover,
56 56
                       "preferedData" => $preferedData,
57
-                      "rating" => $book->getRating (),
57
+                      "rating" => $book->getRating(),
58 58
                       "publisherName" => $pn,
59 59
                       "publisherurl" => $pu,
60
-                      "pubDate" => $book->getPubDate (),
61
-                      "languagesName" => $book->getLanguages (),
62
-                      "authorsName" => $book->getAuthorsName (),
63
-                      "tagsName" => $book->getTagsName (),
60
+                      "pubDate" => $book->getPubDate(),
61
+                      "languagesName" => $book->getLanguages(),
62
+                      "authorsName" => $book->getAuthorsName(),
63
+                      "tagsName" => $book->getTagsName(),
64 64
                       "seriesName" => $sn,
65 65
                       "seriesIndex" => $book->seriesIndex,
66 66
                       "seriesCompleteName" => $scn,
@@ -72,90 +72,90 @@  discard block
 block discarded – undo
72 72
      * @param Book $book
73 73
      * @return array
74 74
      */
75
-    public static function getFullBookContentArray ($book) {
75
+    public static function getFullBookContentArray($book) {
76 76
         global $config;
77
-        $out = self::getBookContentArray ($book);
78
-        $database = GetUrlParam (DB);
77
+        $out = self::getBookContentArray($book);
78
+        $database = GetUrlParam(DB);
79 79
 
80
-        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
81
-        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
82
-        $out ["content"] = $book->getComment (false);
83
-        $out ["datas"] = array ();
84
-        $dataKindle = $book->GetMostInterestingDataToSendToKindle ();
80
+        $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml();
81
+        $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml();
82
+        $out ["content"] = $book->getComment(false);
83
+        $out ["datas"] = array();
84
+        $dataKindle = $book->GetMostInterestingDataToSendToKindle();
85 85
         foreach ($book->getDatas() as $data) {
86
-            $tab = array ("id" => $data->id,
86
+            $tab = array("id" => $data->id,
87 87
                 "format" => $data->format, 
88
-                "url" => $data->getHtmlLink (),
89
-                "viewUrl" => $data->getViewHtmlLink (),
88
+                "url" => $data->getHtmlLink(),
89
+                "viewUrl" => $data->getViewHtmlLink(),
90 90
                 "mail" => 0, 
91 91
                 "readerUrl" => "");
92
-            if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) {
92
+            if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) {
93 93
                 $tab ["mail"] = 1;
94 94
             }
95 95
             if ($data->format == "EPUB") {
96 96
                 $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}";
97 97
             }
98
-            array_push ($out ["datas"], $tab);
98
+            array_push($out ["datas"], $tab);
99 99
         }
100
-        $out ["authors"] = array ();
101
-        foreach ($book->getAuthors () as $author) {
102
-            $link = new LinkNavigation ($author->getUri ());
103
-            array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ()));
100
+        $out ["authors"] = array();
101
+        foreach ($book->getAuthors() as $author) {
102
+            $link = new LinkNavigation($author->getUri());
103
+            array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml()));
104 104
         }
105
-        $out ["tags"] = array ();
106
-        foreach ($book->getTags () as $tag) {
107
-            $link = new LinkNavigation ($tag->getUri ());
108
-            array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ()));
105
+        $out ["tags"] = array();
106
+        foreach ($book->getTags() as $tag) {
107
+            $link = new LinkNavigation($tag->getUri());
108
+            array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml()));
109 109
         }
110 110
         $out ["customcolumns_preview"] = $book->getCustomColumnValues($config['cops_calibre_custom_column_preview'], true);
111 111
 
112 112
         return $out;
113 113
     }
114 114
 
115
-    public static function getContentArray ($entry) {
115
+    public static function getContentArray($entry) {
116 116
         if ($entry instanceof EntryBook) {
117
-            $out = array ( "title" => $entry->title);
118
-            $out ["book"] = self::getBookContentArray ($entry->book);
117
+            $out = array("title" => $entry->title);
118
+            $out ["book"] = self::getBookContentArray($entry->book);
119 119
             return $out;
120 120
         }
121
-        return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement );
121
+        return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement);
122 122
     }
123 123
 
124
-    public static function getContentArrayTypeahead ($page) {
125
-        $out = array ();
124
+    public static function getContentArrayTypeahead($page) {
125
+        $out = array();
126 126
         foreach ($page->entryArray as $entry) {
127 127
             if ($entry instanceof EntryBook) {
128
-                array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ()));
128
+                array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl()));
129 129
             } else {
130
-                if (empty ($entry->className) xor Base::noDatabaseSelected ()) {
131
-                    array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ()));
130
+                if (empty ($entry->className) xor Base::noDatabaseSelected()) {
131
+                    array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink()));
132 132
                 } else {
133
-                    array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ()));
133
+                    array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink()));
134 134
                 }
135 135
             }
136 136
         }
137 137
         return $out;
138 138
     }
139 139
 
140
-    public static function addCompleteArray ($in) {
140
+    public static function addCompleteArray($in) {
141 141
         global $config;
142 142
         $out = $in;
143 143
 
144
-        $out ["c"] = array ("version" => VERSION, "i18n" => array (
144
+        $out ["c"] = array("version" => VERSION, "i18n" => array(
145 145
                            "coverAlt" => localize("i18n.coversection"),
146 146
                            "authorsTitle" => localize("authors.title"),
147 147
                            "bookwordTitle" => localize("bookword.title"),
148 148
                            "tagsTitle" => localize("tags.title"),
149 149
                            "seriesTitle" => localize("series.title"),
150
-                           "customizeTitle" => localize ("customize.title"),
151
-                           "aboutTitle" => localize ("about.title"),
152
-                           "previousAlt" => localize ("paging.previous.alternate"),
153
-                           "nextAlt" => localize ("paging.next.alternate"),
154
-                           "searchAlt" => localize ("search.alternate"),
155
-                           "sortAlt" => localize ("sort.alternate"),
156
-                           "homeAlt" => localize ("home.alternate"),
157
-                           "cogAlt" => localize ("cog.alternate"),
158
-                           "permalinkAlt" => localize ("permalink.alternate"),
150
+                           "customizeTitle" => localize("customize.title"),
151
+                           "aboutTitle" => localize("about.title"),
152
+                           "previousAlt" => localize("paging.previous.alternate"),
153
+                           "nextAlt" => localize("paging.next.alternate"),
154
+                           "searchAlt" => localize("search.alternate"),
155
+                           "sortAlt" => localize("sort.alternate"),
156
+                           "homeAlt" => localize("home.alternate"),
157
+                           "cogAlt" => localize("cog.alternate"),
158
+                           "permalinkAlt" => localize("permalink.alternate"),
159 159
                            "publisherName" => localize("publisher.name"),
160 160
                            "pubdateTitle" => localize("pubdate.title"),
161 161
                            "languagesTitle" => localize("language.title"),
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
                            "sortorderAsc" => localize("search.sortorder.asc"),
164 164
                            "sortorderDesc" => localize("search.sortorder.desc"),
165 165
                            "customizeEmail" => localize("customize.email")),
166
-                       "url" => array (
166
+                       "url" => array(
167 167
                            "detailUrl" => "index.php?page=13&id={0}&db={1}",
168 168
                            "coverUrl" => "fetch.php?id={0}&db={1}",
169 169
                            "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
170
-                       "config" => array (
170
+                       "config" => array(
171 171
                            "use_fancyapps" => $config ["cops_use_fancyapps"],
172 172
                            "max_item_per_page" => $config['cops_max_item_per_page'],
173 173
                            "kindleHack"        => "",
174
-                           "server_side_rendering" => useServerSideRendering (),
174
+                           "server_side_rendering" => useServerSideRendering(),
175 175
                            "html_tag_filter" => $config['cops_html_tag_filter']));
176 176
         if ($config['cops_thumbnail_handling'] == "1") {
177 177
             $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
@@ -184,32 +184,32 @@  discard block
 block discarded – undo
184 184
         return $out;
185 185
     }
186 186
 
187
-    public static function getJson ($complete = false) {
187
+    public static function getJson($complete = false) {
188 188
         global $config;
189
-        $page = getURLParam ("page", Base::PAGE_INDEX);
190
-        $query = getURLParam ("query");
191
-        $search = getURLParam ("search");
192
-        $qid = getURLParam ("id");
193
-        $n = getURLParam ("n", "1");
194
-        $database = GetUrlParam (DB);
189
+        $page = getURLParam("page", Base::PAGE_INDEX);
190
+        $query = getURLParam("query");
191
+        $search = getURLParam("search");
192
+        $qid = getURLParam("id");
193
+        $n = getURLParam("n", "1");
194
+        $database = GetUrlParam(DB);
195 195
 
196
-        $currentPage = Page::getPage ($page, $qid, $query, $n);
197
-        $currentPage->InitializeContent ();
196
+        $currentPage = Page::getPage($page, $qid, $query, $n);
197
+        $currentPage->InitializeContent();
198 198
 
199 199
         if ($search) {
200
-            return self::getContentArrayTypeahead ($currentPage);
200
+            return self::getContentArrayTypeahead($currentPage);
201 201
         }
202 202
 
203
-        $out = array ( "title" => $currentPage->title);
204
-        $entries = array ();
203
+        $out = array("title" => $currentPage->title);
204
+        $entries = array();
205 205
         foreach ($currentPage->entryArray as $entry) {
206
-            array_push ($entries, self::getContentArray ($entry));
206
+            array_push($entries, self::getContentArray($entry));
207 207
         }
208
-        if (!is_null ($currentPage->book)) {
209
-            $out ["book"] = self::getFullBookContentArray ($currentPage->book);
208
+        if (!is_null($currentPage->book)) {
209
+            $out ["book"] = self::getFullBookContentArray($currentPage->book);
210 210
         }
211
-        $out ["databaseId"] = GetUrlParam (DB, "");
212
-        $out ["databaseName"] = Base::getDbName ();
211
+        $out ["databaseId"] = GetUrlParam(DB, "");
212
+        $out ["databaseName"] = Base::getDbName();
213 213
         if ($out ["databaseId"] == "") {
214 214
             $out ["databaseName"] = "";
215 215
         }
@@ -218,42 +218,42 @@  discard block
 block discarded – undo
218 218
             $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"];
219 219
         }
220 220
         $out ["page"] = $page;
221
-        $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0;
221
+        $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0;
222 222
         $out ["entries"] = $entries;
223 223
         $out ["isPaginated"] = 0;
224
-        if ($currentPage->isPaginated ()) {
225
-            $prevLink = $currentPage->getPrevLink ();
226
-            $nextLink = $currentPage->getNextLink ();
224
+        if ($currentPage->isPaginated()) {
225
+            $prevLink = $currentPage->getPrevLink();
226
+            $nextLink = $currentPage->getNextLink();
227 227
             $out ["isPaginated"] = 1;
228 228
             $out ["prevLink"] = "";
229
-            if (!is_null ($prevLink)) {
230
-                $out ["prevLink"] = $prevLink->hrefXhtml ();
229
+            if (!is_null($prevLink)) {
230
+                $out ["prevLink"] = $prevLink->hrefXhtml();
231 231
             }
232 232
             $out ["nextLink"] = "";
233
-            if (!is_null ($nextLink)) {
234
-                $out ["nextLink"] = $nextLink->hrefXhtml ();
233
+            if (!is_null($nextLink)) {
234
+                $out ["nextLink"] = $nextLink->hrefXhtml();
235 235
             }
236
-            $out ["maxPage"] = $currentPage->getMaxPage ();
236
+            $out ["maxPage"] = $currentPage->getMaxPage();
237 237
             $out ["currentPage"] = $currentPage->n;
238 238
         }
239
-        if (!is_null (getURLParam ("complete")) || $complete) {
240
-            $out = self::addCompleteArray ($out);
239
+        if (!is_null(getURLParam("complete")) || $complete) {
240
+            $out = self::addCompleteArray($out);
241 241
        }
242 242
 
243 243
         $out ["containsBook"] = 0;
244
-        if ($currentPage->containsBook ()) {
244
+        if ($currentPage->containsBook()) {
245 245
             $out ["containsBook"] = 1;
246 246
         }
247 247
 
248
-        $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database);
248
+        $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database);
249 249
 
250 250
         if ($page == Base::PAGE_ABOUT) {
251
-            $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
251
+            $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
252 252
             $out ["fullhtml"] = $temp;
253 253
         }
254 254
 
255 255
         $out ["homeurl"] = "index.php";
256
-        if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
256
+        if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database);
257 257
 
258 258
         return $out;
259 259
     }
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
             if ($data = $book->getDataFormat ($format)) {
25 25
                 $i++;
26 26
                 array_push ($preferedData, array ("url" => $data->getHtmlLink (),
27
-                  "viewUrl" => $data->getViewHtmlLink (), "name" => $format));
27
+                    "viewUrl" => $data->getViewHtmlLink (), "name" => $format));
28 28
             }
29 29
         }
30 30
 
@@ -52,20 +52,20 @@  discard block
 block discarded – undo
52 52
         $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true);
53 53
 
54 54
         return array ("id" => $book->id,
55
-                      "hasCover" => $book->hasCover,
56
-                      "preferedData" => $preferedData,
57
-                      "rating" => $book->getRating (),
58
-                      "publisherName" => $pn,
59
-                      "publisherurl" => $pu,
60
-                      "pubDate" => $book->getPubDate (),
61
-                      "languagesName" => $book->getLanguages (),
62
-                      "authorsName" => $book->getAuthorsName (),
63
-                      "tagsName" => $book->getTagsName (),
64
-                      "seriesName" => $sn,
65
-                      "seriesIndex" => $book->seriesIndex,
66
-                      "seriesCompleteName" => $scn,
67
-                      "seriesurl" => $su,
68
-                      "customcolumns_list" => $cc);
55
+                        "hasCover" => $book->hasCover,
56
+                        "preferedData" => $preferedData,
57
+                        "rating" => $book->getRating (),
58
+                        "publisherName" => $pn,
59
+                        "publisherurl" => $pu,
60
+                        "pubDate" => $book->getPubDate (),
61
+                        "languagesName" => $book->getLanguages (),
62
+                        "authorsName" => $book->getAuthorsName (),
63
+                        "tagsName" => $book->getTagsName (),
64
+                        "seriesName" => $sn,
65
+                        "seriesIndex" => $book->seriesIndex,
66
+                        "seriesCompleteName" => $scn,
67
+                        "seriesurl" => $su,
68
+                        "customcolumns_list" => $cc);
69 69
     }
70 70
 
71 71
     /**
@@ -142,45 +142,45 @@  discard block
 block discarded – undo
142 142
         $out = $in;
143 143
 
144 144
         $out ["c"] = array ("version" => VERSION, "i18n" => array (
145
-                           "coverAlt" => localize("i18n.coversection"),
146
-                           "authorsTitle" => localize("authors.title"),
147
-                           "bookwordTitle" => localize("bookword.title"),
148
-                           "tagsTitle" => localize("tags.title"),
149
-                           "seriesTitle" => localize("series.title"),
150
-                           "customizeTitle" => localize ("customize.title"),
151
-                           "aboutTitle" => localize ("about.title"),
152
-                           "previousAlt" => localize ("paging.previous.alternate"),
153
-                           "nextAlt" => localize ("paging.next.alternate"),
154
-                           "searchAlt" => localize ("search.alternate"),
155
-                           "sortAlt" => localize ("sort.alternate"),
156
-                           "homeAlt" => localize ("home.alternate"),
157
-                           "cogAlt" => localize ("cog.alternate"),
158
-                           "permalinkAlt" => localize ("permalink.alternate"),
159
-                           "publisherName" => localize("publisher.name"),
160
-                           "pubdateTitle" => localize("pubdate.title"),
161
-                           "languagesTitle" => localize("language.title"),
162
-                           "contentTitle" => localize("content.summary"),
163
-                           "filterClearAll" => localize("filter.clearall"),
164
-                           "sortorderAsc" => localize("search.sortorder.asc"),
165
-                           "sortorderDesc" => localize("search.sortorder.desc"),
166
-                           "customizeEmail" => localize("customize.email")),
167
-                       "url" => array (
168
-                           "detailUrl" => "index.php?page=13&id={0}&db={1}",
169
-                           "coverUrl" => "fetch.php?id={0}&db={1}",
170
-                           "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
171
-                       "config" => array (
172
-                           "use_fancyapps" => $config ["cops_use_fancyapps"],
173
-                           "max_item_per_page" => $config['cops_max_item_per_page'],
174
-                           "kindleHack"        => "",
175
-                           "server_side_rendering" => useServerSideRendering (),
176
-                           "html_tag_filter" => $config['cops_html_tag_filter']));
145
+                            "coverAlt" => localize("i18n.coversection"),
146
+                            "authorsTitle" => localize("authors.title"),
147
+                            "bookwordTitle" => localize("bookword.title"),
148
+                            "tagsTitle" => localize("tags.title"),
149
+                            "seriesTitle" => localize("series.title"),
150
+                            "customizeTitle" => localize ("customize.title"),
151
+                            "aboutTitle" => localize ("about.title"),
152
+                            "previousAlt" => localize ("paging.previous.alternate"),
153
+                            "nextAlt" => localize ("paging.next.alternate"),
154
+                            "searchAlt" => localize ("search.alternate"),
155
+                            "sortAlt" => localize ("sort.alternate"),
156
+                            "homeAlt" => localize ("home.alternate"),
157
+                            "cogAlt" => localize ("cog.alternate"),
158
+                            "permalinkAlt" => localize ("permalink.alternate"),
159
+                            "publisherName" => localize("publisher.name"),
160
+                            "pubdateTitle" => localize("pubdate.title"),
161
+                            "languagesTitle" => localize("language.title"),
162
+                            "contentTitle" => localize("content.summary"),
163
+                            "filterClearAll" => localize("filter.clearall"),
164
+                            "sortorderAsc" => localize("search.sortorder.asc"),
165
+                            "sortorderDesc" => localize("search.sortorder.desc"),
166
+                            "customizeEmail" => localize("customize.email")),
167
+                        "url" => array (
168
+                            "detailUrl" => "index.php?page=13&id={0}&db={1}",
169
+                            "coverUrl" => "fetch.php?id={0}&db={1}",
170
+                            "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
171
+                        "config" => array (
172
+                            "use_fancyapps" => $config ["cops_use_fancyapps"],
173
+                            "max_item_per_page" => $config['cops_max_item_per_page'],
174
+                            "kindleHack"        => "",
175
+                            "server_side_rendering" => useServerSideRendering (),
176
+                            "html_tag_filter" => $config['cops_html_tag_filter']));
177 177
         if ($config['cops_thumbnail_handling'] == "1") {
178 178
             $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
179 179
         } else if (!empty ($config['cops_thumbnail_handling'])) {
180 180
             $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
181 181
         }
182 182
         if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) {
183
-          $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"';
183
+            $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"';
184 184
         }
185 185
         return $out;
186 186
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         }
240 240
         if (!is_null (getURLParam ("complete")) || $complete) {
241 241
             $out = self::addCompleteArray ($out);
242
-       }
242
+        }
243 243
 
244 244
         $out ["containsBook"] = 0;
245 245
         if ($currentPage->containsBook ()) {
Please login to merge, or discard this patch.
lib/PageAllBooks.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
         $this->title = localize ("allbooks.title");
14 14
         if (getCurrentOption ("titles_split_first_letter") == 1) {
15 15
             $this->entryArray = Book::getAllBooks();
16
-        }
17
-        else {
16
+        } else {
18 17
             list ($this->entryArray, $this->totalNumber) = Book::getBooks ($this->n);
19 18
         }
20 19
         $this->idPage = Book::ALL_BOOKS_ID;
Please login to merge, or discard this patch.
lib/Author.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,69 +25,69 @@
 block discarded – undo
25 25
         $this->sort = $post->sort;
26 26
     }
27 27
 
28
-    public function getUri () {
29
-        return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id";
28
+    public function getUri() {
29
+        return "?page=" . parent::PAGE_AUTHOR_DETAIL . "&id=$this->id";
30 30
     }
31 31
 
32
-    public function getEntryId () {
33
-        return self::ALL_AUTHORS_ID.":".$this->id;
32
+    public function getEntryId() {
33
+        return self::ALL_AUTHORS_ID . ":" . $this->id;
34 34
     }
35 35
 
36
-    public static function getEntryIdByLetter ($startingLetter) {
37
-        return self::ALL_AUTHORS_ID.":letter:".$startingLetter;
36
+    public static function getEntryIdByLetter($startingLetter) {
37
+        return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter;
38 38
     }
39 39
 
40 40
     public static function getCount() {
41 41
         // str_format (localize("authors.alphabetical", count(array))
42
-        return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
42
+        return parent::getCountGeneric("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
43 43
     }
44 44
 
45 45
     public static function getAllAuthorsByFirstLetter() {
46
-        list (, $result) = parent::executeQuery ("select {0}
46
+        list (, $result) = parent::executeQuery("select {0}
47 47
 from authors
48 48
 group by substr (upper (sort), 1, 1)
49
-order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1);
49
+order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array(), -1);
50 50
         $entryArray = array();
51
-        while ($post = $result->fetchObject ())
51
+        while ($post = $result->fetchObject())
52 52
         {
53
-            array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
54
-                str_format (localize("authorword", $post->count), $post->count), "text",
55
-                array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count));
53
+            array_push($entryArray, new Entry($post->title, Author::getEntryIdByLetter($post->title),
54
+                str_format(localize("authorword", $post->count), $post->count), "text",
55
+                array(new LinkNavigation("?page=" . parent::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))), "", $post->count));
56 56
         }
57 57
         return $entryArray;
58 58
     }
59 59
 
60 60
     public static function getAuthorsByStartingLetter($letter) {
61
-        return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));
61
+        return self::getEntryArray(self::SQL_AUTHORS_BY_FIRST_LETTER, array($letter . "%"));
62 62
     }
63 63
 
64 64
     public static function getAuthorsForSearch($query) {
65
-        return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%"));
65
+        return self::getEntryArray(self::SQL_AUTHORS_FOR_SEARCH, array($query . "%", $query . "%"));
66 66
     }
67 67
 
68 68
     public static function getAllAuthors() {
69
-        return self::getEntryArray (self::SQL_ALL_AUTHORS, array ());
69
+        return self::getEntryArray(self::SQL_ALL_AUTHORS, array());
70 70
     }
71 71
 
72
-    public static function getEntryArray ($query, $params) {
73
-        return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author");
72
+    public static function getEntryArray($query, $params) {
73
+        return Base::getEntryArrayWithBookNumber($query, self::AUTHOR_COLUMNS, $params, "Author");
74 74
     }
75 75
 
76
-    public static function getAuthorById ($authorId) {
77
-        $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78
-        $result->execute (array ($authorId));
79
-        $post = $result->fetchObject ();
80
-        return new Author ($post);
76
+    public static function getAuthorById($authorId) {
77
+        $result = parent::getDb()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78
+        $result->execute(array($authorId));
79
+        $post = $result->fetchObject();
80
+        return new Author($post);
81 81
     }
82 82
 
83
-    public static function getAuthorByBookId ($bookId) {
84
-        $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
83
+    public static function getAuthorByBookId($bookId) {
84
+        $result = parent::getDb()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
85 85
 where author = authors.id
86 86
 and book = ?');
87
-        $result->execute (array ($bookId));
88
-        $authorArray = array ();
89
-        while ($post = $result->fetchObject ()) {
90
-            array_push ($authorArray, new Author ($post));
87
+        $result->execute(array($bookId));
88
+        $authorArray = array();
89
+        while ($post = $result->fetchObject()) {
90
+            array_push($authorArray, new Author($post));
91 91
         }
92 92
         return $authorArray;
93 93
     }
Please login to merge, or discard this patch.
Braces   +25 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,37 +19,42 @@  discard block
 block discarded – undo
19 19
     public $name;
20 20
     public $sort;
21 21
 
22
-    public function __construct($post) {
22
+    public function __construct($post)
23
+    {
23 24
         $this->id = $post->id;
24 25
         $this->name = str_replace("|", ",", $post->name);
25 26
         $this->sort = $post->sort;
26 27
     }
27 28
 
28
-    public function getUri () {
29
+    public function getUri ()
30
+    {
29 31
         return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id";
30 32
     }
31 33
 
32
-    public function getEntryId () {
34
+    public function getEntryId ()
35
+    {
33 36
         return self::ALL_AUTHORS_ID.":".$this->id;
34 37
     }
35 38
 
36
-    public static function getEntryIdByLetter ($startingLetter) {
39
+    public static function getEntryIdByLetter ($startingLetter)
40
+    {
37 41
         return self::ALL_AUTHORS_ID.":letter:".$startingLetter;
38 42
     }
39 43
 
40
-    public static function getCount() {
44
+    public static function getCount()
45
+    {
41 46
         // str_format (localize("authors.alphabetical", count(array))
42 47
         return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
43 48
     }
44 49
 
45
-    public static function getAllAuthorsByFirstLetter() {
50
+    public static function getAllAuthorsByFirstLetter()
51
+    {
46 52
         list (, $result) = parent::executeQuery ("select {0}
47 53
 from authors
48 54
 group by substr (upper (sort), 1, 1)
49 55
 order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1);
50 56
         $entryArray = array();
51
-        while ($post = $result->fetchObject ())
52
-        {
57
+        while ($post = $result->fetchObject ()) {
53 58
             array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
54 59
                 str_format (localize("authorword", $post->count), $post->count), "text",
55 60
                 array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count));
@@ -57,30 +62,36 @@  discard block
 block discarded – undo
57 62
         return $entryArray;
58 63
     }
59 64
 
60
-    public static function getAuthorsByStartingLetter($letter) {
65
+    public static function getAuthorsByStartingLetter($letter)
66
+    {
61 67
         return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));
62 68
     }
63 69
 
64
-    public static function getAuthorsForSearch($query) {
70
+    public static function getAuthorsForSearch($query)
71
+    {
65 72
         return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%"));
66 73
     }
67 74
 
68
-    public static function getAllAuthors() {
75
+    public static function getAllAuthors()
76
+    {
69 77
         return self::getEntryArray (self::SQL_ALL_AUTHORS, array ());
70 78
     }
71 79
 
72
-    public static function getEntryArray ($query, $params) {
80
+    public static function getEntryArray ($query, $params)
81
+    {
73 82
         return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author");
74 83
     }
75 84
 
76
-    public static function getAuthorById ($authorId) {
85
+    public static function getAuthorById ($authorId)
86
+    {
77 87
         $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?');
78 88
         $result->execute (array ($authorId));
79 89
         $post = $result->fetchObject ();
80 90
         return new Author ($post);
81 91
     }
82 92
 
83
-    public static function getAuthorByBookId ($bookId) {
93
+    public static function getAuthorByBookId ($bookId)
94
+    {
84 95
         $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
85 96
 where author = authors.id
86 97
 and book = ?');
Please login to merge, or discard this patch.
lib/Rating.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     const ALL_RATING_ID = "cops:rating";
12 12
 
13 13
     const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count";
14
-    const SQL_ALL_RATINGS ="select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating";
14
+    const SQL_ALL_RATINGS = "select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating";
15 15
     public $id;
16 16
     public $name;
17 17
 
@@ -20,41 +20,41 @@  discard block
 block discarded – undo
20 20
         $this->name = $pname;
21 21
     }
22 22
 
23
-    public function getUri () {
24
-        return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id";
23
+    public function getUri() {
24
+        return "?page=" . parent::PAGE_RATING_DETAIL . "&id=$this->id";
25 25
     }
26 26
 
27
-    public function getEntryId () {
28
-        return self::ALL_RATING_ID.":".$this->id;
27
+    public function getEntryId() {
28
+        return self::ALL_RATING_ID . ":" . $this->id;
29 29
     }
30 30
 
31 31
     public static function getCount() {
32 32
         // str_format (localize("ratings", count(array))
33
-        return parent::getCountGeneric ("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings");
33
+        return parent::getCountGeneric("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings");
34 34
     }
35 35
 
36 36
     public static function getAllRatings() {
37
-        return self::getEntryArray (self::SQL_ALL_RATINGS, array ());
37
+        return self::getEntryArray(self::SQL_ALL_RATINGS, array());
38 38
     }
39 39
 
40
-    public static function getEntryArray ($query, $params) {
41
-        list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1);
40
+    public static function getEntryArray($query, $params) {
41
+        list (, $result) = parent::executeQuery($query, self::RATING_COLUMNS, "", $params, -1);
42 42
         $entryArray = array();
43
-        while ($post = $result->fetchObject ())
43
+        while ($post = $result->fetchObject())
44 44
         {
45
-            $ratingObj = new Rating ($post->id, $post->rating);
46
-            $rating=$post->rating/2;
47
-            $rating = str_format (localize("ratingword", $rating), $rating);
48
-            array_push ($entryArray, new Entry ($rating, $ratingObj->getEntryId (),
49
-                str_format (localize("bookword", $post->count), $post->count), "text",
50
-                array ( new LinkNavigation ($ratingObj->getUri ())), "", $post->count));
45
+            $ratingObj = new Rating($post->id, $post->rating);
46
+            $rating = $post->rating / 2;
47
+            $rating = str_format(localize("ratingword", $rating), $rating);
48
+            array_push($entryArray, new Entry($rating, $ratingObj->getEntryId(),
49
+                str_format(localize("bookword", $post->count), $post->count), "text",
50
+                array(new LinkNavigation($ratingObj->getUri())), "", $post->count));
51 51
         }
52 52
         return $entryArray;
53 53
     }
54 54
 
55
-    public static function getRatingById ($ratingId) {
56
-        $result = parent::getDb ()->prepare('select rating from ratings where id = ?');
57
-        $result->execute (array ($ratingId));
58
-        return new Rating ($ratingId, $result->fetchColumn ());
55
+    public static function getRatingById($ratingId) {
56
+        $result = parent::getDb()->prepare('select rating from ratings where id = ?');
57
+        $result->execute(array($ratingId));
58
+        return new Rating($ratingId, $result->fetchColumn());
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,33 +15,38 @@  discard block
 block discarded – undo
15 15
     public $id;
16 16
     public $name;
17 17
 
18
-    public function __construct($pid, $pname) {
18
+    public function __construct($pid, $pname)
19
+    {
19 20
         $this->id = $pid;
20 21
         $this->name = $pname;
21 22
     }
22 23
 
23
-    public function getUri () {
24
+    public function getUri ()
25
+    {
24 26
         return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id";
25 27
     }
26 28
 
27
-    public function getEntryId () {
29
+    public function getEntryId ()
30
+    {
28 31
         return self::ALL_RATING_ID.":".$this->id;
29 32
     }
30 33
 
31
-    public static function getCount() {
34
+    public static function getCount()
35
+    {
32 36
         // str_format (localize("ratings", count(array))
33 37
         return parent::getCountGeneric ("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings");
34 38
     }
35 39
 
36
-    public static function getAllRatings() {
40
+    public static function getAllRatings()
41
+    {
37 42
         return self::getEntryArray (self::SQL_ALL_RATINGS, array ());
38 43
     }
39 44
 
40
-    public static function getEntryArray ($query, $params) {
45
+    public static function getEntryArray ($query, $params)
46
+    {
41 47
         list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1);
42 48
         $entryArray = array();
43
-        while ($post = $result->fetchObject ())
44
-        {
49
+        while ($post = $result->fetchObject ()) {
45 50
             $ratingObj = new Rating ($post->id, $post->rating);
46 51
             $rating=$post->rating/2;
47 52
             $rating = str_format (localize("ratingword", $rating), $rating);
@@ -52,7 +57,8 @@  discard block
 block discarded – undo
52 57
         return $entryArray;
53 58
     }
54 59
 
55
-    public static function getRatingById ($ratingId) {
60
+    public static function getRatingById ($ratingId)
61
+    {
56 62
         $result = parent::getDb ()->prepare('select rating from ratings where id = ?');
57 63
         $result->execute (array ($ratingId));
58 64
         return new Rating ($ratingId, $result->fetchColumn ());
Please login to merge, or discard this patch.
lib/Publisher.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,45 +22,45 @@
 block discarded – undo
22 22
         $this->name = $post->name;
23 23
     }
24 24
 
25
-    public function getUri () {
26
-        return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id";
25
+    public function getUri() {
26
+        return "?page=" . parent::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 parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
35
+        return parent::getCountGeneric("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
36 36
     }
37 37
 
38
-    public static function getPublisherByBookId ($bookId) {
39
-        $result = parent::getDb ()->prepare('select publishers.id as id, name
38
+    public static function getPublisherByBookId($bookId) {
39
+        $result = parent::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 = parent::getDb ()->prepare('select id, name
49
+    public static function getPublisherById($publisherId) {
50
+        $result = parent::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
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,25 +17,30 @@  discard block
 block discarded – undo
17 17
     public $id;
18 18
     public $name;
19 19
 
20
-    public function __construct($post) {
20
+    public function __construct($post)
21
+    {
21 22
         $this->id = $post->id;
22 23
         $this->name = $post->name;
23 24
     }
24 25
 
25
-    public function getUri () {
26
+    public function getUri ()
27
+    {
26 28
         return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id";
27 29
     }
28 30
 
29
-    public function getEntryId () {
31
+    public function getEntryId ()
32
+    {
30 33
         return self::ALL_PUBLISHERS_ID.":".$this->id;
31 34
     }
32 35
 
33
-    public static function getCount() {
36
+    public static function getCount()
37
+    {
34 38
         // str_format (localize("publishers.alphabetical", count(array))
35 39
         return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
36 40
     }
37 41
 
38
-    public static function getPublisherByBookId ($bookId) {
42
+    public static function getPublisherByBookId ($bookId)
43
+    {
39 44
         $result = parent::getDb ()->prepare('select publishers.id as id, name
40 45
 from books_publishers_link, publishers
41 46
 where publishers.id = publisher and book = ?');
@@ -46,7 +51,8 @@  discard block
 block discarded – undo
46 51
         return NULL;
47 52
     }
48 53
 
49
-    public static function getPublisherById ($publisherId) {
54
+    public static function getPublisherById ($publisherId)
55
+    {
50 56
         $result = parent::getDb ()->prepare('select id, name
51 57
 from publishers where id = ?');
52 58
         $result->execute (array ($publisherId));
@@ -56,11 +62,13 @@  discard block
 block discarded – undo
56 62
         return NULL;
57 63
     }
58 64
 
59
-    public static function getAllPublishers() {
65
+    public static function getAllPublishers()
66
+    {
60 67
         return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher");
61 68
     }
62 69
 
63
-    public static function getAllPublishersByQuery($query) {
70
+    public static function getAllPublishersByQuery($query)
71
+    {
64 72
         return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher");
65 73
     }
66 74
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         if ($post = $result->fetchObject ()) {
44 44
             return new Publisher ($post);
45 45
         }
46
-        return NULL;
46
+        return null;
47 47
     }
48 48
 
49 49
     public static function getPublisherById ($publisherId) {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         if ($post = $result->fetchObject ()) {
54 54
             return new Publisher ($post);
55 55
         }
56
-        return NULL;
56
+        return null;
57 57
     }
58 58
 
59 59
     public static function getAllPublishers() {
Please login to merge, or discard this patch.
lib/PagePublisherDetail.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 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
 }
Please login to merge, or discard this patch.
lib/PageAllRating.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class PageAllRating extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13 13
         $this->title = localize("ratings.title");
14 14
         $this->entryArray = Rating::getAllRatings();
Please login to merge, or discard this patch.