Test Setup Failed
Push — master ( 9fbeaf...6ecf0d )
by Sébastien
03:30 queued 33s
created
transliteration.php 1 patch
Braces   +18 added lines, -30 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
  * @return
26 26
  *   Transliterated text.
27 27
  */
28
-function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) {
28
+function _transliteration_process($string, $unknown = '?', $source_langcode = NULL)
29
+{
29 30
   // ASCII is always valid NFC! If we're only ever given plain ASCII, we can
30 31
   // avoid the overhead of initializing the decomposition tables by skipping
31 32
   // out early.
@@ -41,23 +42,17 @@  discard block
 block discarded – undo
41 42
     for ($n = 0; $n < 256; $n++) {
42 43
       if ($n < 0xc0) {
43 44
         $remaining = 0;
44
-      }
45
-      elseif ($n < 0xe0) {
45
+      } elseif ($n < 0xe0) {
46 46
         $remaining = 1;
47
-      }
48
-      elseif ($n < 0xf0) {
47
+      } elseif ($n < 0xf0) {
49 48
         $remaining = 2;
50
-      }
51
-      elseif ($n < 0xf8) {
49
+      } elseif ($n < 0xf8) {
52 50
         $remaining = 3;
53
-      }
54
-      elseif ($n < 0xfc) {
51
+      } elseif ($n < 0xfc) {
55 52
         $remaining = 4;
56
-      }
57
-      elseif ($n < 0xfe) {
53
+      } elseif ($n < 0xfe) {
58 54
         $remaining = 5;
59
-      }
60
-      else {
55
+      } else {
61 56
         $remaining = 0;
62 57
       }
63 58
       $tail_bytes[chr($n)] = $remaining;
@@ -100,15 +95,13 @@  discard block
 block discarded – undo
100 95
           if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") {
101 96
             // Legal tail bytes are nice.
102 97
             $sequence .= $c;
103
-          }
104
-          else {
98
+          } else {
105 99
             if ($len == 0) {
106 100
               // Premature end of string! Drop a replacement character into
107 101
               // output to represent the invalid UTF-8 sequence.
108 102
               $result .= $unknown;
109 103
               break 2;
110
-            }
111
-            else {
104
+            } else {
112 105
               // Illegal tail byte; abandon the sequence.
113 106
               $result .= $unknown;
114 107
               // Back up and reprocess this byte; it may itself be a legal
@@ -123,17 +116,13 @@  discard block
 block discarded – undo
123 116
         $n = ord($head);
124 117
         if ($n <= 0xdf) {
125 118
           $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128);
126
-        }
127
-        elseif ($n <= 0xef) {
119
+        } elseif ($n <= 0xef) {
128 120
           $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128);
129
-        }
130
-        elseif ($n <= 0xf7) {
121
+        } elseif ($n <= 0xf7) {
131 122
           $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128);
132
-        }
133
-        elseif ($n <= 0xfb) {
123
+        } elseif ($n <= 0xfb) {
134 124
           $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128);
135
-        }
136
-        elseif ($n <= 0xfd) {
125
+        } elseif ($n <= 0xfd) {
137 126
           $ord = ($n - 252) * 1073741824 + (ord($sequence[1]) - 128) * 16777216 + (ord($sequence[2]) - 128) * 262144 + (ord($sequence[3]) - 128) * 4096 + (ord($sequence[4]) - 128) * 64 + (ord($sequence[5]) - 128);
138 127
         } else {
139 128
           $ord = $n;
@@ -174,7 +163,8 @@  discard block
 block discarded – undo
174 163
  * @return
175 164
  *   ASCII replacement character.
176 165
  */
177
-function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) {
166
+function _transliteration_replace($ord, $unknown = '?', $langcode = NULL)
167
+{
178 168
   static $map = array();
179 169
 
180 170
   //GL: set language later
@@ -196,12 +186,10 @@  discard block
 block discarded – undo
196 186
       if ($langcode != 'en' && isset($variant[$langcode])) {
197 187
         // Merge in language specific mappings.
198 188
         $map[$bank][$langcode] = $variant[$langcode] + $base;
199
-      }
200
-      else {
189
+      } else {
201 190
         $map[$bank][$langcode] = $base;
202 191
       }
203
-    }
204
-    else {
192
+    } else {
205 193
       $map[$bank][$langcode] = array();
206 194
     }
207 195
   }
