Test Setup Failed
Pull Request — master (#424)
by
unknown
50:02
created
lib/PageQueryResult.php 1 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 = trim($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.
lib/PageAllAuthors.php 1 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("authors.title");
14 14
         if (getCurrentOption ("author_split_first_letter") == 1) {
15 15
             $this->entryArray = Author::getAllAuthorsByFirstLetter();
16
-        }
17
-        else {
16
+        } else {
18 17
             $this->entryArray = Author::getAllAuthors();
19 18
         }
20 19
         $this->idPage = Author::ALL_AUTHORS_ID;
Please login to merge, or discard this patch.
lib/LinkFacet.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@
 block discarded – undo
8 8
 
9 9
 class LinkFacet extends Link
10 10
 {
11
-    public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) {
11
+    public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE)
12
+    {
12 13
         parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet);
13
-        if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
14
+        if (!is_null (GetUrlParam (DB))) {
15
+            $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
16
+        }
14 17
         $this->href = parent::getScriptName() . $this->href;
15 18
     }
16 19
 }
Please login to merge, or discard this patch.
lib/OPDS_renderer.php 1 patch
Braces   +32 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,14 +13,16 @@  discard block
 block discarded – undo
13 13
     private $xmlStream = NULL;
14 14
     private $updated = NULL;
15 15
 
