@@ -7,7 +7,7 @@ |
||
7 | 7 | </div> |
8 | 8 | <div class="business-section__primary"> |
9 | 9 | <?php |
10 | - if ( isset($divisions) && $divisions ) { |
|
10 | + if (isset($divisions) && $divisions) { |
|
11 | 11 | $current_date = ''; |
12 | 12 | ?> |
13 | 13 | <ul class="business-list"> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | foreach ($calendar as $year => $months) { |
3 | 3 | foreach ($months as $month => $dates) { |
4 | - include '_calendar.php'; |
|
4 | + include '_calendar.php'; |
|
5 | 5 | } |
6 | 6 | } ?> |
@@ -41,7 +41,7 @@ |
||
41 | 41 | if ($dayOfWeek < 0) { |
42 | 42 | $dayOfWeek = 6; |
43 | 43 | } |
44 | - ?> |
|
44 | + ?> |
|
45 | 45 | <?php } |
46 | 46 | if (!isset($years)) { ?> |
47 | 47 | <div class="calendar__controls"> |
@@ -1,10 +1,10 @@ discard block |
||
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 | - $firstDayOfMonth = mktime(0,0,0,$month,1,$year); |
|
4 | + $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year); |
|
5 | 5 | |
6 | 6 | // How many days does this month contain? |
7 | - $numberDays = date('t',$firstDayOfMonth); |
|
7 | + $numberDays = date('t', $firstDayOfMonth); |
|
8 | 8 | |
9 | 9 | // What is the name of the month in question? |
10 | 10 | $monthName = strftime('%B', $firstDayOfMonth); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | if (isset($info['onday'])) { |
13 | 13 | // 'onday' is like 'yyyy-mm-dd'. |
14 | 14 | $datebits = explode('-', $info['onday']); |
15 | - if (count($datebits)>2 && $datebits[0] == $year && $datebits[1] == $month) { |
|
15 | + if (count($datebits) > 2 && $datebits[0] == $year && $datebits[1] == $month) { |
|
16 | 16 | $toDay = $datebits[2]; |
17 | 17 | } else { |
18 | 18 | $toDay = ''; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | <?php } |
40 | 40 | if (!isset($years)) { ?> |
41 | 41 | <div class="calendar__controls"> |
42 | - <?php if ( isset($prev) ) { ?> |
|
42 | + <?php if (isset($prev)) { ?> |
|
43 | 43 | <a href="<?= $prev['url'] ?>" class="calendar__controls__previous">←</a> |
44 | 44 | <?php } else { ?> |
45 | 45 | <span class="calendar__controls__previous"> </span> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <span class="calendar__controls__current"> |
48 | 48 | <?= $monthName ?> <?= $year ?> |
49 | 49 | </span> |
50 | - <?php if ( isset($next) ) { ?> |
|
50 | + <?php if (isset($next)) { ?> |
|
51 | 51 | <a href="<?= $next['url'] ?>" class="calendar__controls__next">→</a> |
52 | 52 | <?php } else { ?> |
53 | 53 | <span class="calendar__controls__next"> </span> |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | // sittings - e.g. WH is only Tuesday-Thursday |
101 | 101 | if ($currentDay == $toDay) { |
102 | 102 | print '<td class="on"'; |
103 | - if ($recess[0] && $recess[0]!=1) { |
|
104 | - print ' title="'.$recess[0].'"'; |
|
103 | + if ($recess[0] && $recess[0] != 1) { |
|
104 | + print ' title="' . $recess[0] . '"'; |
|
105 | 105 | } |
106 | 106 | print '>'; |
107 | 107 | } elseif ($recess[0]) { |
108 | 108 | print '<td class="no"'; |
109 | - if ($recess[0]!=1) { |
|
110 | - print ' title="'.$recess[0].'"'; |
|
109 | + if ($recess[0] != 1) { |
|
110 | + print ' title="' . $recess[0] . '"'; |
|
111 | 111 | } |
112 | 112 | print '>'; |
113 | 113 | } else { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // Is the $currentDay a member of $dates? If so, |
118 | 118 | // the day should be linked. |
119 | - if (in_array($currentDay,$dates)) { |
|
119 | + if (in_array($currentDay, $dates)) { |
|
120 | 120 | |
121 | 121 | $date = sprintf("%04d-%02d-%02d", $year, $month, $currentDay); |
122 | 122 | |
@@ -154,12 +154,12 @@ discard block |
||
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(array( 'y' => $year )); |
|
162 | + $y->insert(array('y' => $year)); |
|
163 | 163 | $url = $y->generate(); |
164 | 164 | ?> |
165 | 165 | <a href="<?= $url ?>"><?= sprintf(gettext('See all of %s'), $year) ?></a> |
@@ -12,20 +12,20 @@ discard block |
||
12 | 12 | ), |
13 | 13 | 2001 => array( |
14 | 14 | 1=>array('less'=>8), |
15 | - 2=>array('between'=>array(15,26)), |
|
16 | - 4=>array('between'=>array(10,23)), |
|
15 | + 2=>array('between'=>array(15, 26)), |
|
16 | + 4=>array('between'=>array(10, 23)), |
|
17 | 17 | 5=>array('more'=>13), |
18 | 18 | 6=>array('less'=>13), |
19 | 19 | 7=>array('more'=>20), |
20 | 20 | 8=>array('all'=>1), |
21 | 21 | 9=>array('less'=>14, 'more'=>14), |
22 | - 10=>array('less'=>4, 'between'=>array(4,8, 8,15)), |
|
22 | + 10=>array('less'=>4, 'between'=>array(4, 8, 8, 15)), |
|
23 | 23 | 12=>array('more'=>19) ), |
24 | 24 | 2002 => array( |
25 | 25 | 1=>array('less'=>8), |
26 | - 2=>array('between'=>array(14,25)), |
|
26 | + 2=>array('between'=>array(14, 25)), |
|
27 | 27 | 3=>array('more'=>26), |
28 | - 4=>array('less'=>3, 'between'=>array(3,10)), |
|
28 | + 4=>array('less'=>3, 'between'=>array(3, 10)), |
|
29 | 29 | 5=>array('more'=>24), |
30 | 30 | 6=>array('less'=>10), |
31 | 31 | 7=>array('more'=>24), |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | 12=>array('more'=>19) ), |
36 | 36 | 2003 => array( |
37 | 37 | 1=>array('less'=>7), |
38 | - 2=>array('between'=>array(13,24)), |
|
39 | - 4=>array('between'=>array(14,28)), |
|
38 | + 2=>array('between'=>array(13, 24)), |
|
39 | + 4=>array('between'=>array(14, 28)), |
|
40 | 40 | 5=>array('more'=>22), |
41 | 41 | 6=>array('less'=>3), |
42 | 42 | 7=>array('more'=>17), |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | 12=>array('more'=>18)), |
47 | 47 | 2004 => array( |
48 | 48 | 1=>array('less'=>5), |
49 | - 2=>array('between'=>array(12,23)), |
|
50 | - 4=>array('between'=>array(1,19)), |
|
49 | + 2=>array('between'=>array(12, 23)), |
|
50 | + 4=>array('between'=>array(1, 19)), |
|
51 | 51 | 5=>array('more'=>27), |
52 | 52 | 6=>array('less'=>7), |
53 | 53 | 7=>array('more'=>22), |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 12=>array('more'=>21) ), |
58 | 58 | 2005 => array( |
59 | 59 | 1=>array('less'=>10), |
60 | - 2=>array('between'=>array(10,21)), |
|
60 | + 2=>array('between'=>array(10, 21)), |
|
61 | 61 | 3=>array('more'=>24), |
62 | 62 | 4=>array('less'=>4, 'more'=>10), |
63 | 63 | 5=>array('less'=>11, 'more'=>26), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 12=>array('more'=>20) ), |
70 | 70 | 2006 => array( |
71 | 71 | 1=>array('less'=>9), |
72 | - 2=>array('between'=>array(16,27)), |
|
72 | + 2=>array('between'=>array(16, 27)), |
|
73 | 73 | 3=>array('more'=>30), |
74 | 74 | 4=>array('less'=>18), |
75 | 75 | 5=>array('more'=>25), |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ), |
83 | 83 | 2007 => array( |
84 | 84 | 1=>array('less'=>8), |
85 | - 2=>array('between'=>array(8,19)), |
|
85 | + 2=>array('between'=>array(8, 19)), |
|
86 | 86 | 3=>array('more'=>29), |
87 | 87 | 4=>array('less'=>16), |
88 | 88 | 5=>array('more'=>24), |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | ), |
96 | 96 | 2008 => array( |
97 | 97 | 1=>array('less'=>7), |
98 | - 2=>array('between'=>array(7,18)), |
|
99 | - 4=>array('between'=>array(3,21)), |
|
98 | + 2=>array('between'=>array(7, 18)), |
|
99 | + 4=>array('between'=>array(3, 21)), |
|
100 | 100 | 5=>array('more'=>22), |
101 | 101 | 6=>array('less'=>2), |
102 | 102 | 7=>array('more'=>22), |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | ), |
108 | 108 | 2009 => array( |
109 | 109 | 1=>array('less'=>12), |
110 | - 2=>array('between'=>array(12,23)), |
|
111 | - 4=>array('between'=>array(2,20)), |
|
110 | + 2=>array('between'=>array(12, 23)), |
|
111 | + 4=>array('between'=>array(2, 20)), |
|
112 | 112 | 5=>array('more'=>21), |
113 | 113 | 6=>array('less'=>1), |
114 | 114 | 7=>array('more'=>21), |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ), |
120 | 120 | 2010 => array( |
121 | 121 | 1=>array('less'=>5), |
122 | - 2=>array('between'=>array(10,22)), |
|
122 | + 2=>array('between'=>array(10, 22)), |
|
123 | 123 | 3=>array('more'=>30), |
124 | 124 | 4=>array('less'=>6, 'more'=>8), |
125 | 125 | 5=>array('less'=>18, 'more'=>27), |
@@ -132,62 +132,62 @@ discard block |
||
132 | 132 | ), |
133 | 133 | 2011 => array( |
134 | 134 | 1=>array('less'=>10), |
135 | - 2=>array('between'=>array(17,28)), |
|
136 | - 4=>array('between'=>array(5,26)), |
|
135 | + 2=>array('between'=>array(17, 28)), |
|
136 | + 4=>array('between'=>array(5, 26)), |
|
137 | 137 | 5=>array('more'=>24), |
138 | 138 | 6=>array('less'=>7), |
139 | 139 | 7=>array('more'=>19), |
140 | 140 | 8=>array('all'=>1), |
141 | 141 | 9=>array('less'=>5, 'more'=>15), |
142 | 142 | 10=>array('less'=>10), |
143 | - 11=>array('between'=>array(15,21)), |
|
143 | + 11=>array('between'=>array(15, 21)), |
|
144 | 144 | 12=>array('more'=>20), |
145 | 145 | ), |
146 | 146 | 2012 => array( |
147 | 147 | 1=>array('less'=>10), |
148 | - 2=>array('between'=>array(9,20)), |
|
148 | + 2=>array('between'=>array(9, 20)), |
|
149 | 149 | 3=>array('more'=>27), |
150 | 150 | 4=>array('less'=>16), |
151 | 151 | 5=>array('more'=>24), |
152 | 152 | 6=>array('less'=>11), |
153 | 153 | 7=>array('more'=>17), |
154 | 154 | 8=>array('all'=>1), |
155 | - 9=>array('less'=>3,'more'=>18), |
|
155 | + 9=>array('less'=>3, 'more'=>18), |
|
156 | 156 | 10=>array('less'=>15), |
157 | - 11=>array('between'=>array(13,19)), |
|
157 | + 11=>array('between'=>array(13, 19)), |
|
158 | 158 | 12=>array('more'=>20) |
159 | 159 | ), |
160 | 160 | 2013 => array( |
161 | 161 | 1=>array('less'=>7), |
162 | - 2=>array('between'=>array(14,25)), |
|
162 | + 2=>array('between'=>array(14, 25)), |
|
163 | 163 | 3=>array('more'=>26), |
164 | 164 | 4=>array('less'=>15), |
165 | 165 | 5=>array('more'=>21), |
166 | 166 | 6=>array('less'=>3), |
167 | 167 | 7=>array('more'=>18), |
168 | 168 | 8=>array('all'=>1), |
169 | - 9=>array('less'=>2,'more'=>13), |
|
169 | + 9=>array('less'=>2, 'more'=>13), |
|
170 | 170 | 10=>array('less'=>8), |
171 | - 11=>array('between'=>array(12,18)), |
|
171 | + 11=>array('between'=>array(12, 18)), |
|
172 | 172 | 12=>array('more'=>19) |
173 | 173 | ), |
174 | 174 | 2014 => array( |
175 | 175 | 1=>array('less'=>6), |
176 | - 2=>array('between'=>array(13,24)), |
|
177 | - 4=>array('between'=>array(10,28)), |
|
178 | - 5=>array('between'=>array(1,6)) |
|
176 | + 2=>array('between'=>array(13, 24)), |
|
177 | + 4=>array('between'=>array(10, 28)), |
|
178 | + 5=>array('between'=>array(1, 6)) |
|
179 | 179 | ), |
180 | 180 | 2015 => array( |
181 | 181 | 7=>array('more'=>21), |
182 | 182 | 8=>array('all'=>1), |
183 | 183 | 9=>array('less'=>7, 'more'=>17), |
184 | 184 | 10=>array('less'=>12), |
185 | - 11=>array('between'=>array(10,16)), |
|
185 | + 11=>array('between'=>array(10, 16)), |
|
186 | 186 | 12=>array('more'=>17) |
187 | 187 | ), |
188 | 188 | 2016 => array( |
189 | 189 | 1=>array('less'=>5), |
190 | - 2=>array('between'=>array(11,22)) |
|
190 | + 2=>array('between'=>array(11, 22)) |
|
191 | 191 | ) |
192 | 192 | ); |
193 | 193 | # Lords differences |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | $GLOBALS['recessdates'][101][2010][12]['more'] = 22; |
200 | 200 | $GLOBALS['recessdates'][101][2011] = array( |
201 | 201 | 1 => array('less'=>10), |
202 | - 2 => array('between'=>array(16,28)), |
|
203 | - 4 => array('between'=>array(6,26)), |
|
202 | + 2 => array('between'=>array(16, 28)), |
|
203 | + 4 => array('between'=>array(6, 26)), |
|
204 | 204 | 5 => array('more'=>25), |
205 | 205 | 6 => array('less'=>6), |
206 | 206 | 7 => array('more'=>20), |
207 | 207 | 8 => array('all'=>1), |
208 | 208 | 9 => array('less'=>5, 'more'=>15), |
209 | 209 | 10 => array('less'=>3), |
210 | - 11=>array('between'=>array(16,21)), |
|
210 | + 11=>array('between'=>array(16, 21)), |
|
211 | 211 | 12 => array('more'=>21), |
212 | 212 | ); |
213 | 213 | |
@@ -216,74 +216,74 @@ discard block |
||
216 | 216 | 1999 => array( |
217 | 217 | 7 => array('more' => 2), |
218 | 218 | 8 => array('less' => 31), |
219 | - 10 => array('between' => array(8,25)), |
|
219 | + 10 => array('between' => array(8, 25)), |
|
220 | 220 | 12 => array('more' => 17) |
221 | 221 | ), |
222 | 222 | 2000 => array( |
223 | 223 | 1 => array('less' => 10), |
224 | - 4 => array('between' => array(7,25)), |
|
224 | + 4 => array('between' => array(7, 25)), |
|
225 | 225 | 7 => array('more' => 7), |
226 | 226 | 8 => array('all' => 1), |
227 | 227 | 9 => array('less' => 4), |
228 | - 10 => array('between' => array(6,23)), |
|
228 | + 10 => array('between' => array(6, 23)), |
|
229 | 229 | 12 => array('more' => 20) |
230 | 230 | ), |
231 | 231 | 2001 => array( |
232 | 232 | 1=>array('less'=>8), |
233 | - 2=>array('between'=>array(16,26)), |
|
234 | - 4=>array('between'=>array(6,23)), |
|
233 | + 2=>array('between'=>array(16, 26)), |
|
234 | + 4=>array('between'=>array(6, 23)), |
|
235 | 235 | 6=>array('more'=>29), |
236 | 236 | 7=>array('all'=>1), |
237 | 237 | 8=>array('all'=>1), |
238 | 238 | 9=>array('less'=>3), |
239 | - 10=>array('between'=>array(5,22)), |
|
239 | + 10=>array('between'=>array(5, 22)), |
|
240 | 240 | 12=>array('more'=>21) ), |
241 | 241 | 2002 => array( |
242 | 242 | 1=>array('less'=>7), |
243 | - 2=>array('between'=>array(15,25)), |
|
243 | + 2=>array('between'=>array(15, 25)), |
|
244 | 244 | 3=>array('more'=>28), |
245 | 245 | 4=>array('less'=>15), |
246 | 246 | 7=>array('more'=>10), |
247 | 247 | 8=>array('all'=>1), |
248 | 248 | 9=>array('less'=>2), |
249 | - 10=>array('between'=>array(11,28)), |
|
249 | + 10=>array('between'=>array(11, 28)), |
|
250 | 250 | 12=>array('more'=>20) ), |
251 | 251 | 2003 => array( |
252 | 252 | 1=>array('less'=>6), |
253 | - 4=>array('between'=>array(0,31)), |
|
253 | + 4=>array('between'=>array(0, 31)), |
|
254 | 254 | 5=>array('less'=>2), |
255 | 255 | 6=>array('more'=>27), |
256 | 256 | 7=>array('all'=>1), |
257 | 257 | 8=>array('all'=>1), |
258 | - 10=>array('between'=>array(10,27)), |
|
258 | + 10=>array('between'=>array(10, 27)), |
|
259 | 259 | 12=>array('more'=>19)), |
260 | 260 | 2004 => array( |
261 | 261 | 1=>array('less'=>5), |
262 | - 2=>array('between'=>array(13,23)), |
|
263 | - 4=>array('between'=>array(2,19)), |
|
262 | + 2=>array('between'=>array(13, 23)), |
|
263 | + 4=>array('between'=>array(2, 19)), |
|
264 | 264 | 6=>array('more'=>25), |
265 | 265 | 7=>array('all'=>1), |
266 | 266 | 8=>array('less'=>30), |
267 | - 10=>array('between'=>array(10,23)), |
|
267 | + 10=>array('between'=>array(10, 23)), |
|
268 | 268 | 12=>array('more'=>26) ), |
269 | 269 | 2005 => array( |
270 | 270 | 1=>array('less'=>8), |
271 | - 2=>array('between'=>array(11,21)), |
|
271 | + 2=>array('between'=>array(11, 21)), |
|
272 | 272 | 3=>array('more'=>24), |
273 | 273 | 4=>array('less'=>11), |
274 | 274 | 7=>array('more'=>1), |
275 | 275 | 8=>array('all'=>1), |
276 | 276 | 9=>array('less'=>5), |
277 | - 10=>array('between'=>array(7,24)), |
|
277 | + 10=>array('between'=>array(7, 24)), |
|
278 | 278 | 12=>array('more'=>23) ), |
279 | 279 | 2006 => array( |
280 | 280 | 1=>array('less'=>9), |
281 | - 2=>array('between'=>array(10,20)), |
|
281 | + 2=>array('between'=>array(10, 20)), |
|
282 | 282 | 4=>array('less'=>18), |
283 | 283 | 7=>array('more'=>0), |
284 | 284 | 8=>array('all'=>1), |
285 | 285 | 9=>array('less'=>4), |
286 | - 10=>array('between'=>array(6,23)), |
|
286 | + 10=>array('between'=>array(6, 23)), |
|
287 | 287 | 12=>array('more'=>22), |
288 | 288 | ), |
289 | 289 | 2007 => array( |
@@ -293,18 +293,18 @@ discard block |
||
293 | 293 | 7=>array('all'=>1), |
294 | 294 | 8=>array('all'=>1), |
295 | 295 | 9=>array('less'=>3), |
296 | - 10=>array('between'=>array(5,22)), |
|
296 | + 10=>array('between'=>array(5, 22)), |
|
297 | 297 | 12=>array('more'=>21), |
298 | 298 | ), |
299 | 299 | 2008 => array( |
300 | 300 | 1=>array('less'=>5), |
301 | - 2=>array('between'=>array(8,18)), |
|
301 | + 2=>array('between'=>array(8, 18)), |
|
302 | 302 | 3=>array('more'=>28), |
303 | 303 | 4=>array('less'=>14), |
304 | 304 | 6=>array('more'=>27), |
305 | 305 | 7=>array('all'=>1), |
306 | 306 | 8=>array('all'=>1), |
307 | - 10=>array('between'=>array(10,27)), |
|
307 | + 10=>array('between'=>array(10, 27)), |
|
308 | 308 | ), |
309 | 309 | ); |
310 | 310 | |
@@ -370,45 +370,45 @@ discard block |
||
370 | 370 | $to = "$year-9-" . $dates[$year][9]['less']; |
371 | 371 | } |
372 | 372 | } |
373 | - if ( (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) |
|
373 | + if ((isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) |
|
374 | 374 | || (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) |
375 | 375 | || (isset($dates[$year][$month]['between']) && $day > $dates[$year][$month]['between'][0] && $day < $dates[$year][$month]['between'][1]) |
376 | - || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) ) { |
|
376 | + || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3])) { |
|
377 | 377 | switch ($month) { |
378 | 378 | case 1: case 12: $recess = 'Christmas Recess'; break; |
379 | - case 2: if ($body==1 || $body==101) { |
|
379 | + case 2: if ($body == 1 || $body == 101) { |
|
380 | 380 | $recess = 'Half Term Week'; |
381 | - } elseif ($body==4) { |
|
381 | + } elseif ($body == 4) { |
|
382 | 382 | $recess = 'February Recess'; |
383 | 383 | } |
384 | 384 | break; |
385 | - case 3: if ($body==1 || $body==101) { |
|
385 | + case 3: if ($body == 1 || $body == 101) { |
|
386 | 386 | $recess = 'Easter Recess'; |
387 | - } elseif ($body==4) { |
|
387 | + } elseif ($body == 4) { |
|
388 | 388 | $recess = 'Spring Recess'; |
389 | 389 | } |
390 | 390 | break; |
391 | 391 | case 4: if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) { |
392 | 392 | $recess = 'Election Recess'; |
393 | - } elseif ($body==4 && $year==2003) { |
|
393 | + } elseif ($body == 4 && $year == 2003) { |
|
394 | 394 | $recess = 'Election Recess'; |
395 | - } elseif ($body==1 || $body==101) { |
|
395 | + } elseif ($body == 1 || $body == 101) { |
|
396 | 396 | $recess = 'Easter Recess'; |
397 | - } elseif ($body==4) { |
|
397 | + } elseif ($body == 4) { |
|
398 | 398 | $recess = 'Spring Recess'; |
399 | 399 | } |
400 | 400 | break; |
401 | - case 5: if ($year==2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) { |
|
401 | + case 5: if ($year == 2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) { |
|
402 | 402 | $recess = 'Election Recess'; |
403 | 403 | } else { |
404 | 404 | $recess = 'Whit Recess'; |
405 | 405 | } |
406 | 406 | break; |
407 | - case 6: if ($year==2001) { |
|
407 | + case 6: if ($year == 2001) { |
|
408 | 408 | $recess = 'Election Recess'; |
409 | - } elseif ($body==1 || $body==101) { |
|
409 | + } elseif ($body == 1 || $body == 101) { |
|
410 | 410 | $recess = 'Whit Recess'; |
411 | - } elseif ($body==4) { |
|
411 | + } elseif ($body == 4) { |
|
412 | 412 | $recess = 'Summer Recess'; |
413 | 413 | } else { |
414 | 414 | trigger_error("Argh6"); |
@@ -418,17 +418,17 @@ discard block |
||
418 | 418 | break; |
419 | 419 | case 9: if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) { |
420 | 420 | $recess = 'Summer Recess'; |
421 | - } elseif ($body==1 || $body==101) { |
|
421 | + } elseif ($body == 1 || $body == 101) { |
|
422 | 422 | $recess = 'Conference Recess'; |
423 | 423 | } else { |
424 | 424 | trigger_error("Argh9"); |
425 | 425 | } |
426 | 426 | break; |
427 | - case 10: if ($body==1 || $body==101) { |
|
427 | + case 10: if ($body == 1 || $body == 101) { |
|
428 | 428 | $recess = 'Conference Recess'; |
429 | - } elseif ($body==4) { |
|
429 | + } elseif ($body == 4) { |
|
430 | 430 | $recess = 'Autumn Recess'; |
431 | - } elseif ($body==5) { |
|
431 | + } elseif ($body == 5) { |
|
432 | 432 | $recess = 'Halloween Recess'; |
433 | 433 | } |
434 | 434 | break; |
@@ -438,12 +438,12 @@ discard block |
||
438 | 438 | } |
439 | 439 | if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) { |
440 | 440 | $to = "$year-$month-" . $dates[$year][$month]['less']; |
441 | - if ($month==1) { |
|
442 | - $from = ($year-1)."-12-" . $dates[$year-1][12]['more']; |
|
441 | + if ($month == 1) { |
|
442 | + $from = ($year - 1) . "-12-" . $dates[$year - 1][12]['more']; |
|
443 | 443 | } else { |
444 | - for ($newmonth = $month-1; $newmonth>=1; $newmonth--) { |
|
444 | + for ($newmonth = $month - 1; $newmonth >= 1; $newmonth--) { |
|
445 | 445 | if (isset($dates[$year][$newmonth]['more'])) { |
446 | - $from = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['more']; |
|
446 | + $from = "$year-" . ($newmonth) . "-" . $dates[$year][$newmonth]['more']; |
|
447 | 447 | break; |
448 | 448 | } |
449 | 449 | } |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | } |
452 | 452 | if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) { |
453 | 453 | $from = "$year-$month-" . $dates[$year][$month]['more']; |
454 | - if ($month==12) { |
|
455 | - $to = ($year+1)."-01-" . $dates[$year+1][1]['less']; |
|
454 | + if ($month == 12) { |
|
455 | + $to = ($year + 1) . "-01-" . $dates[$year + 1][1]['less']; |
|
456 | 456 | } else { |
457 | - for ($newmonth = $month+1; $newmonth<=12; $newmonth++) { |
|
457 | + for ($newmonth = $month + 1; $newmonth <= 12; $newmonth++) { |
|
458 | 458 | if (isset($dates[$year][$newmonth]['less'])) { |
459 | - $to = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['less']; |
|
459 | + $to = "$year-" . ($newmonth) . "-" . $dates[$year][$newmonth]['less']; |
|
460 | 460 | break; |
461 | 461 | } |
462 | 462 | } |
@@ -21,20 +21,20 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | // This handles basic insertion and approval functions for all epobjects |
24 | -include_once INCLUDESPATH."easyparliament/searchengine.php"; |
|
24 | +include_once INCLUDESPATH . "easyparliament/searchengine.php"; |
|
25 | 25 | |
26 | 26 | class GLOSSARY { |
27 | 27 | |
28 | - public $num_terms; // how many glossary entries do we have |
|
28 | + public $num_terms; // how many glossary entries do we have |
|
29 | 29 | // (changes depending on how GLOSSARY is called |
30 | - public $hansard_count; // how many times does the phrase appear in hansard? |
|
31 | - public $query; // search term |
|
32 | - public $glossary_id; // if this is set then we only have 1 glossary term |
|
33 | - public $current_term; // will only be set if we have a valid epobject_id |
|
30 | + public $hansard_count; // how many times does the phrase appear in hansard? |
|
31 | + public $query; // search term |
|
32 | + public $glossary_id; // if this is set then we only have 1 glossary term |
|
33 | + public $current_term; // will only be set if we have a valid epobject_id |
|
34 | 34 | public $current_letter; |
35 | 35 | |
36 | 36 | // constructor... |
37 | - public function __construct($args=array()) { |
|
37 | + public function __construct($args = array()) { |
|
38 | 38 | // We can optionally start the glossary with one of several arguments |
39 | 39 | // 1. glossary_id - treat the glossary as a single term |
40 | 40 | // 2. glossary_term - search within glossary for a term |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | |
74 | 74 | // These stop stupid submissions. |
75 | 75 | // everything should be lowercase. |
76 | - $this->stopwords = array( "the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate" ); |
|
76 | + $this->stopwords = array("the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate"); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - public function get_glossary_item($args=array()) { |
|
80 | + public function get_glossary_item($args = array()) { |
|
81 | 81 | // Search for and fetch glossary item with title or glossary_id |
82 | 82 | // We could also search glossary text that contains the title text, for cross references |
83 | 83 | |
84 | 84 | $this->alphabet = array(); |
85 | - foreach (range ("A", "Z") as $letter) { |
|
85 | + foreach (range("A", "Z") as $letter) { |
|
86 | 86 | $this->alphabet[$letter] = array(); |
87 | 87 | } |
88 | 88 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - public function search_glossary($args=array()) { |
|
140 | + public function search_glossary($args = array()) { |
|
141 | 141 | // Search for and fetch glossary item with a title |
142 | 142 | // Useful for the search page, and nowhere else (so far) |
143 | 143 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | global $THEUSER; |
190 | 190 | |
191 | 191 | if ($data['title'] == '') { |
192 | - error ("Sorry, you can't define a term without a title"); |
|
192 | + error("Sorry, you can't define a term without a title"); |
|
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | 196 | if ($data['body'] == '') { |
197 | - error ("You haven't entered a definition!"); |
|
197 | + error("You haven't entered a definition!"); |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | - public function glossarise($body, $tokenize=0, $urlize=0) { |
|
250 | + public function glossarise($body, $tokenize = 0, $urlize = 0) { |
|
251 | 251 | // Turn a body of text into a link-up wonderland of glossary joy |
252 | 252 | |
253 | 253 | global $this_page; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $replacewords[] = "<strong>\\1</strong>"; |
291 | 291 | } else { |
292 | 292 | if ($this_page == "admin_glossary") { |
293 | - $link_url = "#gl".$glossary_id; |
|
293 | + $link_url = "#gl" . $glossary_id; |
|
294 | 294 | } else { |
295 | 295 | $link_url = $URL->generate('url'); |
296 | 296 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | if ($p_id) { |
30 | 30 | $qq = $db->query('(select hansard.epobject_id from hansard, uservotes |
31 | 31 | where hansard.epobject_id=uservotes.epobject_id |
32 | - and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate()) |
|
32 | + and hansard.person_id = '.$p_id . ' and major=3 and minor=2 and left_house>curdate()) |
|
33 | 33 | union |
34 | 34 | (select hansard.epobject_id from hansard,member,anonvotes |
35 | 35 | where hansard.epobject_id=anonvotes.epobject_id |
36 | - and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate())'); |
|
36 | + and hansard.person_id = '.$p_id . ' and major=3 and minor=2 and left_house>curdate())'); |
|
37 | 37 | $wrans_with_votes = $qq->rows(); |
38 | 38 | } else { |
39 | 39 | $wrans_with_votes = ''; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | if (is_null($yes)) { |
35 | 35 | $votes[$dept]['none']++; |
36 | 36 | } else { |
37 | - if ($no > $yes+10) { |
|
37 | + if ($no > $yes + 10) { |
|
38 | 38 | $votes[$dept]['verymoreno']++; |
39 | 39 | } elseif ($no > $yes) { |
40 | 40 | $votes[$dept]['moreno']++; |
@@ -25,9 +25,11 @@ |
||
25 | 25 | $votes = array(); |
26 | 26 | while ($row = mysql_fetch_assoc($q)) { |
27 | 27 | $dept = $row['body']; |
28 | - if (!isset($votes[$dept])) $votes[$dept] = array( |
|
28 | + if (!isset($votes[$dept])) { |
|
29 | + $votes[$dept] = array( |
|
29 | 30 | 'verymoreyes'=>0, 'moreyes'=>0, 'verymoreno'=>0, 'moreno'=>0, 'same'=>0, 'none'=>0 |
30 | 31 | ); |
32 | + } |
|
31 | 33 | $yes = $row['yes_votes']; |
32 | 34 | $no = $row['no_votes']; |
33 | 35 | $gid = $row['gid']; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | and party != '' |
138 | 138 | order by entered_house |
139 | 139 | " . $direction, array(":house" => $house, |
140 | - ":person_id" => $person_id))->first(); |
|
140 | + ":person_id" => $person_id))->first(); |
|
141 | 141 | if ($row) { |
142 | 142 | $party = $row["party"]; |
143 | 143 | if ( $party == 'Labour/Co-operative' ) { |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | - * Image |
|
230 | - * |
|
231 | - * Return a URL for the member's image. |
|
232 | - * |
|
233 | - * @return string The URL of the member's image. |
|
234 | - */ |
|
229 | + * Image |
|
230 | + * |
|
231 | + * Return a URL for the member's image. |
|
232 | + * |
|
233 | + * @return string The URL of the member's image. |
|
234 | + */ |
|
235 | 235 | |
236 | 236 | public function image() { |
237 | 237 | |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
287 | - * Offices |
|
288 | - * |
|
289 | - * Return an array of Office objects held (or previously held) by the member. |
|
290 | - * |
|
291 | - * @param string $include_only Restrict the list to include only "previous" or "current" offices. |
|
292 | - * @param bool $ignore_committees Ignore offices that appear to be committee memberships. |
|
293 | - * |
|
294 | - * @return array An array of Office objects. |
|
295 | - */ |
|
287 | + * Offices |
|
288 | + * |
|
289 | + * Return an array of Office objects held (or previously held) by the member. |
|
290 | + * |
|
291 | + * @param string $include_only Restrict the list to include only "previous" or "current" offices. |
|
292 | + * @param bool $ignore_committees Ignore offices that appear to be committee memberships. |
|
293 | + * |
|
294 | + * @return array An array of Office objects. |
|
295 | + */ |
|
296 | 296 | |
297 | 297 | public function offices($include_only = null, $ignore_committees = false) { |
298 | 298 | |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | - * Get Other Parties String |
|
350 | - * |
|
351 | - * Return a readable list of party changes for this member. |
|
352 | - * |
|
353 | - * @return string|null A readable list of the party changes for this member. |
|
354 | - */ |
|
349 | + * Get Other Parties String |
|
350 | + * |
|
351 | + * Return a readable list of party changes for this member. |
|
352 | + * |
|
353 | + * @return string|null A readable list of the party changes for this member. |
|
354 | + */ |
|
355 | 355 | |
356 | 356 | public function getOtherPartiesString() { |
357 | 357 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
373 | - * Get Other Constituencies String |
|
374 | - * |
|
375 | - * Return a readable list of other constituencies for this member. |
|
376 | - * |
|
377 | - * @return string|null A readable list of the other constituencies for this member. |
|
378 | - */ |
|
373 | + * Get Other Constituencies String |
|
374 | + * |
|
375 | + * Return a readable list of other constituencies for this member. |
|
376 | + * |
|
377 | + * @return string|null A readable list of the other constituencies for this member. |
|
378 | + */ |
|
379 | 379 | |
380 | 380 | public function getOtherConstituenciesString() { |
381 | 381 | |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
391 | - * Get Entered/Left Strings |
|
392 | - * |
|
393 | - * Return an array of readable strings covering when people entered or left |
|
394 | - * various houses. Returns an array since it's possible for a member to have |
|
395 | - * done several of these things. |
|
396 | - * |
|
397 | - * @return array An array of strings of when this member entered or left houses. |
|
398 | - */ |
|
391 | + * Get Entered/Left Strings |
|
392 | + * |
|
393 | + * Return an array of readable strings covering when people entered or left |
|
394 | + * various houses. Returns an array since it's possible for a member to have |
|
395 | + * done several of these things. |
|
396 | + * |
|
397 | + * @return array An array of strings of when this member entered or left houses. |
|
398 | + */ |
|
399 | 399 | public function getEnterLeaveStrings() { |
400 | 400 | $output = array(); |
401 | 401 |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | return $direction; |
92 | 92 | } |
93 | 93 | |
94 | - public function currentPartyComparison(){ |
|
94 | + public function currentPartyComparison() { |
|
95 | 95 | # Simplify the current party when being compared to the original |
96 | 96 | # Stops co-op and labour being seen as different |
97 | 97 | $party = $this->party; |
98 | - if ( $party == 'Labour/Co-operative' ) { |
|
98 | + if ($party == 'Labour/Co-operative') { |
|
99 | 99 | $party = 'Labour'; |
100 | 100 | } |
101 | 101 | return $party; |
102 | 102 | } |
103 | 103 | |
104 | - public function cohortParty($house = HOUSE_TYPE_COMMONS){ |
|
104 | + public function cohortParty($house = HOUSE_TYPE_COMMONS) { |
|
105 | 105 | // The party being compared against for party comparison purposes |
106 | 106 | // Unless specified by the condition in cohortPartyComparisonDirection |
107 | 107 | // This is the first, not last, party a person has. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | ":person_id" => $person_id))->first(); |
127 | 127 | if ($row) { |
128 | 128 | $party = $row["party"]; |
129 | - if ( $party == 'Labour/Co-operative' ) { |
|
129 | + if ($party == 'Labour/Co-operative') { |
|
130 | 130 | $party = 'Labour'; |
131 | 131 | } elseif ($party == 'Sinn Féin') { |
132 | 132 | $party = 'Sinn Fein'; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $now = new \DateTime(); |
157 | 157 | |
158 | 158 | $diff = $date_entered->diff($now); |
159 | - if ( $diff->y == 0 && $diff->m <= 6 ) { |
|
159 | + if ($diff->y == 0 && $diff->m <= 6) { |
|
160 | 160 | return true; |
161 | 161 | } |
162 | 162 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | $entered_house = $this->entered_house($house); |
179 | 179 | |
180 | - if ( $entered_house ) { |
|
180 | + if ($entered_house) { |
|
181 | 181 | $date_entered = $entered_house['date']; |
182 | 182 | } |
183 | 183 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | $left_house = $this->left_house($house); |
199 | 199 | |
200 | - if ( $left_house ) { |
|
200 | + if ($left_house) { |
|
201 | 201 | $date_left = $left_house['date']; |
202 | 202 | } |
203 | 203 | |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | |
226 | 226 | $is_lord = $this->house(HOUSE_TYPE_LORDS); |
227 | 227 | if ($is_lord) { |
228 | - list($image,$size) = Utility\Member::findMemberImage($this->person_id(), false, 'lord'); |
|
228 | + list($image, $size) = Utility\Member::findMemberImage($this->person_id(), false, 'lord'); |
|
229 | 229 | } else { |
230 | - list($image,$size) = Utility\Member::findMemberImage($this->person_id(), false, true); |
|
230 | + list($image, $size) = Utility\Member::findMemberImage($this->person_id(), false, true); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // We can determine if the image exists or not by testing if size is set |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | |
251 | 251 | usort( |
252 | 252 | $departures, |
253 | - function ($a, $b) { |
|
254 | - if ( $a['date'] == $b['date'] ) { |
|
253 | + function($a, $b) { |
|
254 | + if ($a['date'] == $b['date']) { |
|
255 | 255 | return 0; |
256 | - } else if ( $a['date'] < $b['date'] ) { |
|
256 | + } else if ($a['date'] < $b['date']) { |
|
257 | 257 | return -1; |
258 | 258 | } else { |
259 | 259 | return 1; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $office = $office['office']; |
292 | 292 | |
293 | 293 | foreach ($office as $row) { |
294 | - if ( $officeObject = $this->getOfficeObject($include_only, $ignore_committees, $row) ) { |
|
294 | + if ($officeObject = $this->getOfficeObject($include_only, $ignore_committees, $row)) { |
|
295 | 295 | $out[] = $officeObject; |
296 | 296 | } |
297 | 297 | } |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | private function entered_house_line($house, $house_name) { |
431 | 431 | if (isset($this->entered_house[$house]['date'])) { |
432 | 432 | $string = "<strong>"; |
433 | - if (strlen($this->entered_house[$house]['date_pretty'])==4) { |
|
433 | + if (strlen($this->entered_house[$house]['date_pretty']) == 4) { |
|
434 | 434 | $string .= sprintf(gettext("Entered the %s in %s"), $house_name, $this->entered_house[$house]['date_pretty']); |
435 | 435 | } else { |
436 | 436 | $string .= sprintf(gettext("Entered the %s on %s"), $house_name, $this->entered_house[$house]['date_pretty']); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | private function left_house_line($house, $house_name) { |
447 | 447 | if ($this->house($house) && !$this->current_member($house)) { |
448 | 448 | $string = "<strong>"; |
449 | - if (strlen($this->left_house[$house]['date_pretty'])==4) { |
|
449 | + if (strlen($this->left_house[$house]['date_pretty']) == 4) { |
|
450 | 450 | $string .= sprintf(gettext("Left the %s in %s"), $house_name, $this->left_house[$house]['date_pretty']); |
451 | 451 | } else { |
452 | 452 | $string .= sprintf(gettext("Left the %s on %s"), $house_name, $this->left_house[$house]['date_pretty']); |
@@ -463,12 +463,12 @@ discard block |
||
463 | 463 | $policy_diffs = array(); |
464 | 464 | $party_positions = $partyCohort->getAllPolicyPositions($policiesList); |
465 | 465 | |
466 | - if ( !$party_positions ) { |
|
466 | + if (!$party_positions) { |
|
467 | 467 | return $policy_diffs; |
468 | 468 | } |
469 | 469 | |
470 | - foreach ( $positions->positionsById as $policy_id => $details ) { |
|
471 | - if ( $details['has_strong'] && $details['score'] != -1 && isset($party_positions[$policy_id])) { |
|
470 | + foreach ($positions->positionsById as $policy_id => $details) { |
|
471 | + if ($details['has_strong'] && $details['score'] != -1 && isset($party_positions[$policy_id])) { |
|
472 | 472 | $mp_score = $details['score']; |
473 | 473 | $party_position = $party_positions[$policy_id]; |
474 | 474 | $party_score = $party_position['score']; |
@@ -500,18 +500,18 @@ discard block |
||
500 | 500 | return $policy_diffs; |
501 | 501 | } |
502 | 502 | |
503 | - private function calculatePolicyDiffScore( $mp_score, $party_score ) { |
|
503 | + private function calculatePolicyDiffScore($mp_score, $party_score) { |
|
504 | 504 | $score_diff = abs($mp_score - $party_score); |
505 | 505 | // if they are on opposite sides of mixture of for and against |
506 | 506 | if ( |
507 | - ( $mp_score < 0.4 && $party_score > 0.6 ) || |
|
508 | - ( $mp_score > 0.6 && $party_score < 0.4 ) |
|
507 | + ($mp_score < 0.4 && $party_score > 0.6) || |
|
508 | + ($mp_score > 0.6 && $party_score < 0.4) |
|
509 | 509 | ) { |
510 | 510 | $score_diff += 2; |
511 | 511 | // if on is mixture of for and against and one is for/against |
512 | 512 | } else if ( |
513 | - ( $mp_score > 0.4 && $mp_score < 0.6 && ( $party_score > 0.6 || $party_score < 0.4 ) ) || |
|
514 | - ( $party_score > 0.4 && $party_score < 0.6 && ( $mp_score > 0.6 || $mp_score < 0.4 ) ) |
|
513 | + ($mp_score > 0.4 && $mp_score < 0.6 && ($party_score > 0.6 || $party_score < 0.4)) || |
|
514 | + ($party_score > 0.4 && $party_score < 0.6 && ($mp_score > 0.6 || $mp_score < 0.4)) |
|
515 | 515 | ) { |
516 | 516 | $score_diff += 1; |
517 | 517 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | $mreg = array(); |
526 | 526 | $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($postcode); |
527 | - if ( isset($constituencies[$type]) ) { |
|
527 | + if (isset($constituencies[$type])) { |
|
528 | 528 | $cons_name = $constituencies[$type]; |
529 | 529 | $query_base = "SELECT member.person_id, title, lordofname, given_name, family_name, constituency, house |
530 | 530 | FROM member, person_names |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | ':cons_name' => $cons_name |
542 | 542 | ) |
543 | 543 | ); |
544 | - if ( !$q->rows() && ($dissolution = Dissolution::db()) ) { |
|
544 | + if (!$q->rows() && ($dissolution = Dissolution::db())) { |
|
545 | 545 | $q = $db->query("$query_base AND $dissolution[query]", |
546 | 546 | array( |
547 | 547 | ':house' => $house, |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | } |
566 | 566 | |
567 | 567 | public static function getRepNameForHouse($house) { |
568 | - switch ( $house ) { |
|
568 | + switch ($house) { |
|
569 | 569 | case HOUSE_TYPE_COMMONS: |
570 | 570 | $name = 'MP'; |
571 | 571 | break; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $file = _load_file($_); |
68 | 68 | $date = preg_replace("#$dir/regmem(.*?)\.xml#", '$1', $_); |
69 | 69 | $data[$_] = array(); |
70 | - if (preg_match('#<regmem personid="uk.org.publicwhip/person/'.$p.'" (?:memberid="(.*?)" )?membername="(.*?)" date="(.*?)">(.*?)</regmem>#s', $file, $m)) { |
|
70 | + if (preg_match('#<regmem personid="uk.org.publicwhip/person/' . $p . '" (?:memberid="(.*?)" )?membername="(.*?)" date="(.*?)">(.*?)</regmem>#s', $file, $m)) { |
|
71 | 71 | $earliest = $_; |
72 | 72 | if (!$name) { |
73 | 73 | $name = $m[2]; |
@@ -103,21 +103,21 @@ discard block |
||
103 | 103 | break; |
104 | 104 | } |
105 | 105 | $date_pre = preg_replace("#$dir/regmem(.*?)\.xml#", '$1', $_); |
106 | - $date_post = preg_replace("#$dir/regmem(.*?)\.xml#", '$1', $files[$i+1]); |
|
106 | + $date_post = preg_replace("#$dir/regmem(.*?)\.xml#", '$1', $files[$i + 1]); |
|
107 | 107 | $pretty = format_date($date_pre, LONGDATEFORMAT); |
108 | 108 | $oout = ''; |
109 | 109 | foreach ($data[$_] as $cat_type => $cat_data) { |
110 | - $old = array_key_exists($cat_type, $data[$files[$i+1]]) ? $data[$files[$i+1]][$cat_type] : ''; |
|
110 | + $old = array_key_exists($cat_type, $data[$files[$i + 1]]) ? $data[$files[$i + 1]][$cat_type] : ''; |
|
111 | 111 | $new = $data[$_][$cat_type]; |
112 | 112 | if ($diff = clean_diff($old, $new)) { |
113 | 113 | $oout .= cat_heading($cat_type, $date_pre, $date_post) . $diff; |
114 | 114 | } |
115 | 115 | } |
116 | - foreach ($data[$files[$i+1]] as $cat_type => $cat_data) { |
|
116 | + foreach ($data[$files[$i + 1]] as $cat_type => $cat_data) { |
|
117 | 117 | if (array_key_exists($cat_type, $data[$_])) { |
118 | 118 | continue; |
119 | 119 | } |
120 | - if ($diff = clean_diff($data[$files[$i+1]][$cat_type], '')) { |
|
120 | + if ($diff = clean_diff($data[$files[$i + 1]][$cat_type], '')) { |
|
121 | 121 | $oout .= cat_heading($cat_type, $date_pre, $date_post) . $diff; |
122 | 122 | } |
123 | 123 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | if ($f) { |
150 | 150 | $f = "$dir/regmem$f.xml"; |
151 | 151 | $count = count($files); |
152 | - for ($i=0; $i<$count; ++$i) { |
|
152 | + for ($i = 0; $i < $count; ++$i) { |
|
153 | 153 | if ($files[$i] == $f) { |
154 | 154 | $new = $i; |
155 | 155 | break; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
159 | - $old = $new+1; |
|
159 | + $old = $new + 1; |
|
160 | 160 | $old = $files[$old]; |
161 | 161 | $old_iso = preg_replace("#$dir/regmem(.*?)\.xml#", '$1', $old); |
162 | 162 | $old_pretty = format_date($old_iso, LONGDATEFORMAT); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $old = _load_file($old); |
167 | 167 | $new = _load_file($new); |
168 | 168 | |
169 | - $DATA->set_page_metadata($this_page, 'heading', 'Changes from '.$old_pretty.' to '.$new_pretty); |
|
169 | + $DATA->set_page_metadata($this_page, 'heading', 'Changes from ' . $old_pretty . ' to ' . $new_pretty); |
|
170 | 170 | $PAGE->stripe_start(); |
171 | 171 | print $link; |
172 | 172 | $data = array(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $out .= clean_diff($old, $new); |
189 | 189 | } |
190 | 190 | if ($out) { |
191 | - print span_row('<h2>'.$names[$person_id].' - <a href="?p='.$person_id.'">Register history</a> | <a href="/mp/?pid='.$person_id.'">MP’s page</a></h2>', true) . $out; |
|
191 | + print span_row('<h2>' . $names[$person_id] . ' - <a href="?p=' . $person_id . '">Register history</a> | <a href="/mp/?pid=' . $person_id . '">MP’s page</a></h2>', true) . $out; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | print '</table>'; |
@@ -245,28 +245,28 @@ discard block |
||
245 | 245 | $c = 0; $year = 0; |
246 | 246 | $view = ''; $compare = ''; |
247 | 247 | $count = count($files); |
248 | - for ($i=0; $i<$count; ++$i) { |
|
248 | + for ($i = 0; $i < $count; ++$i) { |
|
249 | 249 | preg_match('/(\d\d\d\d)-(\d\d-\d\d)/', $files[$i], $m); |
250 | 250 | $y = $m[1]; $md = $m[2]; |
251 | 251 | if ($c++) { |
252 | 252 | $view .= ' | '; |
253 | - if ($i < $count-1) { |
|
253 | + if ($i < $count - 1) { |
|
254 | 254 | $compare .= ' | '; |
255 | 255 | } |
256 | 256 | } |
257 | 257 | if ($year != $y) { |
258 | 258 | $year = $y; |
259 | 259 | $view .= "<em>$year</em> "; |
260 | - if ($i < $count-1) { |
|
260 | + if ($i < $count - 1) { |
|
261 | 261 | $compare .= "<em>$year</em> "; |
262 | 262 | } |
263 | 263 | } |
264 | 264 | $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
265 | 265 | preg_match('/(\d\d)-(\d\d)/', $md, $m); |
266 | - $date = ($m[2]+0) . ' '. $months[$m[1]-1]; |
|
267 | - $view .= '<a href="./?d='.$y.'-'.$md.'">'.$date.'</a>'; |
|
268 | - if ($i < $count-1) { |
|
269 | - $compare .= '<a href="?f='.$y.'-'.$md.'">'.$date.'</a>'; |
|
266 | + $date = ($m[2] + 0) . ' ' . $months[$m[1] - 1]; |
|
267 | + $view .= '<a href="./?d=' . $y . '-' . $md . '">' . $date . '</a>'; |
|
268 | + if ($i < $count - 1) { |
|
269 | + $compare .= '<a href="?f=' . $y . '-' . $md . '">' . $date . '</a>'; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | ?> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | <?php |
283 | 283 | uasort($names, 'by_name'); |
284 | 284 | foreach ($names as $_ => $value) { |
285 | - print '<li><a href="?p='.$_.'">'.$value.'</a>'; |
|
285 | + print '<li><a href="?p=' . $_ . '">' . $value . '</a>'; |
|
286 | 286 | } |
287 | 287 | print '</ul>'; |
288 | 288 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $data = array(); |
301 | 301 | parse_file($d, $d_iso, 'only', $data); |
302 | 302 | $this_page = 'regmem_date'; |
303 | - $DATA->set_page_metadata($this_page, 'heading', "The Register of Members' Interests, $d_pretty");; |
|
303 | + $DATA->set_page_metadata($this_page, 'heading', "The Register of Members' Interests, $d_pretty"); ; |
|
304 | 304 | $PAGE->stripe_start(); |
305 | 305 | print $link; |
306 | 306 | ?> |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | foreach ($v as $cat_type => $vv) { |
315 | 315 | $out .= cat_heading($cat_type, $d_iso, $d_iso, false); |
316 | 316 | $d = (array_key_exists('only', $data[$person_id][$cat_type]) ? $data[$person_id][$cat_type]['only'] : ''); |
317 | - $out .= prettify($d)."\n"; |
|
317 | + $out .= prettify($d) . "\n"; |
|
318 | 318 | } |
319 | 319 | if ($out) { |
320 | 320 | print '<div class="block">'; |
@@ -364,8 +364,8 @@ discard block |
||
364 | 364 | if (!count($r) && !count($a)) { |
365 | 365 | return ''; |
366 | 366 | } |
367 | - $r = join("\n", $r); $r = $r ? '<td class="r"><ul>'.$r.'</ul></td>' : '<td> </td>'; |
|
368 | - $a = join("\n", $a); $a = $a ? '<td class="a"><ul>'.$a.'</ul></td>' : '<td> </td>'; |
|
367 | + $r = join("\n", $r); $r = $r ? '<td class="r"><ul>' . $r . '</ul></td>' : '<td> </td>'; |
|
368 | + $a = join("\n", $a); $a = $a ? '<td class="a"><ul>' . $a . '</ul></td>' : '<td> </td>'; |
|
369 | 369 | $diff = '<tr>' . $r . $a . '</tr>'; |
370 | 370 | $diff = preg_replace('#<item.*?>(.*?)</item>#', '<li>$1</li>', $diff); |
371 | 371 | return $diff; |