Passed
Push — master ( a30c11...cbe31f )
by
unknown
05:50
created
tests/Bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     define('OPTION_MAPIT_URL', 'https://mapit.mysociety.org/');
28 28
 
29 29
     // If there isn't a config file (most likely this is running an automated test) copy one in.
30
-    if (! file_exists(dirname(__FILE__) . '/../conf/general')) {
30
+    if (!file_exists(dirname(__FILE__) . '/../conf/general')) {
31 31
         copy(dirname(__FILE__) . '/../conf/general-example', dirname(__FILE__) . '/../conf/general');
32 32
     }
33 33
 
Please login to merge, or discard this patch.
www/includes/easyparliament/init.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 // These variables are so we can keep date/time formats consistent across the site
18 18
 // and change them easily.
19 19
 // Formats here: http://www.php.net/manual/en/function.date.php
20
-define("LONGERDATEFORMAT", "%A, %e %B %Y");// Monday, 31 December 2003
21
-define("LONGDATEFORMAT", "%e %B %Y"); 	// 31 December 2003
22
-define("SHORTDATEFORMAT", "%e %b %Y");	// 31 Dec 2003
23
-define("TIMEFORMAT", "%l:%M %p");	// 11:59 pm
20
+define("LONGERDATEFORMAT", "%A, %e %B %Y"); // Monday, 31 December 2003
21
+define("LONGDATEFORMAT", "%e %B %Y"); // 31 December 2003
22
+define("SHORTDATEFORMAT", "%e %b %Y"); // 31 Dec 2003
23
+define("TIMEFORMAT", "%l:%M %p"); // 11:59 pm
24 24
 
25 25
 define("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003
26 26
 define("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 textdomain('TheyWorkForYou');
53 53
 
54 54
 // Set the default timezone
55
-if(function_exists('date_default_timezone_set')) {
55
+if (function_exists('date_default_timezone_set')) {
56 56
     date_default_timezone_set(TIMEZONE);
57 57
 }
58 58
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 include_once(INCLUDESPATH . "easyparliament/user.php");
106 106
 
107 107
 // Test to see if this is a new-style template using the renderer class.
108
-if (! isset($new_style_template) or $new_style_template !== true) {
108
+if (!isset($new_style_template) or $new_style_template !== true) {
109 109
 
110 110
     // This is an old-style page. Use the old page classes.
111 111
     include_once(INCLUDESPATH . "easyparliament/page.php");
Please login to merge, or discard this patch.
www/includes/easyparliament/commentlist.php 2 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -548,11 +548,11 @@
 block discarded – undo
548 548
         }
549 549
         if ($limit != '') {
550 550
             # Can't use parameter as >1 argument
551
-            $limit = "LIMIT $limit";
551
+            $limit = "limit $limit";
552 552
         }
553 553
 
554 554
         // Finally, do the query!
555
-        $q = $this->db->query("SELECT $fields
555
+        $q = $this->db->query("select $fields
556 556
                         FROM 	comments
557 557
                         $join
558 558
                         WHERE $where
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         }
103 103
 
104 104
         // For getting the data.
105
-        $input =  [
105
+        $input = [
106 106
             'amount' =>  [
107 107
                 'user' => true,
108 108
             ],
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 // This does rely on both this and the previous query returning
239 239
                 // stuff in the same order...
240 240
                 foreach ($comments as $n => $commentdata) {
241
-                    $comments[$n]['body'] = $commentbodies[ $comments[$n]['comment_id'] ];
241
+                    $comments[$n]['body'] = $commentbodies[$comments[$n]['comment_id']];
242 242
                 }
243 243
             }
244 244
         }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         if (isset($args['pid']) && is_numeric($args['pid'])) {
284 284
             $where['person_id='] = $args['pid'];
285 285
         }
286
-        $input =  [
286
+        $input = [
287 287
             'amount' =>  [
288 288
                 'user' => true,
289 289
             ],
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             'date(posted)>=' => $args['start_date'],
324 324
             'date(posted)<=' => $args['end_date'],
325 325
         ];
326
-        $input =  [
326
+        $input = [
327 327
             'amount' =>  [
328 328
                 'user' => true,
329 329
             ],
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
         $limit = $num * ($page - 1) . ',' . $num;
359 359
 
360
-        $input =  [
360
+        $input = [
361 361
             'amount' =>  [
362 362
                 'user' => true,
363 363
             ],
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         // It returns the URL for the comment.
389 389
 
390 390
         $major 		= $urldata['major'];
391
-        $gid 		= $urldata['gid'];
391
+        $gid = $urldata['gid'];
392 392
         $comment_id = $urldata['comment_id'];
393 393
         $user_id = $urldata['user_id'] ?? false;
394 394
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         $URL = new \MySociety\TheyWorkForYou\Url($page);
403 403
 
404 404
         $gid = fix_gid_from_db($gid); // In includes/utility.php
405
-        $URL->insert(['id' => $gid ]);
405
+        $URL->insert(['id' => $gid]);
406 406
         if ($user_id) {
407 407
             $URL->insert(['u' => $user_id]);
408 408
         }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         $limit = $input['limit'] ?? '';
481 481
 
482 482
         // The fields to fetch from db. 'table' => array ('field1', 'field2').
483
-        $fieldsarr =  [
483
+        $fieldsarr = [
484 484
             'comments' =>  ['comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'],
485 485
             'hansard' =>  ['major', 'gid'],
486 486
         ];
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
         // Add on the stuff for getting a user's details.
495 495
         if (isset($amount['user']) && $amount['user'] == true) {
496
-            $fieldsarr['users'] =  ['firstname', 'lastname', 'user_id'];
496
+            $fieldsarr['users'] = ['firstname', 'lastname', 'user_id'];
497 497
             // Like doing "FROM comments, users" but it's easier to add
498 498
             // an "INNER JOIN..." automatically to the query.
499 499
             $join .= ' INNER JOIN users ON comments.user_id = users.user_id ';
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
             $fieldsarr['epobject'] = ['body'];
505 505
         }
506 506
 
507
-        $fieldsarr2 =  [];
507
+        $fieldsarr2 = [];
508 508
         // Construct the $fields clause.
509 509
         foreach ($fieldsarr as $table => $tablesfields) {
510 510
             foreach ($tablesfields as $n => $field) {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         $fields = implode(', ', $fieldsarr2);
522 522
 
523 523
 
524
-        $wherearr2 =  [];
524
+        $wherearr2 = [];
525 525
         $params = [];
526 526
         $i = 0;
527 527
         // Construct the $where clause.
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                         ", $params);
551 551
 
552 552
         // Format the data into an array for returning.
553
-        $data =  [];
553
+        $data = [];
554 554
 
555 555
         // If you change stuff here, you might have to change it in
556 556
         // $COMMENT->_set_url() too...
Please login to merge, or discard this patch.
www/includes/easyparliament/recess.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@  discard block
 block discarded – undo
12 12
     ],
13 13
     2001 => [
14 14
         1 => ['less' => 8],
15
-        2 => ['between' => [15,26]],
16
-        4 => ['between' => [10,23]],
15
+        2 => ['between' => [15, 26]],
16
+        4 => ['between' => [10, 23]],
17 17
         5 => ['more' => 13],
18 18
         6 => ['less' => 13],
19 19
         7 => ['more' => 20],
20 20
         8 => ['all' => 1],
21 21
         9 => ['less' => 14, 'more' => 14],
22
-        10 => ['less' => 4, 'between' => [4,8, 8,15]],
23
-        12 => ['more' => 19] ],
22
+        10 => ['less' => 4, 'between' => [4, 8, 8, 15]],
23
+        12 => ['more' => 19]],
24 24
     2002 => [
25 25
         1 => ['less' => 8],
26
-        2 => ['between' => [14,25]],
26
+        2 => ['between' => [14, 25]],
27 27
         3 => ['more' => 26],
28
-        4 => ['less' => 3, 'between' => [3,10]],
28
+        4 => ['less' => 3, 'between' => [3, 10]],
29 29
         5 => ['more' => 24],
30 30
         6 => ['less' => 10],
31 31
         7 => ['more' => 24],
32 32
         8 => ['all' => 1],
33 33
         9 => ['less' => 19, 'more' => 24],
34 34
         10 => ['less' => 14],
35
-        12 => ['more' => 19] ],
35
+        12 => ['more' => 19]],
36 36
     2003 => [
37 37
         1 => ['less' => 7],
38
-        2 => ['between' => [13,24]],
39
-        4 => ['between' => [14,28]],
38
+        2 => ['between' => [13, 24]],
39
+        4 => ['between' => [14, 28]],
40 40
         5 => ['more' => 22],
41 41
         6 => ['less' => 3],
42 42
         7 => ['more' => 17],
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
         12 => ['more' => 18]],
47 47
     2004 => [
48 48
         1 => ['less' => 5],
49
-        2 => ['between' => [12,23]],
50
-        4 => ['between' => [1,19]],
49
+        2 => ['between' => [12, 23]],
50
+        4 => ['between' => [1, 19]],
51 51
         5 => ['more' => 27],
52 52
         6 => ['less' => 7],
53 53
         7 => ['more' => 22],
54 54
         8 => ['all' => 1],
55 55
         9 => ['less' => 7, 'more' => 16],
56 56
         10 => ['less' => 11],
57
-        12 => ['more' => 21] ],
57
+        12 => ['more' => 21]],
58 58
     2005 => [
59 59
         1 => ['less' => 10],
60
-        2 => ['between' => [10,21]],
60
+        2 => ['between' => [10, 21]],
61 61
         3 => ['more' => 24],
62 62
         4 => ['less' => 4, 'more' => 10],
63 63
         5 => ['less' => 11, 'more' => 26],
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
         8 => ['all' => 1],
67 67
         9 => ['all' => 1],
68 68
         10 => ['less' => 10],
69
-        12 => ['more' => 20] ],
69
+        12 => ['more' => 20]],
70 70
     2006 => [
71 71
         1 => ['less' => 9],
72
-        2 => ['between' => [16,27]],
72
+        2 => ['between' => [16, 27]],
73 73
         3 => ['more' => 30],
74 74
         4 => ['less' => 18],
75 75
         5 => ['more' => 25],
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     ],
83 83
     2007 => [
84 84
         1 => ['less' => 8],
85
-        2 => ['between' => [8,19]],
85
+        2 => ['between' => [8, 19]],
86 86
         3 => ['more' => 29],
87 87
         4 => ['less' => 16],
88 88
         5 => ['more' => 24],
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     ],
96 96
     2008 => [
97 97
         1 => ['less' => 7],
98
-        2 => ['between' => [7,18]],
99
-        4 => ['between' => [3,21]],
98
+        2 => ['between' => [7, 18]],
99
+        4 => ['between' => [3, 21]],
100 100
         5 => ['more' => 22],
101 101
         6 => ['less' => 2],
102 102
         7 => ['more' => 22],
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
     ],
108 108
     2009 => [
109 109
         1 => ['less' => 12],
110
-        2 => ['between' => [12,23]],
111
-        4 => ['between' => [2,20]],
110
+        2 => ['between' => [12, 23]],
111
+        4 => ['between' => [2, 20]],
112 112
         5 => ['more' => 21],
113 113
         6 => ['less' => 1],
114 114
         7 => ['more' => 21],
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     ],
120 120
     2010 => [
121 121
         1 => ['less' => 5],
122
-        2 => ['between' => [10,22]],
122
+        2 => ['between' => [10, 22]],
123 123
         3 => ['more' => 30],
124 124
         4 => ['less' => 6, 'more' => 8],
125 125
         5 => ['less' => 18, 'more' => 27],
@@ -132,62 +132,62 @@  discard block
 block discarded – undo
132 132
     ],
133 133
     2011 => [
134 134
         1 => ['less' => 10],
135
-        2 => ['between' => [17,28]],
136
-        4 => ['between' => [5,26]],
135
+        2 => ['between' => [17, 28]],
136
+        4 => ['between' => [5, 26]],
137 137
         5 => ['more' => 24],
138 138
         6 => ['less' => 7],
139 139
         7 => ['more' => 19],
140 140
         8 => ['all' => 1],
141 141
         9 => ['less' => 5, 'more' => 15],
142 142
         10 => ['less' => 10],
143
-        11 => ['between' => [15,21]],
143
+        11 => ['between' => [15, 21]],
144 144
         12 => ['more' => 20],
145 145
     ],
146 146
     2012 => [
147 147
         1 => ['less' => 10],
148
-        2 => ['between' => [9,20]],
148
+        2 => ['between' => [9, 20]],
149 149
         3 => ['more' => 27],
150 150
         4 => ['less' => 16],
151 151
         5 => ['more' => 24],
152 152
         6 => ['less' => 11],
153 153
         7 => ['more' => 17],
154 154
         8 => ['all' => 1],
155
-        9 => ['less' => 3,'more' => 18],
155
+        9 => ['less' => 3, 'more' => 18],
156 156
         10 => ['less' => 15],
157
-        11 => ['between' => [13,19]],
157
+        11 => ['between' => [13, 19]],
158 158
         12 => ['more' => 20],
159 159
     ],
160 160
     2013 => [
161 161
         1 => ['less' => 7],
162
-        2 => ['between' => [14,25]],
162
+        2 => ['between' => [14, 25]],
163 163
         3 => ['more' => 26],
164 164
         4 => ['less' => 15],
165 165
         5 => ['more' => 21],
166 166
         6 => ['less' => 3],
167 167
         7 => ['more' => 18],
168 168
         8 => ['all' => 1],
169
-        9 => ['less' => 2,'more' => 13],
169
+        9 => ['less' => 2, 'more' => 13],
170 170
         10 => ['less' => 8],
171
-        11 => ['between' => [12,18]],
171
+        11 => ['between' => [12, 18]],
172 172
         12 => ['more' => 19],
173 173
     ],
174 174
     2014 => [
175 175
         1 => ['less' => 6],
176
-        2 => ['between' => [13,24]],
177
-        4 => ['between' => [10,28]],
178
-        5 => ['between' => [1,6]],
176
+        2 => ['between' => [13, 24]],
177
+        4 => ['between' => [10, 28]],
178
+        5 => ['between' => [1, 6]],
179 179
     ],
180 180
     2015 => [
181 181
         7 => ['more' => 21],
182 182
         8 => ['all' => 1],
183 183
         9 => ['less' => 7, 'more' => 17],
184 184
         10 => ['less' => 12],
185
-        11 => ['between' => [10,16]],
185
+        11 => ['between' => [10, 16]],
186 186
         12 => ['more' => 17],
187 187
     ],
188 188
     2016 => [
189 189
         1 => ['less' => 5],
190
-        2 => ['between' => [11,22]],
190
+        2 => ['between' => [11, 22]],
191 191
     ],
192 192
 ];
193 193
 # Lords differences
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
 $GLOBALS['recessdates'][101][2010][12]['more'] = 22;
200 200
 $GLOBALS['recessdates'][101][2011] = [
201 201
     1 => ['less' => 10],
202
-    2 => ['between' => [16,28]],
203
-    4 => ['between' => [6,26]],
202
+    2 => ['between' => [16, 28]],
203
+    4 => ['between' => [6, 26]],
204 204
     5 => ['more' => 25],
205 205
     6 => ['less' => 6],
206 206
     7 => ['more' => 20],
207 207
     8 => ['all' => 1],
208 208
     9 => ['less' => 5, 'more' => 15],
209 209
     10 => ['less' => 3],
210
-    11 => ['between' => [16,21]],
210
+    11 => ['between' => [16, 21]],
211 211
     12 => ['more' => 21],
212 212
 ];
213 213
 
@@ -216,74 +216,74 @@  discard block
 block discarded – undo
216 216
     1999 => [
217 217
         7 => ['more' => 2],
218 218
         8 => ['less' => 31],
219
-        10 => ['between' => [8,25]],
219
+        10 => ['between' => [8, 25]],
220 220
         12 => ['more' => 17],
221 221
     ],
222 222
     2000 => [
223 223
         1 => ['less' => 10],
224
-        4 => ['between' => [7,25]],
224
+        4 => ['between' => [7, 25]],
225 225
         7 => ['more' => 7],
226 226
         8 => ['all' => 1],
227 227
         9 => ['less' => 4],
228
-        10 => ['between' => [6,23]],
228
+        10 => ['between' => [6, 23]],
229 229
         12 => ['more' => 20],
230 230
     ],
231 231
     2001 => [
232 232
         1 => ['less' => 8],
233
-        2 => ['between' => [16,26]],
234
-        4 => ['between' => [6,23]],
233
+        2 => ['between' => [16, 26]],
234
+        4 => ['between' => [6, 23]],
235 235
         6 => ['more' => 29],
236 236
         7 => ['all' => 1],
237 237
         8 => ['all' => 1],
238 238
         9 => ['less' => 3],
239
-        10 => ['between' => [5,22]],
240
-        12 => ['more' => 21] ],
239
+        10 => ['between' => [5, 22]],
240
+        12 => ['more' => 21]],
241 241
     2002 => [
242 242
         1 => ['less' => 7],
243
-        2 => ['between' => [15,25]],
243
+        2 => ['between' => [15, 25]],
244 244
         3 => ['more' => 28],
245 245
         4 => ['less' => 15],
246 246
         7 => ['more' => 10],
247 247
         8 => ['all' => 1],
248 248
         9 => ['less' => 2],
249
-        10 => ['between' => [11,28]],
250
-        12 => ['more' => 20] ],
249
+        10 => ['between' => [11, 28]],
250
+        12 => ['more' => 20]],
251 251
     2003 => [
252 252
         1 => ['less' => 6],
253
-        4 => ['between' => [0,31]],
253
+        4 => ['between' => [0, 31]],
254 254
         5 => ['less' => 2],
255 255
         6 => ['more' => 27],
256 256
         7 => ['all' => 1],
257 257
         8 => ['all' => 1],
258
-        10 => ['between' => [10,27]],
258
+        10 => ['between' => [10, 27]],
259 259
         12 => ['more' => 19]],
260 260
     2004 => [
261 261
         1 => ['less' => 5],
262
-        2 => ['between' => [13,23]],
263
-        4 => ['between' => [2,19]],
262
+        2 => ['between' => [13, 23]],
263
+        4 => ['between' => [2, 19]],
264 264
         6 => ['more' => 25],
265 265
         7 => ['all' => 1],
266 266
         8 => ['less' => 30],
267
-        10 => ['between' => [10,23]],
268
-        12 => ['more' => 26] ],
267
+        10 => ['between' => [10, 23]],
268
+        12 => ['more' => 26]],
269 269
     2005 => [
270 270
         1 => ['less' => 8],
271
-        2 => ['between' => [11,21]],
271
+        2 => ['between' => [11, 21]],
272 272
         3 => ['more' => 24],
273 273
         4 => ['less' => 11],
274 274
         7 => ['more' => 1],
275 275
         8 => ['all' => 1],
276 276
         9 => ['less' => 5],
277
-        10 => ['between' => [7,24]],
278
-        12 => ['more' => 23] ],
277
+        10 => ['between' => [7, 24]],
278
+        12 => ['more' => 23]],
279 279
     2006 => [
280 280
         1 => ['less' => 9],
281
-        2 => ['between' => [10,20]],
281
+        2 => ['between' => [10, 20]],
282 282
         4 => ['less' => 18],
283 283
         7 => ['more' => 0],
284 284
         8 => ['all' => 1],
285 285
         9 => ['less' => 4],
286
-        10 => ['between' => [6,23]],
286
+        10 => ['between' => [6, 23]],
287 287
         12 => ['more' => 22],
288 288
     ],
289 289
     2007 => [
@@ -293,18 +293,18 @@  discard block
 block discarded – undo
293 293
         7 => ['all' => 1],
294 294
         8 => ['all' => 1],
295 295
         9 => ['less' => 3],
296
-        10 => ['between' => [5,22]],
296
+        10 => ['between' => [5, 22]],
297 297
         12 => ['more' => 21],
298 298
     ],
299 299
     2008 => [
300 300
         1 => ['less' => 5],
301
-        2 => ['between' => [8,18]],
301
+        2 => ['between' => [8, 18]],
302 302
         3 => ['more' => 28],
303 303
         4 => ['less' => 14],
304 304
         6 => ['more' => 27],
305 305
         7 => ['all' => 1],
306 306
         8 => ['all' => 1],
307
-        10 => ['between' => [10,27]],
307
+        10 => ['between' => [10, 27]],
308 308
     ],
309 309
 ];
310 310
 
Please login to merge, or discard this patch.
www/includes/easyparliament/searchengine.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         }
85 85
 
86 86
         # Force words to lower case
87
-        $this->query = preg_replace_callback('#(department|party):.+?\b#i', function ($m) {
87
+        $this->query = preg_replace_callback('#(department|party):.+?\b#i', function($m) {
88 88
             return strtolower($m[0]);
89 89
         }, $this->query);
90 90
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
                     } elseif ($value == 'lmqs') {
163 163
                         $newv = 9;
164 164
                     } elseif ($value == 'uk') {
165
-                        $newv = [1,2,3,4,6,101];
165
+                        $newv = [1, 2, 3, 4, 6, 101];
166 166
                     } elseif ($value == 'scotland') {
167
-                        $newv = [7,8];
167
+                        $newv = [7, 8];
168 168
                     } elseif ($value == 'wales') {
169 169
                         $newv = ($lang == 'cy' || LANGUAGE == 'cy') ? 11 : 10;
170 170
                     } elseif ($value == 'future') {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $qd = preg_replace('#@[0-9]+#', '', $qd); # Strip position variable
268 268
         $qd = preg_replace('#^\((.*) AND_NOT M1[01]\)$#', '$1', $qd); # Strip Welsh handling
269 269
         # Date range
270
-        $qd = preg_replace_callback('#VALUE_RANGE 1 (\d+) (\d+)#', function ($m) {
270
+        $qd = preg_replace_callback('#VALUE_RANGE 1 (\d+) (\d+)#', function($m) {
271 271
             return preg_replace("#(\d{4})(\d\d)(\d\d)#", '$3/$2/$1', $m[1])
272 272
                 . ".." . preg_replace("#(\d{4})(\d\d)(\d\d)#", '$3/$2/$1', $m[2]);
273 273
         }, $qd);
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $qd = preg_replace('#\bU(\d+)\b#', 'segment:$1', $qd);
294 294
         $qd = preg_replace('#\bC(\d+)\b#', 'column:$1', $qd);
295 295
         $qd = preg_replace('#\bQ(.*?)\b#', 'gid:$1', $qd);
296
-        $qd = preg_replace_callback('#\bP(.*?)\b#', function ($m) {
296
+        $qd = preg_replace_callback('#\bP(.*?)\b#', function($m) {
297 297
             global $parties;
298 298
             $pu = ucfirst($m[1]);
299 299
             return "party:" . ($parties[$pu] ?? $m[1]);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         } elseif (strstr($qd, 'M7 OR M8')) {
306 306
             $qd = str_replace('M7 OR M8', 'section:scotland', $qd);
307 307
         }
308
-        $qd = preg_replace_callback('#\bM(\d+)\b#', function ($m) {
308
+        $qd = preg_replace_callback('#\bM(\d+)\b#', function($m) {
309 309
             global $hansardmajors;
310 310
             $title = $hansardmajors[$m[1]]["title"] ?? $m[1];
311 311
             return sprintf(gettext("in the '%s'"), $title);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -333,15 +333,15 @@
 block discarded – undo
333 333
         foreach ($merged as $row) {
334 334
             $from_id = str_replace('uk.org.publicwhip/person/', '', $row['gid_from']);
335 335
             $to_id = str_replace('uk.org.publicwhip/person/', '', $row['gid_to']);
336
-            $qd = str_replace("(S$from_id OR S$to_id)", "S$to_id", $qd);
337
-            $qd = str_replace("S$from_id OR S$to_id", "S$to_id", $qd);
336
+            $qd = str_replace("(S$from_id OR S$to_id)", "s$to_id", $qd);
337
+            $qd = str_replace("s$from_id OR S$to_id", "s$to_id", $qd);
338 338
         }
339 339
 
340 340
         preg_match_all('#S(\d+)#', $qd, $m);
341 341
         foreach ($m[1] as $mm) {
342 342
             $member = new MEMBER(['person_id' => $mm]);
343 343
             $name = $member->full_name();
344
-            $qd = str_replace("S$mm", "speaker:$name", $qd);
344
+            $qd = str_replace("s$mm", "speaker:$name", $qd);
345 345
         }
346 346
 
347 347
         # Simplify display of excluded words
Please login to merge, or discard this patch.
www/includes/easyparliament/hansardlist.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1753,7 +1753,7 @@
 block discarded – undo
1753 1753
         }
1754 1754
 
1755 1755
         // Finally, do the query!
1756
-        $q = $this->db->query("SELECT $fields
1756
+        $q = $this->db->query("select $fields
1757 1757
                         FROM 	hansard
1758 1758
                         $join
1759 1759
                         WHERE $where
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 class HANSARDLIST {
54 54
     // This will be used to cache information about speakers on this page
55 55
     // so we don't have to keep fetching the same data from the DB.
56
-    public $speakers =  [];
56
+    public $speakers = [];
57 57
     /*
58 58
     $this->speakers[ $person_id ] = array (
59 59
         "name" => $name,
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     // This will be used to cache mappings from epobject_id to gid,
68 68
     // so we don't have to continually fetch the same data in get_hansard_data().
69
-    public $epobjectid_to_gid =  [];
69
+    public $epobjectid_to_gid = [];
70 70
     /*
71 71
     $this->epobjectid_to_gid[ $epobject_id ] => $gid;
72 72
     */
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             return false;
144 144
         }
145 145
 
146
-        $validviews =  ['calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid'];
146
+        $validviews = ['calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid'];
147 147
         if (in_array($view, $validviews)) {
148 148
 
149 149
             // What function do we call for this view?
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                 [$year, $month, $date] = explode('-', $hdate);
235 235
                 $timestamp = gmmktime(0, 0, 0, $month, $date, $year);
236 236
 
237
-                $data =  [
237
+                $data = [
238 238
                     'hdate'		=> $hdate,
239 239
                     'timestamp'	=> $timestamp,
240 240
                     'listurl'	=> $URL->generate(),
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             // so get the section info above this item.
278 278
 
279 279
             // For getting hansard data.
280
-            $input =  [
280
+            $input = [
281 281
                 'amount' =>  [
282 282
                     'body' => true,
283 283
                 ],
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
         twfy_debug(get_class($this), "getting an item's subsection");
312 312
 
313 313
         // What we return.
314
-        $subsectiondata =  [];
314
+        $subsectiondata = [];
315 315
 
316 316
         if ($itemdata['htype'] == '12' || $itemdata['htype'] == '13' || $itemdata['htype'] == '14') {
317 317
             // This item is a speech or procedural, so get the
318 318
             // subsection info above this item.
319 319
 
320 320
             // For getting hansard data.
321
-            $input =  [
321
+            $input = [
322 322
                 'amount' =>  [
323 323
                     'body' => true,
324 324
                 ],
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
             $wherearr['hansard.epobject_id='] = $prev_item_id;
417 417
 
418 418
             // For getting hansard data.
419
-            $input =  [
419
+            $input = [
420 420
                 'amount' =>  [
421 421
                     'body' => true,
422 422
                     'speaker' => true,
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
433 433
                     // Linking to the prev (sub)section.
434 434
                     $thing = $hansardmajors[$this->major]['singular'];
435
-                    $nextprevdata['prev'] =  [
435
+                    $nextprevdata['prev'] = [
436 436
                         'body'		=> sprintf(gettext("Previous %s"), $thing),
437 437
                         'url'		=> $prevdata[0]['listurl'],
438 438
                         'title'		=> $prevdata[0]['body'],
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                     } else {
446 446
                         $title = '';
447 447
                     }
448
-                    $nextprevdata['prev'] =  [
448
+                    $nextprevdata['prev'] = [
449 449
                         'body'		=> gettext('Previous speaker'),
450 450
                         'url'		=> $prevdata[0]['commentsurl'],
451 451
                         'title'		=> $title,
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             $wherearr['hansard.epobject_id='] = $next_item_id;
462 462
 
463 463
             // For getting hansard data.
464
-            $input =  [
464
+            $input = [
465 465
                 'amount' =>  [
466 466
                     'body' => true,
467 467
                     'speaker' => true,
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
477 477
                     // Linking to the next (sub)section.
478 478
                     $thing = $hansardmajors[$this->major]['singular'];
479
-                    $nextprevdata['next'] =  [
479
+                    $nextprevdata['next'] = [
480 480
                         'body'		=> sprintf(gettext("Next %s"), $thing),
481 481
                         'url'		=> $nextdata[0]['listurl'],
482 482
                         'title'		=> $nextdata[0]['body'],
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                     } else {
490 490
                         $title = '';
491 491
                     }
492
-                    $nextprevdata['next'] =  [
492
+                    $nextprevdata['next'] = [
493 493
                         'body'		=> gettext('Next speaker'),
494 494
                         'url'		=> $nextdata[0]['commentsurl'],
495 495
                         'title'		=> $title,
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
         twfy_debug(get_class($this), "getting next/prev dates");
537 537
 
538 538
         // What we return.
539
-        $nextprevdata =  [];
539
+        $nextprevdata = [];
540 540
 
541 541
         $URL = new \MySociety\TheyWorkForYou\Url($this->listpage);
542 542
 
543
-        $looper =  ["next", "prev"];
543
+        $looper = ["next", "prev"];
544 544
 
545 545
         foreach ($looper as $n => $nextorprev) {
546 546
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
             // when displaying the first day of debates.
565 565
             if ($q && $q['hdate'] != null) {
566 566
 
567
-                $URL->insert([ 'd' => $q['hdate'] ]);
567
+                $URL->insert(['d' => $q['hdate']]);
568 568
 
569 569
                 if ($nextorprev == 'next') {
570 570
                     $body = gettext('Next day');
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
                 $title = format_date($q['hdate'], SHORTDATEFORMAT);
576 576
 
577
-                $nextprevdata[$nextorprev] =  [
577
+                $nextprevdata[$nextorprev] = [
578 578
                     'hdate' => $q['hdate'],
579 579
                     'url' => $URL->generate(),
580 580
                     'body' => $body,
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         $thing = $hansardmajors[$this->major]['plural'];
589 589
         $URL->insert(['y' => $year]);
590 590
 
591
-        $nextprevdata['up'] =  [
591
+        $nextprevdata['up'] = [
592 592
             'body' 	=> sprintf(gettext("All of %s’s %s"), $year, $thing),
593 593
             'title'	=> '',
594 594
             'url' 	=> $URL->generate(),
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
         // Get all the data just for this epobject_id.
648
-        $input =  [
648
+        $input = [
649 649
             'amount' =>  [
650 650
                 'body' => true,
651 651
                 'speaker' => true,
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
             $this->check_gid_change($args['gid'], 'a', '');
687 687
 
688 688
             if (substr($args['gid'], -1) == 'L') {
689
-                $letts = ['a','b','c','d','e'];
689
+                $letts = ['a', 'b', 'c', 'd', 'e'];
690 690
                 for ($i = 0; $i < 4; $i++) {
691 691
                     $this->check_gid_change($args['gid'], $letts[$i], $letts[$i + 1]);
692 692
                 }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
     }
731 731
 
732 732
     private function check_gid_change($gid, $from, $to) {
733
-        $input =  [
733
+        $input = [
734 734
             'amount' =>  [
735 735
                 'body' => true,
736 736
                 'speaker' => true,
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         twfy_debug(get_class($this), "getting data by date");
759 759
 
760 760
         // Where we'll put all the data we want to render.
761
-        $data =  [];
761
+        $data = [];
762 762
 
763 763
         $date = $this->_validate_date($args);
764 764
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 
773 773
             // Get all the sections for this date.
774 774
             // Then for each of those we'll get the subsections and rows.
775
-            $input =  [
775
+            $input = [
776 776
                 'amount' =>  [
777 777
                     'body' => true,
778 778
                     'comment' => true,
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
                     $sectionrow = $this->_get_section($sections[$n]);
802 802
 
803 803
                     // Get the subsections within the section.
804
-                    $input =  [
804
+                    $input = [
805 805
                         'amount' =>  [
806 806
                             'body' => true,
807 807
                             'comment' => true,
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
             $major = '';
858 858
         }
859 859
 
860
-        $data =  [];
860
+        $data = [];
861 861
 
862 862
         $q = $this->db->query("SELECT DISTINCT(hdate)
863 863
                         FROM 	hansard
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 
933 933
         $speeches = [];
934 934
         foreach ($q as $row) {
935
-            $speech =  [
935
+            $speech = [
936 936
                 'subsection_id' => $row['subsection_id'],
937 937
                 'section_id' => $row['section_id'],
938 938
                 'htype' => $row['htype'],
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             // Cache parent id to speed up _get_listurl
950 950
             $this->epobjectid_to_gid[$row['subsection_id']] = fix_gid_from_db($row['gid_subsection']);
951 951
 
952
-            $url_args =  ['p' => $row['person_id']];
952
+            $url_args = ['p' => $row['person_id']];
953 953
             $speech['listurl'] = $this->_get_listurl($speech, $url_args);
954 954
             $speeches[] = $speech;
955 955
         }
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
         }
998 998
 
999 999
         // What we'll return.
1000
-        $data =  [];
1000
+        $data = [];
1001 1001
 
1002 1002
         $data['info']['s'] = $args['s'];
1003 1003
 
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
         // Log this query so we can improve them - if it wasn't a "popular
1059 1059
         // query" link
1060
-        if (! isset($args['pop']) or $args['pop'] != 1) {
1060
+        if (!isset($args['pop']) or $args['pop'] != 1) {
1061 1061
             global $SEARCHLOG;
1062 1062
             $SEARCHLOG->add(
1063 1063
                 ['query' => $searchstring,
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
                 //////////////////////////
1186 1186
                 // 2. Create the URL to link to this bit of text.
1187 1187
 
1188
-                $id_data =  [
1188
+                $id_data = [
1189 1189
                     'major'            => $itemdata['major'],
1190 1190
                     'minor'            => $itemdata['minor'],
1191 1191
                     'htype'         => $itemdata['htype'],
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
                 // We append the query onto the end of the URL as variable 's'
1198 1198
                 // so we can highlight them on the debate/wrans list page.
1199
-                $url_args =  ['s' => $searchstring];
1199
+                $url_args = ['s' => $searchstring];
1200 1200
 
1201 1201
                 $itemdata['listurl'] = $this->_get_listurl($id_data, $url_args, $encode);
1202 1202
 
@@ -1249,14 +1249,14 @@  discard block
 block discarded – undo
1249 1249
                     } else {
1250 1250
                         $listurl = '';
1251 1251
                     }
1252
-                    $itemdata['parent'] =  [
1252
+                    $itemdata['parent'] = [
1253 1253
                         'body' => $body,
1254 1254
                         'listurl' => $listurl,
1255 1255
                     ];
1256 1256
                     if ($itemdata['htype'] == 11) {
1257 1257
                         # Search result was a subsection heading; fetch the first entry
1258 1258
                         # from the wrans/wms to show under the heading
1259
-                        $input =  [
1259
+                        $input = [
1260 1260
                             'amount' => [
1261 1261
                                 'body' => true,
1262 1262
                                 'speaker' => true,
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 
1503 1503
         $params[':major'] = $this->major;
1504 1504
         $params[':firstdate'] = $firstyear . '-' . $firstmonth . '-01';
1505
-        $q =  $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1505
+        $q = $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1506 1506
                         FROM		hansard
1507 1507
                         WHERE		major = :major
1508 1508
                         AND			hdate >= :firstdate
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 
1571 1571
                 $YEARURL->insert(['y' => $firstyear - 1]);
1572 1572
 
1573
-                $nextprev['prev'] =  [
1573
+                $nextprev['prev'] = [
1574 1574
                     'body' => 'Previous year',
1575 1575
                     'title' => $firstyear - 1,
1576 1576
                     'url' => $YEARURL->generate(),
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
             } else {
1580 1580
                 // action is 'year'.
1581 1581
 
1582
-                $nextprev['prev'] =  ['body' => 'Previous year'];
1583
-                $nextprev['next'] =  ['body' => 'Next year'];
1582
+                $nextprev['prev'] = ['body' => 'Previous year'];
1583
+                $nextprev['next'] = ['body' => 'Next year'];
1584 1584
 
1585 1585
                 $q = $this->db->query("SELECT DATE_FORMAT(hdate, '%Y') AS year
1586 1586
                             FROM hansard WHERE major = :major
@@ -1669,13 +1669,13 @@  discard block
 block discarded – undo
1669 1669
         // $input['limit'] as a string for the $limit clause, eg '21,20'.
1670 1670
 
1671 1671
         $amount 		= $input['amount'] ?? [];
1672
-        $wherearr 		= $input['where'] ?? [];
1672
+        $wherearr = $input['where'] ?? [];
1673 1673
         $order 			= $input['order'] ?? '';
1674 1674
         $limit 			= $input['limit'] ?? '';
1675 1675
 
1676 1676
 
1677 1677
         // The fields to fetch from db. 'table' => array ('field1', 'field2').
1678
-        $fieldsarr =  [
1678
+        $fieldsarr = [
1679 1679
             'hansard' =>  ['epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'colnum'],
1680 1680
         ];
1681 1681
 
@@ -1688,14 +1688,14 @@  discard block
 block discarded – undo
1688 1688
         if ((isset($amount['body']) && $amount['body'] == true) ||
1689 1689
             (isset($amount['comment']) && $amount['comment'] == true)
1690 1690
         ) {
1691
-            $fieldsarr['epobject'] =  ['body'];
1691
+            $fieldsarr['epobject'] = ['body'];
1692 1692
             $join = 'LEFT OUTER JOIN epobject ON hansard.epobject_id = epobject.epobject_id';
1693 1693
         } else {
1694 1694
             $join = '';
1695 1695
         }
1696 1696
 
1697 1697
 
1698
-        $fieldsarr2 =  [];
1698
+        $fieldsarr2 = [];
1699 1699
         // Construct the $fields clause.
1700 1700
         foreach ($fieldsarr as $table => $tablesfields) {
1701 1701
             foreach ($tablesfields as $n => $field) {
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         }
1705 1705
         $fields = implode(', ', $fieldsarr2);
1706 1706
 
1707
-        $wherearr2 =  [];
1707
+        $wherearr2 = [];
1708 1708
         // Construct the $where clause.
1709 1709
         $i = 0;
1710 1710
         foreach ($wherearr as $key => $val) {
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
             // 'commentsurl' is the URL of the item on its own page, with comments.
1863 1863
 
1864 1864
             // All the things we need to work out a listurl!
1865
-            $item_data =  [
1865
+            $item_data = [
1866 1866
                 'major'			=> $this->major,
1867 1867
                 'minor' 		=> $item['minor'],
1868 1868
                 'htype' 		=> $item['htype'],
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
             if (isset($amount['comment']) && $amount['comment'] == true) {
1911 1911
 
1912 1912
                 // All the things we need to get the comment data.
1913
-                $item_data =  [
1913
+                $item_data = [
1914 1914
                     'htype' => $item['htype'],
1915 1915
                     'epobject_id' => $item['epobject_id'],
1916 1916
                 ];
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
                 $DATA->set_page_metadata('pbc_clause', 'url', "$pbc_url/$id");
2032 2032
                 $LISTURL->remove(['id']);
2033 2033
             } else {
2034
-                $LISTURL->insert([ 'id' => $id_data['gid'] ]);
2034
+                $LISTURL->insert(['id' => $id_data['gid']]);
2035 2035
             }
2036 2036
         } else {
2037 2037
             // A debate speech or question/answer, etc.
@@ -2043,10 +2043,10 @@  discard block
 block discarded – undo
2043 2043
             // Find the gid of this item's (sub)section.
2044 2044
             $parent_gid = '';
2045 2045
 
2046
-            if (isset($this->epobjectid_to_gid[ $parent_epobject_id ])) {
2046
+            if (isset($this->epobjectid_to_gid[$parent_epobject_id])) {
2047 2047
                 // We've previously cached the gid for this epobject_id, so use that.
2048 2048
 
2049
-                $parent_gid = $this->epobjectid_to_gid[ $parent_epobject_id ];
2049
+                $parent_gid = $this->epobjectid_to_gid[$parent_epobject_id];
2050 2050
 
2051 2051
             } else {
2052 2052
                 // We haven't cached the gid, so fetch from db.
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
                     $parent_gid = fix_gid_from_db($r['gid']);
2065 2065
 
2066 2066
                     // Cache it for if we need it again:
2067
-                    $this->epobjectid_to_gid[ $parent_epobject_id ] = $parent_gid;
2067
+                    $this->epobjectid_to_gid[$parent_epobject_id] = $parent_gid;
2068 2068
                 }
2069 2069
             }
2070 2070
 
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
                     $DATA->set_page_metadata('pbc_clause', 'url', "$pbc_url/$parent_gid");
2076 2076
                     $LISTURL->remove(['id']);
2077 2077
                 } else {
2078
-                    $LISTURL->insert([ 'id' => $parent_gid ]);
2078
+                    $LISTURL->insert(['id' => $parent_gid]);
2079 2079
                 }
2080 2080
                 // Use a truncated form of this item's gid for the anchor.
2081 2081
                 $fragment = '#g' . gid_to_anchor($id_data['gid']);
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
         $URL->insert(['p' => $person_id]);
2141 2141
 
2142 2142
         $name = member_full_name($member['house'], $member['title'], $member['given_name'], $member['family_name'], $member['lordofname']);
2143
-        $speaker =  [
2143
+        $speaker = [
2144 2144
             'member_id' => $member['member_id'],
2145 2145
             "name" => $name,
2146 2146
             'house' => $member['house'],
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
     private function _get_speaker_alone($q, $person_id, $hdate, $htime, $major) {
2165 2165
         $members = $q->fetchAll();
2166 2166
         if (count($members) > 1) {
2167
-            $members = array_filter($members, function ($m) use ($major) {
2167
+            $members = array_filter($members, function($m) use ($major) {
2168 2168
                 $houses = \MySociety\TheyWorkForYou\Utility\House::majorToHouse($major);
2169 2169
                 return in_array($m['house'], $houses);
2170 2170
             });
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
                 )->first();
2273 2273
 
2274 2274
                 // Add this comment to the data structure.
2275
-                $comment =  [
2275
+                $comment = [
2276 2276
                     'comment_id' => $q['comment_id'],
2277 2277
                     'user_id'	=> $q['user_id'],
2278 2278
                     'body'		=> $q['body'],
@@ -2287,7 +2287,7 @@  discard block
 block discarded – undo
2287 2287
         // or subsection itself, only the items within them. So
2288 2288
         // we don't get the most recent comment. Because there isn't one.
2289 2289
 
2290
-        $return =  [
2290
+        $return = [
2291 2291
             'totalcomments' => $totalcomments,
2292 2292
             'comment' => $comment,
2293 2293
         ];
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
         // If part of a Written Answer (just question or just answer), select the whole thing
2351 2351
         if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type'] == 'other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) {
2352 2352
             // find the gid of the subheading which holds this part
2353
-            $input =  [
2353
+            $input = [
2354 2354
                 'amount' => ['gid' => true],
2355 2355
                 'where' =>  [
2356 2356
                     'epobject_id=' => $itemdata['subsection_id'],
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 
2367 2367
         # If a WMS main heading, go to next gid
2368 2368
         if (isset($itemdata['major']) && $itemdata['major'] == 4 && $itemdata['htype'] == '10') {
2369
-            $input =  [
2369
+            $input = [
2370 2370
                 'amount' => ['gid' => true],
2371 2371
                 'where' => [
2372 2372
                     'section_id=' => $itemdata['epobject_id'],
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
                 $nextprev['up']['url'] 		= $sectionrow['listurl'];
2447 2447
                 $nextprev['up']['title'] 	= $sectionrow['body'];
2448 2448
             }
2449
-            $nextprev['up']['body']		= gettext('See the whole debate');
2449
+            $nextprev['up']['body'] = gettext('See the whole debate');
2450 2450
         }
2451 2451
 
2452 2452
         // We can then access this from $PAGE and the templates.
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
         // Now get all the non-heading rows.
2456 2456
 
2457 2457
         // What data do we want for each item?
2458
-        $amount =  [
2458
+        $amount = [
2459 2459
             'body' => true,
2460 2460
             'speaker' => true,
2461 2461
             'comment' => true,
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
             // This item is a section, so we're displaying all the items within
2467 2467
             // it that aren't within a subsection.
2468 2468
 
2469
-            $input =  [
2469
+            $input = [
2470 2470
                 'amount' => $amount,
2471 2471
                 'where' =>  [
2472 2472
                     'section_id=' => $itemdata['epobject_id'],
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
             $data['rows'] = $this->_get_hansard_data($input);
2479 2479
             if (!count($data['rows']) || (count($data['rows']) == 1 && strstr($data['rows'][0]['body'], 'was asked'))) {
2480 2480
 
2481
-                $input =  [
2481
+                $input = [
2482 2482
                     'amount' =>  [
2483 2483
                         'body' => true,
2484 2484
                         'comment' => true,
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
         } elseif ($itemdata['htype'] == '11') {
2501 2501
             // This item is a subsection, so we're displaying everything within it.
2502 2502
 
2503
-            $input =  [
2503
+            $input = [
2504 2504
                 'amount' => $amount,
2505 2505
                 'where' =>  [
2506 2506
                     'subsection_id=' => $itemdata['epobject_id'],
@@ -2537,8 +2537,8 @@  discard block
 block discarded – undo
2537 2537
 
2538 2538
         twfy_debug(get_class($this), "getting data by column");
2539 2539
 
2540
-        $input = [ 'amount' => ['body' => true, 'comment' => true, 'speaker' => true],
2541
-            'where' => [ 'hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%' ],
2540
+        $input = ['amount' => ['body' => true, 'comment' => true, 'speaker' => true],
2541
+            'where' => ['hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%'],
2542 2542
             'order' => 'hpos',
2543 2543
         ];
2544 2544
         $data = $this->_get_hansard_data($input);
@@ -2698,10 +2698,10 @@  discard block
 block discarded – undo
2698 2698
                         ", [':major' => $this->major]);
2699 2699
 
2700 2700
         // What we return.
2701
-        $data =  [];
2701
+        $data = [];
2702 2702
         $speeches = [];
2703 2703
         foreach ($q as $row) {
2704
-            $speech =  [
2704
+            $speech = [
2705 2705
                 'subsection_id' => $row['subsection_id'],
2706 2706
                 'section_id' => $row['section_id'],
2707 2707
                 'htype' => $row['htype'],
@@ -2746,7 +2746,7 @@  discard block
 block discarded – undo
2746 2746
             $data['rows'] = $speeches;
2747 2747
 
2748 2748
         } else {
2749
-            $data['rows'] =  [];
2749
+            $data['rows'] = [];
2750 2750
         }
2751 2751
 
2752 2752
         $data['info']['days'] = $days;
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
         if ($q) {
2799 2799
 
2800 2800
             // This array just used for getting further data about this debate.
2801
-            $item_data =  [
2801
+            $item_data = [
2802 2802
                 'major'         => $this->major,
2803 2803
                 'minor'         => $q['minor'],
2804 2804
                 'gid'           => fix_gid_from_db($q['gid']),
@@ -2862,7 +2862,7 @@  discard block
 block discarded – undo
2862 2862
                                 ORDER BY hpos
2863 2863
                                 LIMIT 1
2864 2864
                                 ",
2865
-                    [ ':object_id' => $item_data['epobject_id'] ]
2865
+                    [':object_id' => $item_data['epobject_id']]
2866 2866
                 )->first();
2867 2867
                 $childbody = $r['body'];
2868 2868
                 $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
@@ -2901,7 +2901,7 @@  discard block
 block discarded – undo
2901 2901
                 'more_url' => $more_url->generate(),
2902 2902
             ];
2903 2903
 
2904
-            $data =  [
2904
+            $data = [
2905 2905
                 'gid' => $args['gid'],
2906 2906
                 'major' => $this->major,
2907 2907
                 'info' => [],
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
         foreach ($q as $row) {
2975 2975
 
2976 2976
             // This array just used for getting further data about this debate.
2977
-            $item_data =  [
2977
+            $item_data = [
2978 2978
                 'major' => $this->major,
2979 2979
                 'gid' => fix_gid_from_db($row['gid']),
2980 2980
                 'htype' => $row['htype'],
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
 
3035 3035
         }
3036 3036
 
3037
-        $data =  [
3037
+        $data = [
3038 3038
             'info' => [],
3039 3039
             'data' => $data,
3040 3040
         ];
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
         foreach ($q as $row) {
3099 3099
 
3100 3100
             // This array just used for getting further data about this debate.
3101
-            $item_data =  [
3101
+            $item_data = [
3102 3102
                 'major' => $this->major,
3103 3103
                 'gid' => fix_gid_from_db($row['gid']),
3104 3104
                 'htype' => $row['htype'],
@@ -3107,8 +3107,8 @@  discard block
 block discarded – undo
3107 3107
                 'epobject_id' => $row['epobject_id'],
3108 3108
             ];
3109 3109
 
3110
-            $list_url 		= $this->_get_listurl($item_data);
3111
-            $totalcomments	= $this->_get_comment_count_for_epobject($item_data);
3110
+            $list_url = $this->_get_listurl($item_data);
3111
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3112 3112
 
3113 3113
             $contentcount = $row['count'];
3114 3114
             $body = $row['body'];
@@ -3116,7 +3116,7 @@  discard block
 block discarded – undo
3116 3116
 
3117 3117
 
3118 3118
             // This array will be added to $data, which is what gets returned.
3119
-            $debate =  [
3119
+            $debate = [
3120 3120
                 'contentcount'	=> $contentcount,
3121 3121
                 'body'			=> $body,
3122 3122
                 'hdate'			=> $hdate,
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
             $data[] = $debate;
3157 3157
         }
3158 3158
 
3159
-        $data =  [
3159
+        $data = [
3160 3160
             'info' => [],
3161 3161
             'data' => $data,
3162 3162
         ];
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
         foreach ($q as $row) {
3246 3246
             // This array just used for getting further data about this debate.
3247
-            $item_data =  [
3247
+            $item_data = [
3248 3248
                 'major' => $this->major,
3249 3249
                 'gid' => fix_gid_from_db($row['gid']),
3250 3250
                 'htype' => $row['htype'],
@@ -3253,8 +3253,8 @@  discard block
 block discarded – undo
3253 3253
                 'epobject_id' => $row['epobject_id'],
3254 3254
             ];
3255 3255
 
3256
-            $list_url 		= $this->_get_listurl($item_data);
3257
-            $totalcomments	= $this->_get_comment_count_for_epobject($item_data);
3256
+            $list_url = $this->_get_listurl($item_data);
3257
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3258 3258
 
3259 3259
             $body = $row['body'];
3260 3260
             $hdate = $row['hdate'];
@@ -3282,7 +3282,7 @@  discard block
 block discarded – undo
3282 3282
             $childbody = $r['body'];
3283 3283
             $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
3284 3284
 
3285
-            $data[] =  [
3285
+            $data[] = [
3286 3286
                 'body'			=> $body,
3287 3287
                 'hdate'			=> $hdate,
3288 3288
                 'list_url'		=> $list_url,
@@ -3298,7 +3298,7 @@  discard block
 block discarded – undo
3298 3298
 
3299 3299
         }
3300 3300
 
3301
-        $data =  [
3301
+        $data = [
3302 3302
             'info' => [],
3303 3303
             'data' => $data,
3304 3304
         ];
@@ -3358,7 +3358,7 @@  discard block
 block discarded – undo
3358 3358
     public function _get_data_by_bill($args) {
3359 3359
         global $DATA, $this_page;
3360 3360
         $data = [];
3361
-        $input =  [
3361
+        $input = [
3362 3362
             'amount' =>  [
3363 3363
                 'body' => true,
3364 3364
                 'comment' => true,
@@ -3380,7 +3380,7 @@  discard block
 block discarded – undo
3380 3380
                 [$sitting, $part] = $this->_get_sitting($sectionrow['gid']);
3381 3381
                 $sectionrow['sitting'] = $sitting;
3382 3382
                 $sectionrow['part'] = $part;
3383
-                $input =  [
3383
+                $input = [
3384 3384
                     'amount' =>  [
3385 3385
                         'body' => true,
3386 3386
                         'comment' => true,
@@ -3451,8 +3451,8 @@  discard block
 block discarded – undo
3451 3451
 
3452 3452
         $YEARURL = new \MySociety\TheyWorkForYou\Url('pbc_session');
3453 3453
         $nextprev = [];
3454
-        $nextprev['prev'] =  ['body' => 'Previous session', 'title' => ''];
3455
-        $nextprev['next'] =  ['body' => 'Next session', 'title' => ''];
3454
+        $nextprev['prev'] = ['body' => 'Previous session', 'title' => ''];
3455
+        $nextprev['next'] = ['body' => 'Next session', 'title' => ''];
3456 3456
         $q = $this->db->query(
3457 3457
             "SELECT session FROM bills WHERE session < :session ORDER BY session DESC LIMIT 1",
3458 3458
             [':session' => $session]
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/results.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,9 +19,11 @@
 block discarded – undo
19 19
                     }
20 20
                     ?>
21 21
                   <h2><?= sprintf(gettext('%s in constituencies matching <em class="current-search-term">%s</em>'), $desc, _htmlentities($searchstring)) ?></h2>
22
-                <?php } elseif ($mp_types['former']) { // count($cons) <= 1?>
22
+                <?php } elseif ($mp_types['former']) {
23
+// count($cons) <= 1?>
23 24
                   <h2><?= sprintf(gettext('Former MP for <em class="current-search-term">%s</em>'), _htmlentities($searchstring)) ?></h2>
24
-                <?php } else { // count($cons) <= 1?>
25
+                <?php } else {
26
+// count($cons) <= 1?>
25 27
                   <h2><?= sprintf(gettext('MP for <em class="current-search-term">%s</em>'), _htmlentities($searchstring)) ?></h2>
26 28
                 <?php } ?>
27 29
                 <?php foreach ($cons as $member) { ?>
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
         <div class="search-page__section search-page__section--results">
10 10
             <div class="search-page__section__primary">
11 11
               <?php
12
-              # XXX Hack
13
-              if (preg_match('#winter\s+f[eu]el#i', $searchstring)) { ?>
12
+                # XXX Hack
13
+                if (preg_match('#winter\s+f[eu]el#i', $searchstring)) { ?>
14 14
                 <h3 style="margin-bottom: 1em;" class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2024-09-10a.712.0">⭐️ Read the debate on the winter fuel regulations</a></h3>
15 15
               <?php
16
-              }
17
-          if (preg_match('#budget#i', $searchstring)) { ?>
16
+                }
17
+            if (preg_match('#budget#i', $searchstring)) { ?>
18 18
                 <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2024-10-30a.811.0#g811.2">Read the Budget speech</a></h3>
19 19
               <?php } ?>
20 20
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 <h2>
66 66
                   <?php
67 67
                             $term = sprintf('<em class="current-search-term">%s</em>', _htmlentities($searchdescription));
68
-                  if ($pagination_links) { ?>
68
+                    if ($pagination_links) { ?>
69 69
                     <?= sprintf(gettext('Results %s–%s of %s for %s'), $pagination_links['first_result'], $pagination_links['last_result'], $info['total_results'], $term) ?>
70 70
                   <?php } elseif ($info['total_results'] == 1) { ?>
71 71
                     <?= sprintf(gettext('The only result for %s'), $term) ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/by-person.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
                 <?php if ($error == 'No results' && isset($house) && $house != HOUSE_TYPE_ROYAL) { ?>
14 14
                   <ul class="search-result-display-options">
15 15
                       <li>
16
-                        <?php if ($house ==  HOUSE_TYPE_COMMONS) { ?>
16
+                        <?php if ($house == HOUSE_TYPE_COMMONS) { ?>
17 17
                           No results for MPs only
18
-                        <?php } elseif ($house ==  HOUSE_TYPE_LORDS) { ?>
18
+                        <?php } elseif ($house == HOUSE_TYPE_LORDS) { ?>
19 19
                           No results for Peers only
20 20
                         <?php } elseif ($house == HOUSE_TYPE_SCOTLAND) { ?>
21 21
                           No results for MSPs only
22 22
                         <?php } elseif ($house == HOUSE_TYPE_WALES) { ?>
23 23
                           <?= gettext('No results for MSs only') ?>
24
-                        <?php } elseif ($house ==  HOUSE_TYPE_NI) { ?>
24
+                        <?php } elseif ($house == HOUSE_TYPE_NI) { ?>
25 25
                           No results for MLAs only
26 26
                         <?php } ?>
27 27
                           |
@@ -47,37 +47,37 @@  discard block
 block discarded – undo
47 47
                     <ul class="search-result-display-options">
48 48
                         <li><?= gettext('Results grouped by person') ?></li>
49 49
                         <li>
50
-                          <?php if ($house ==  HOUSE_TYPE_ROYAL) { ?>
50
+                          <?php if ($house == HOUSE_TYPE_ROYAL) { ?>
51 51
                             <?= gettext('Show All') ?>
52 52
                           <?php } else { ?>
53 53
                             <a href="<?= $this_url->generate('html') ?>"><?= gettext('Show All') ?></a>
54 54
                           <?php } ?>
55 55
                             |
56
-                          <?php if ($house ==  HOUSE_TYPE_COMMONS) { ?>
56
+                          <?php if ($house == HOUSE_TYPE_COMMONS) { ?>
57 57
                             MPs only
58 58
                           <?php } else { ?>
59 59
                             <a href="<?= $this_url->generate('html', ['house' => 1]) ?>">MPs only</a>
60 60
                           <?php } ?>
61 61
                             |
62
-                          <?php if ($house ==  HOUSE_TYPE_LORDS) { ?>
62
+                          <?php if ($house == HOUSE_TYPE_LORDS) { ?>
63 63
                             Peers only
64 64
                           <?php } else { ?>
65 65
                             <a href="<?= $this_url->generate('html', ['house' => 2]) ?>">Lords only</a>
66 66
                           <?php } ?>
67 67
                             |
68
-                          <?php if ($house ==  HOUSE_TYPE_SCOTLAND) { ?>
68
+                          <?php if ($house == HOUSE_TYPE_SCOTLAND) { ?>
69 69
                             MSPs only
70 70
                           <?php } else { ?>
71 71
                             <a href="<?= $this_url->generate('html', ['house' => 4]) ?>">MSPs only</a>
72 72
                           <?php } ?>
73 73
                             |
74
-                          <?php if ($house ==  HOUSE_TYPE_WALES) { ?>
74
+                          <?php if ($house == HOUSE_TYPE_WALES) { ?>
75 75
                             <?= gettext('MSs only') ?>
76 76
                           <?php } else { ?>
77 77
                             <a href="<?= $this_url->generate('html', ['house' => 5]) ?>"><?= gettext('MSs only') ?></a>
78 78
                           <?php } ?>
79 79
                             |
80
-                          <?php if ($house ==  HOUSE_TYPE_NI) { ?>
80
+                          <?php if ($house == HOUSE_TYPE_NI) { ?>
81 81
                             MLAs only
82 82
                           <?php } else { ?>
83 83
                             <a href="<?= $this_url->generate('html', ['house' => HOUSE_TYPE_NI]) ?>">MLAs only</a>
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                                 <?php if (isset($speaker['party'])) { ?>
119 119
                                   <span class="search-results-grouped__speaker-party">(<?= $speaker['party'] ?>)</span>
120 120
                                 <?php } ?>
121
-                                <?php if ($house !=  HOUSE_TYPE_LORDS) { ?>
121
+                                <?php if ($house != HOUSE_TYPE_LORDS) { ?>
122 122
                                   <?= isset($speaker['office']) ? ' - ' . join('; ', $speaker['office']) : '' ?>
123 123
                                 <?php } ?>
124 124
                               <?php } else { // no $pid?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,8 @@
 block discarded – undo
121 121
                                 <?php if ($house !=  HOUSE_TYPE_LORDS) { ?>
122 122
                                   <?= isset($speaker['office']) ? ' - ' . join('; ', $speaker['office']) : '' ?>
123 123
                                 <?php } ?>
124
-                              <?php } else { // no $pid?>
124
+                              <?php } else {
125
+// no $pid?>
125 126
                                 <?= $speaker['name'] ?>
126 127
                               <?php } ?>
127 128
                             </td>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/section/_calendar.php 2 patches
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@  discard block
 block discarded – undo
1 1
 <div class="calendar">
2 2
   <?php if(isset($month)) {
3
-      // What is the first day of the month in question?
4
-      $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year);
5
-
6
-      // How many days does this month contain?
7
-      $numberDays = date('t', $firstDayOfMonth);
8
-
9
-      // What is the name of the month in question?
10
-      $monthName = strftime('%B', $firstDayOfMonth);
11
-
12
-      if (isset($info['onday'])) {
13
-          // 'onday' is like 'yyyy-mm-dd'.
14
-          $datebits = explode('-', $info['onday']);
15
-          if (count($datebits) > 2 && $datebits[0] == $year && $datebits[1] == $month) {
16
-              $toDay = $datebits[2];
17
-          } else {
18
-              $toDay = '';
19
-          }
20
-      } else {
21
-          // If this calendar is for this current, real world, month
22
-          // we get the value of today, so we can highlight it.
23
-          $nowDateComponents = getdate();
24
-
25
-          if ($nowDateComponents['year'] == $year && $nowDateComponents['mon'] == $month) {
26
-              $toDay = $nowDateComponents['mday'];
27
-          } else {
28
-              $toDay = '';
29
-          }
30
-      }
31
-
32
-      $dayOfWeek = strftime('%w', $firstDayOfMonth) - 1;
33
-
34
-      // Adjusted to cope with the week starting on Monday.
35
-      if ($dayOfWeek < 0) {
36
-          $dayOfWeek = 6;
37
-      }
38
-      ?>
3
+        // What is the first day of the month in question?
4
+        $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year);
5
+
6
+        // How many days does this month contain?
7
+        $numberDays = date('t', $firstDayOfMonth);
8
+
9
+        // What is the name of the month in question?
10
+        $monthName = strftime('%B', $firstDayOfMonth);
11
+
12
+        if (isset($info['onday'])) {
13
+            // 'onday' is like 'yyyy-mm-dd'.
14
+            $datebits = explode('-', $info['onday']);
15
+            if (count($datebits) > 2 && $datebits[0] == $year && $datebits[1] == $month) {
16
+                $toDay = $datebits[2];
17
+            } else {
18
+                $toDay = '';
19
+            }
20
+        } else {
21
+            // If this calendar is for this current, real world, month
22
+            // we get the value of today, so we can highlight it.
23
+            $nowDateComponents = getdate();
24
+
25
+            if ($nowDateComponents['year'] == $year && $nowDateComponents['mon'] == $month) {
26
+                $toDay = $nowDateComponents['mday'];
27
+            } else {
28
+                $toDay = '';
29
+            }
30
+        }
31
+
32
+        $dayOfWeek = strftime('%w', $firstDayOfMonth) - 1;
33
+
34
+        // Adjusted to cope with the week starting on Monday.
35
+        if ($dayOfWeek < 0) {
36
+            $dayOfWeek = 6;
37
+        }
38
+        ?>
39 39
   <?php }
40
-  if (!isset($years)) { ?>
40
+    if (!isset($years)) { ?>
41 41
     <div class="calendar__controls">
42 42
         <?php if (isset($prev)) { ?>
43 43
         <a href="<?= $prev['url'] ?>" class="calendar__controls__previous">&larr;</a>
@@ -75,93 +75,93 @@  discard block
 block discarded – undo
75 75
             <tr>
76 76
 
77 77
 <?php
78
-          if ($dayOfWeek > 0) {
79
-              print "<td colspan=\"$dayOfWeek\">&nbsp;</td>";
80
-          }
78
+            if ($dayOfWeek > 0) {
79
+                print "<td colspan=\"$dayOfWeek\">&nbsp;</td>";
80
+            }
81 81
 
82
-  $currentDay = 1;
82
+    $currentDay = 1;
83 83
 
84
-  while ($currentDay <= $numberDays) {
84
+    while ($currentDay <= $numberDays) {
85 85
 
86
-      // Seventh column (Sunday) reached. Start a new row.
86
+        // Seventh column (Sunday) reached. Start a new row.
87 87
 
88
-      if ($dayOfWeek == 7) {
88
+        if ($dayOfWeek == 7) {
89 89
 
90
-          $dayOfWeek = 0;
91
-          ?></tr>
90
+            $dayOfWeek = 0;
91
+            ?></tr>
92 92
                 <tr><?php
93
-      }
94
-
95
-      $recess = recess_prettify($currentDay, $month, $year, $recess_major);
96
-
97
-      // Is this day actually Today in the real world?
98
-      // If so, higlight it.
99
-      // Also highlight days where there are no
100
-      // sittings - e.g. WH is only Tuesday-Thursday
101
-      if ($currentDay == $toDay) {
102
-          print '<td class="on"';
103
-          if ($recess[0] && $recess[0] != 1) {
104
-              print ' title="' . $recess[0] . '"';
105
-          }
106
-          print '>';
107
-      } elseif ($recess[0]) {
108
-          print '<td class="no"';
109
-          if ($recess[0] != 1) {
110
-              print ' title="' . $recess[0] . '"';
111
-          }
112
-          print '>';
113
-      } else {
114
-          print '<td>';
115
-      }
116
-
117
-      // Is the $currentDay a member of $dates? If so,
118
-      // the day should be linked.
119
-      if (in_array($currentDay, $dates)) {
120
-
121
-          $date = sprintf("%04d-%02d-%02d", $year, $month, $currentDay);
122
-
123
-          if ($currentDay == $toDay) {
124
-              print '<span>' . $currentDay . '</span></td>';
125
-          } else {
126
-              $day_section = $section;
127
-              if ($section == 'sp') {
128
-                  $day_section = 'spdebates';
129
-              }
130
-              $urls[$day_section . 'day']->insert(['d' => $date]);
131
-              print "<a href=\"" . $urls[$day_section . 'day']->generate() . "\">$currentDay</a></td>";
132
-          }
133
-
134
-          // $currentDay is not a member of $dates.
135
-
136
-      } else {
137
-
138
-          print '<span>' . $currentDay . '</span></td>';
139
-      }
140
-      // Increment counters
141
-
142
-      $currentDay++;
143
-      $dayOfWeek++;
144
-  }
145
-
146
-  // Complete the row of the last week in month, if necessary
147
-
148
-  if ($dayOfWeek != 7) {
149
-
150
-      $remainingDays = 7 - $dayOfWeek;
151
-      print "<td colspan=\"$remainingDays\">&nbsp;</td>";
152
-  }
153
-  ?>
93
+        }
94
+
95
+        $recess = recess_prettify($currentDay, $month, $year, $recess_major);
96
+
97
+        // Is this day actually Today in the real world?
98
+        // If so, higlight it.
99
+        // Also highlight days where there are no
100
+        // sittings - e.g. WH is only Tuesday-Thursday
101
+        if ($currentDay == $toDay) {
102
+            print '<td class="on"';
103
+            if ($recess[0] && $recess[0] != 1) {
104
+                print ' title="' . $recess[0] . '"';
105
+            }
106
+            print '>';
107
+        } elseif ($recess[0]) {
108
+            print '<td class="no"';
109
+            if ($recess[0] != 1) {
110
+                print ' title="' . $recess[0] . '"';
111
+            }
112
+            print '>';
113
+        } else {
114
+            print '<td>';
115
+        }
116
+
117
+        // Is the $currentDay a member of $dates? If so,
118
+        // the day should be linked.
119
+        if (in_array($currentDay, $dates)) {
120
+
121
+            $date = sprintf("%04d-%02d-%02d", $year, $month, $currentDay);
122
+
123
+            if ($currentDay == $toDay) {
124
+                print '<span>' . $currentDay . '</span></td>';
125
+            } else {
126
+                $day_section = $section;
127
+                if ($section == 'sp') {
128
+                    $day_section = 'spdebates';
129
+                }
130
+                $urls[$day_section . 'day']->insert(['d' => $date]);
131
+                print "<a href=\"" . $urls[$day_section . 'day']->generate() . "\">$currentDay</a></td>";
132
+            }
133
+
134
+            // $currentDay is not a member of $dates.
135
+
136
+        } else {
137
+
138
+            print '<span>' . $currentDay . '</span></td>';
139
+        }
140
+        // Increment counters
141
+
142
+        $currentDay++;
143
+        $dayOfWeek++;
144
+    }
145
+
146
+    // Complete the row of the last week in month, if necessary
147
+
148
+    if ($dayOfWeek != 7) {
149
+
150
+        $remainingDays = 7 - $dayOfWeek;
151
+        print "<td colspan=\"$remainingDays\">&nbsp;</td>";
152
+    }
153
+    ?>
154 154
             </tr>
155 155
         </tbody>
156 156
     </table>
157 157
   <?php if(!isset($years)) { ?>
158 158
     <div class="calendar__footer">
159 159
     <?php
160
-          $y = $urls['day'];
161
-      $y->reset();
162
-      $y->insert([ 'y' => $year ]);
163
-      $url = $y->generate();
164
-      ?>
160
+            $y = $urls['day'];
161
+        $y->reset();
162
+        $y->insert([ 'y' => $year ]);
163
+        $url = $y->generate();
164
+        ?>
165 165
     <a href="<?= $url ?>"><?= sprintf(gettext('See all of %s'), $year) ?></a>
166 166
     </div>
167 167
   <?php } ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <div class="calendar">
2
-  <?php if(isset($month)) {
2
+  <?php if (isset($month)) {
3 3
       // What is the first day of the month in question?
4 4
       $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year);
5 5
 
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
             </tr>
155 155
         </tbody>
156 156
     </table>
157
-  <?php if(!isset($years)) { ?>
157
+  <?php if (!isset($years)) { ?>
158 158
     <div class="calendar__footer">
159 159
     <?php
160 160
           $y = $urls['day'];
161 161
       $y->reset();
162
-      $y->insert([ 'y' => $year ]);
162
+      $y->insert(['y' => $year]);
163 163
       $url = $y->generate();
164 164
       ?>
165 165
     <a href="<?= $url ?>"><?= sprintf(gettext('See all of %s'), $year) ?></a>
Please login to merge, or discard this patch.