16
-    private function getUpdatedTime () {
16
+    private function getUpdatedTime ()
17
+    {
17 18
         if (is_null ($this->updated)) {
18 19
             $this->updated = time();
19 20
         }
20 21
         return date (DATE_ATOM, $this->updated);
21 22
     }
22 23
 
23
-    private function getXmlStream () {
24
+    private function getXmlStream ()
25
+    {
24 26
         if (is_null ($this->xmlStream)) {
25 27
             $this->xmlStream = new XMLWriter();
26 28
             $this->xmlStream->openMemory();
@@ -29,7 +31,8 @@  discard block
 block discarded – undo
29 31
         return $this->xmlStream;
30 32
     }
31 33
 
32
-    public function getOpenSearch () {
34
+    public function getOpenSearch ()
35
+    {
33 36
         global $config;
34 37
         $xml = new XMLWriter ();
35 38
         $xml->openMemory ();
@@ -58,7 +61,9 @@  discard block
 block discarded – undo
58 61
                 $xml->startElement ("Url");
59 62
                     $xml->writeAttribute ("type", 'application/atom+xml');
60 63
                     $urlparam = "?query={searchTerms}";
61
-                    if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
64
+                    if (!is_null (GetUrlParam (DB))) {
65
+                        $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
66
+                    }
62 67
                     $urlparam = str_replace ("%7B", "{", $urlparam);
63 68
                     $urlparam = str_replace ("%7D", "}", $urlparam);
64 69
                     $xml->writeAttribute ("template", $config['cops_full_url'] . 'feed.php' . $urlparam);
@@ -72,7 +77,8 @@  discard block
 block discarded – undo
72 77
         return $xml->outputMemory(true);
73 78
     }
74 79
 
75
-    private function startXmlDocument ($page) {
80
+    private function startXmlDocument ($page)
81
+    {
76 82
         global $config;
77 83
         self::getXmlStream ()->startDocument('1.0','UTF-8');
78 84
         self::getXmlStream ()->startElement ("feed");
@@ -84,21 +90,19 @@  discard block
 block discarded – undo
84 90
             self::getXmlStream ()->startElement ("title");
85 91
                 self::getXmlStream ()->text ($page->title);
86 92
             self::getXmlStream ()->endElement ();
87
-            if ($page->subtitle != "")
88
-            {
93
+            if ($page->subtitle != "") {
89 94
                 self::getXmlStream ()->startElement ("subtitle");
90 95
                     self::getXmlStream ()->text ($page->subtitle);
91 96
                 self::getXmlStream ()->endElement ();
92 97
             }
93 98
             self::getXmlStream ()->startElement ("id");
94
-                if ($page->idPage)
95
-                {
99
+                if ($page->idPage) {
96 100
                     $idPage = $page->idPage;
97
-                    if (!is_null (GetUrlParam (DB))) $idPage = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $idPage);
101
+                    if (!is_null (GetUrlParam (DB))) {
102
+                        $idPage = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $idPage);
103
+                    }
98 104
                     self::getXmlStream ()->text ($idPage);
99
-                }
100
-                else
101
-                {
105
+                } else {
102 106
                     self::getXmlStream ()->text ($_SERVER['REQUEST_URI']);
103 107
                 }
104 108
             self::getXmlStream ()->endElement ();
@@ -124,14 +128,14 @@  discard block
 block discarded – undo
124 128
             $link = new LinkNavigation ("?" . getQueryString (), "self");
125 129
             self::renderLink ($link);
126 130
             $urlparam = "?";
127
-            if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
131
+            if (!is_null (GetUrlParam (DB))) {
132
+                $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
133
+            }
128 134
             if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader|FBReader)/", $_SERVER['HTTP_USER_AGENT'])) {
129 135
                 // Good and compliant way of handling search
130 136
                 $urlparam = addURLParameter ($urlparam, "page", Base::PAGE_OPENSEARCH);
131 137
                 $link = new Link ("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here");
132
-            }
133
-            else
134
-            {
138
+            } else {
135 139
                 // Bad way, will be removed when OPDS client are fixed
136 140
                 $urlparam = addURLParameter ($urlparam, "query", "{searchTerms}");
137 141
                 $urlparam = str_replace ("%7B", "{", $urlparam);
@@ -148,13 +152,15 @@  discard block
 block discarded – undo
148 152
             }
149 153
     }
150 154
 
151
-    private function endXmlDocument () {
155
+    private function endXmlDocument ()
156
+    {
152 157
         self::getXmlStream ()->endElement ();
153 158
         self::getXmlStream ()->endDocument ();
154 159
         return self::getXmlStream ()->outputMemory(true);
155 160
     }
156 161
 
157
-    private function renderLink ($link) {
162
+    private function renderLink ($link)
163
+    {
158 164
         self::getXmlStream ()->startElement ("link");
159 165
             self::getXmlStream ()->writeAttribute ("href", $link->href);
160 166
             self::getXmlStream ()->writeAttribute ("type", $link->type);
@@ -173,7 +179,8 @@  discard block
 block discarded – undo
173 179
         self::getXmlStream ()->endElement ();
174 180
     }
175 181
 
176
-    private function getPublicationDate($book) {
182
+    private function getPublicationDate($book)
183
+    {
177 184
         $dateYmd = substr($book->pubdate, 0, 10);
178 185
         $pubdate = \DateTime::createFromFormat('Y-m-d', $dateYmd);
179 186
         if ($pubdate === false ||
@@ -184,7 +191,8 @@  discard block
 block discarded – undo
184 191
         return $pubdate->format("Y-m-d");
185 192
     }
186 193
 
187
-    private function renderEntry ($entry) {
194
+    private function renderEntry ($entry)
195
+    {
188 196
         self::getXmlStream ()->startElement ("title");
189 197
             self::getXmlStream ()->text ($entry->title);
190 198
         self::getXmlStream ()->endElement ();
@@ -244,11 +252,11 @@  discard block
 block discarded – undo
244 252
 
245 253
     }
246 254
 
247
-    public function render ($page) {
255
+    public function render ($page)
256
+    {
248 257
         global $config;
249 258
         self::startXmlDocument ($page);
250
-        if ($page->isPaginated ())
251
-        {
259
+        if ($page->isPaginated ()) {
252 260
             self::getXmlStream ()->startElement ("opensearch:totalResults");
253 261
                 self::getXmlStream ()->text ($page->totalNumber);
254 262
             self::getXmlStream ()->endElement ();
Please login to merge, or discard this patch.
lib/PageCustomize.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 class PageCustomize extends Page
10 10
 {
11
-    private function isChecked ($key, $testedValue = 1) {
11
+    private function isChecked ($key, $testedValue = 1)
12
+    {
12 13
         $value = getCurrentOption ($key);
13 14
         if (is_array ($value)) {
14 15
             if (in_array ($testedValue, $value)) {
@@ -22,14 +23,16 @@  discard block
 block discarded – undo
22 23
         return "";
23 24
     }
24 25
 
25
-    private function isSelected ($key, $value) {
26
+    private function isSelected ($key, $value)
27
+    {
26 28
         if (getCurrentOption ($key) == $value) {
27 29
             return "selected='selected'";
28 30
         }
29 31
         return "";
30 32
     }
31 33
 
32
-    private function getStyleList () {
34
+    private function getStyleList ()
35
+    {
33 36
         $result = array ();
34 37
         foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) {
35 38
             if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) {
Please login to merge, or discard this patch.
lib/EntryBook.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,28 +19,33 @@
 block discarded – undo
19 19
      * @param array $plinkArray
20 20
      * @param Book $pbook
21 21
      */
22
-    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
22
+    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook)
23
+    {
23 24
         parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
24 25
         $this->book = $pbook;
25 26
         $this->localUpdated = $pbook->timestamp;
26 27
     }
27 28
 
28
-    public function getCoverThumbnail () {
29
+    public function getCoverThumbnail ()
30
+    {
29 31
         foreach ($this->linkArray as $link) {
30 32
             /* @var $link LinkNavigation */
31 33
 
32
-            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
33
-                return $link->hrefXhtml ();
34
+            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) {
35
+                            return $link->hrefXhtml ();
36
+            }
34 37
         }
35 38
         return null;
36 39
     }
37 40
 
38
-    public function getCover () {
41
+    public function getCover ()
42
+    {
39 43
         foreach ($this->linkArray as $link) {
40 44
             /* @var $link LinkNavigation */
41 45
 
42
-            if ($link->rel == Link::OPDS_IMAGE_TYPE)
43
-                return $link->hrefXhtml ();
46
+            if ($link->rel == Link::OPDS_IMAGE_TYPE) {
47
+                            return $link->hrefXhtml ();
48
+            }
44 49
         }
45 50
         return null;
46 51
     }
Please login to merge, or discard this patch.
lib/CustomColumnTypeText.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         $result = $this->getDb()->query($query);
69 69
         $entryArray = array();
70
-        while ($post = $result->fetchObject())
71
-        {
70
+        while ($post = $result->fetchObject()) {
72 71
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
73 72
             $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
74 73
 
@@ -82,7 +81,9 @@  discard block
 block discarded – undo
82 81
     public function getDescription()
83 82
     {
84 83
         $desc = $this->getDatabaseDescription();
85
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
84
+        if ($desc === NULL || empty($desc)) {
85
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
86
+        }
86 87
         return $desc;
87 88
     }
88 89
 
Please login to merge, or discard this patch.
lib/Link.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
     public $facetGroup;
22 22
     public $activeFacet;
23 23
 
24
-    public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) {
24
+    public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE)
25
+    {
25 26
         $this->href = $phref;
26 27
         $this->type = $ptype;
27 28
         $this->rel = $prel;
@@ -30,11 +31,13 @@  discard block
 block discarded – undo
30 31
         $this->activeFacet = $pactiveFacet;
31 32
     }
32 33
 
33
-    public function hrefXhtml () {
34
+    public function hrefXhtml ()
35
+    {
34 36
         return $this->href;
35 37
     }
36 38
 
37
-    public function getScriptName() {
39
+    public function getScriptName()
40
+    {
38 41
         $parts = explode('/', $_SERVER["SCRIPT_NAME"]);
39 42
         return $parts[count($parts) - 1];
40 43
     }
Please login to merge, or discard this patch.
lib/Page.php 1 patch
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -78,7 +78,8 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }
80 80
 
81
-    public function __construct($pid, $pquery, $pn) {
81
+    public function __construct($pid, $pquery, $pn)
82
+    {
82 83
         global $config;
83 84
 
84 85
         $this->idGet = $pid;
@@ -111,23 +112,33 @@  discard block
 block discarded – undo
111 112
             }
112 113
             if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) {
113 114
                 $series = Serie::getCount();
114
-                if (!is_null ($series)) array_push ($this->entryArray, $series);
115
+                if (!is_null ($series)) {
116
+                    array_push ($this->entryArray, $series);
117
+                }
115 118
             }
116 119
             if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) {
117 120
                 $publisher = Publisher::getCount();
118
-                if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
121
+                if (!is_null ($publisher)) {
122
+                    array_push ($this->entryArray, $publisher);
123
+                }
119 124
             }
120 125
             if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) {
121 126
                 $tags = Tag::getCount();
122
-                if (!is_null ($tags)) array_push ($this->entryArray, $tags);
127
+                if (!is_null ($tags)) {
128
+                    array_push ($this->entryArray, $tags);
129
+                }
123 130
             }
124 131
             if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) {
125 132
                 $rating = Rating::getCount();
126
-                if (!is_null ($rating)) array_push ($this->entryArray, $rating);
133
+                if (!is_null ($rating)) {
134
+                    array_push ($this->entryArray, $rating);
135
+                }
127 136
             }
128 137
             if (!in_array ("language", getCurrentOption ('ignored_categories'))) {
129 138
                 $languages = Language::getCount();
130
-                if (!is_null ($languages)) array_push ($this->entryArray, $languages);
139
+                if (!is_null ($languages)) {
140
+                    array_push ($this->entryArray, $languages);
141
+                }
131 142
             }
132 143
             foreach ($config['cops_calibre_custom_column'] as $lookup) {
133 144
                 $customColumn = CustomColumnType::createByLookup($lookup);
@@ -137,7 +148,9 @@  discard block
 block discarded – undo
137 148
             }
138 149
             $this->entryArray = array_merge ($this->entryArray, Book::getCount());
139 150
 
140
-            if (Base::isMultipleDatabaseEnabled ()) $this->title =  Base::getDbName ();
151
+            if (Base::isMultipleDatabaseEnabled ()) {
152
+                $this->title =  Base::getDbName ();
153
+            }
141 154
         }
142 155
     }
143 156
 
@@ -173,8 +186,12 @@  discard block
 block discarded – undo
173 186
 
174 187
     public function containsBook ()
175 188
     {
176
-        if (count ($this->entryArray) == 0) return false;
177
-        if (get_class ($this->entryArray [0]) == "EntryBook") return true;
189
+        if (count ($this->entryArray) == 0) {
190
+            return false;
191
+        }
192
+        if (get_class ($this->entryArray [0]) == "EntryBook") {
193
+            return true;
194
+        }
178 195
         return false;
179 196
     }
180 197
 }
Please login to merge, or discard this patch.