Please login to merge, or discard this patch.
lib/CustomColumnTypeInteger.php 1 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/CustomColumnType.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -181,8 +181,9 @@  discard block
 block discarded – undo
181 181
     public static function createByCustomID($customId)
182 182
     {
183 183
         // Reuse already created CustomColumns for performance
184
-        if (array_key_exists($customId, self::$customColumnCacheID))
185
-            return self::$customColumnCacheID[$customId];
184
+        if (array_key_exists($customId, self::$customColumnCacheID)) {
185
+                    return self::$customColumnCacheID[$customId];
186
+        }
186 187
 
187 188
         $datatype = self::getDatatypeByCustomID($customId);
188 189
 
@@ -221,8 +222,9 @@  discard block
 block discarded – undo
221 222
     public static function createByLookup($lookup)
222 223
     {
223 224
         // Reuse already created CustomColumns for performance
224
-        if (array_key_exists($lookup, self::$customColumnCacheLookup))
225
-            return self::$customColumnCacheLookup[$lookup];
225
+        if (array_key_exists($lookup, self::$customColumnCacheLookup)) {
226
+                    return self::$customColumnCacheLookup[$lookup];
227
+        }
226 228
 
227 229
         $result = parent::getDb()->prepare('SELECT id FROM custom_columns WHERE label = ?');
228 230
         $result->execute(array($lookup));
@@ -241,8 +243,9 @@  discard block
 block discarded – undo
241 243
     public function getAllCustomValues()
242 244
     {
243 245
         // lazy loading
244
-        if ($this->customValues == NULL)
245
-            $this->customValues = $this->getAllCustomValuesFromDatabase();
246
+        if ($this->customValues == NULL) {
247
+                    $this->customValues = $this->getAllCustomValuesFromDatabase();
248
+        }
246 249
 
247 250
         return $this->customValues;
248 251
     }
Please login to merge, or discard this patch.
lib/Serie.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,25 +16,30 @@  discard block
 block discarded – undo
16 16
     public $id;
17 17
     public $name;
18 18
 
19
-    public function __construct($post) {
19
+    public function __construct($post)
20
+    {
20 21
         $this->id = $post->id;
21 22
         $this->name = $post->name;
22 23
     }
23 24
 
24
-    public function getUri () {
25
+    public function getUri ()
26
+    {
25 27
         return "?page=".parent::PAGE_SERIE_DETAIL."&id=$this->id";
26 28
     }
27 29
 
28
-    public function getEntryId () {
30
+    public function getEntryId ()
31
+    {
29 32
         return self::ALL_SERIES_ID.":".$this->id;
30 33
     }
31 34
 
32
-    public static function getCount() {
35
+    public static function getCount()
36
+    {
33 37
         // str_format (localize("series.alphabetical", count(array))
34 38
         return parent::getCountGeneric ("series", self::ALL_SERIES_ID, parent::PAGE_ALL_SERIES);
35 39
     }
36 40
 
37
-    public static function getSerieByBookId ($bookId) {
41
+    public static function getSerieByBookId ($bookId)
42
+    {
38 43
         $result = parent::getDb ()->prepare('select  series.id as id, name
39 44
 from books_series_link, series
40 45
 where series.id = series and book = ?');
@@ -45,7 +50,8 @@  discard block
 block discarded – undo
45 50
         return NULL;
46 51
     }
47 52
 
48
-    public static function getSerieById ($serieId) {
53
+    public static function getSerieById ($serieId)
54
+    {
49 55
         $result = parent::getDb ()->prepare('select id, name  from series where id = ?');
50 56
         $result->execute (array ($serieId));
51 57
         if ($post = $result->fetchObject ()) {
@@ -54,11 +60,13 @@  discard block
 block discarded – undo
54 60
         return NULL;
55 61
     }
56 62
 
57
-    public static function getAllSeries() {
63
+    public static function getAllSeries()
64
+    {
58 65
         return Base::getEntryArrayWithBookNumber (self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array (), "Serie");
59 66
     }
60 67
 
61
-    public static function getAllSeriesByQuery($query) {
68
+    public static function getAllSeriesByQuery($query)
69
+    {
62 70
         return Base::getEntryArrayWithBookNumber (self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array ('%' . $query . '%'), "Serie");
63 71
     }
64 72
 }
Please login to merge, or discard this patch.
lib/Language.php 1 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.
lib/JSON_renderer.php 1 patch
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.
lib/PageAllBooks.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 ("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 1 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 1 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.