Completed
Pull Request — master (#1450)
by Nick
06:22
created
www/docs/random/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,5 +11,5 @@
 block discarded – undo
11 11
 $gid = fix_gid_from_db($gid);
12 12
 
13 13
 $URL = new \MySociety\TheyWorkForYou\Url('debates');
14
-$URL->insert( array( 'id' => $gid ) );
14
+$URL->insert(array('id' => $gid));
15 15
 header('Location: ' . $URL->generate());
Please login to merge, or discard this patch.
www/docs/postcode/index.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
16 16
 if (!validate_postcode($pc)) {
17
-    twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
17
+    twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
18 18
     postcode_error("Sorry, " . _htmlentities($pc) . " isn't a valid postcode");
19 19
 }
20 20
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     exit;
58 58
 }
59 59
 
60
-function fetch_mp($pc, $constituencies, $house=null) {
60
+function fetch_mp($pc, $constituencies, $house = null) {
61 61
     global $THEUSER;
62 62
     $args = array('constituency' => $constituencies['WMC']);
63 63
     if ($house) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
     try {
67 67
         $MEMBER = new MEMBER($args);
68
-    } catch (MySociety\TheyWorkForYou\MemberException $e){
68
+    } catch (MySociety\TheyWorkForYou\MemberException $e) {
69 69
         postcode_error($e->getMessage());
70 70
     }
71 71
     if ($MEMBER->person_id()) {
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
     foreach ($q as $row) {
112 112
         $house = $row['house'];
113 113
         $cons = $row['constituency'];
114
-        if ($house==3) {
114
+        if ($house == 3) {
115 115
             $mreg[] = $row;
116
-        } elseif ($house==4) {
116
+        } elseif ($house == 4) {
117 117
             if ($cons == $areas['SPC']) {
118 118
                 $mcon = $row;
119 119
             } elseif ($cons == $areas['SPE']) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $out .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, ' . $mcon['constituency'] . '</li>';
139 139
     }
140 140
     $out .= '<li>Your <strong>' . $areas[$area_type] . ' ' . $rep_type . 's</strong> ';
141
-    if ($rep_type=='MLA') $out .= '(Members of the Legislative Assembly)';
141
+    if ($rep_type == 'MLA') $out .= '(Members of the Legislative Assembly)';
142 142
     $out .= ' ' . ($current ? 'are' : 'were') . ':';
143 143
     $out .= '<ul>';
144 144
     foreach ($mreg as $reg) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,9 @@  discard block
 block discarded – undo
89 89
     $mp = array();
90 90
     if ($q) {
91 91
         $mp = $q;
92
-        if ($mp['left_house'] != '9999-12-31') $mp['former'] = true;
92
+        if ($mp['left_house'] != '9999-12-31') {
93
+            $mp['former'] = true;
94
+        }
93 95
     }
94 96
 
95 97
     $a = array_values($areas);
@@ -128,7 +130,9 @@  discard block
 block discarded – undo
128 130
     $out = '';
129 131
     $out .= '<p>That postcode has multiple results, please pick who you are interested in:</p>';
130 132
     $out .= '<ul><li>Your ';
131
-    if (isset($mp['former'])) $out .= 'former ';
133
+    if (isset($mp['former'])) {
134
+        $out .= 'former ';
135
+    }
132 136
     $out .= '<strong>MP</strong> (Member of Parliament) is <a href="/mp/?p=' . $mp['person_id'] . '">';
133 137
     $out .= $mp['given_name'] . ' ' . $mp['family_name'] . '</a>, ' . $mp['constituency'] . '</li>';
134 138
     if ($mcon) {
@@ -138,7 +142,9 @@  discard block
 block discarded – undo
138 142
         $out .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, ' . $mcon['constituency'] . '</li>';
139 143
     }
140 144
     $out .= '<li>Your <strong>' . $areas[$area_type] . ' ' . $rep_type . 's</strong> ';
141
-    if ($rep_type=='MLA') $out .= '(Members of the Legislative Assembly)';
145
+    if ($rep_type=='MLA') {
146
+        $out .= '(Members of the Legislative Assembly)';
147
+    }
142 148
     $out .= ' ' . ($current ? 'are' : 'were') . ':';
143 149
     $out .= '<ul>';
144 150
     foreach ($mreg as $reg) {
Please login to merge, or discard this patch.
scripts/video-speed.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
         $gid = $row['gid'];
24 24
         $atime = $row['atime'];
25 25
         $body = strip_tags($row['body']);
26
-        $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos+1) . ' group by video_timestamps.gid')->first();
26
+        $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos + 1) . ' group by video_timestamps.gid')->first();
27 27
         $next_atime = $qq['atime'];
28 28
         if (!$next_atime) continue;
29 29
         $duration = $next_atime - $atime;
30
-        if ($duration<=0) continue;
30
+        if ($duration <= 0) continue;
31 31
         $words = preg_split('/\W+/', $body, -1, PREG_SPLIT_NO_EMPTY);
32 32
         $num_words = count($words);
33
-        $speed = $num_words / ($duration/60);
33
+        $speed = $num_words / ($duration / 60);
34 34
         $total_speed += $speed;
35 35
         print "$gid, $num_words words, from $atime to $next_atime, duration $duration s, speed $speed wpm\n";
36 36
         $total += $duration;
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
         $num++;
39 39
     }
40 40
 
41
-    $total_min = $total/60;
41
+    $total_min = $total / 60;
42 42
 
43 43
     print "Person ID $spid\n";
44
-    print "Average length = " . ($total/$num) . "s\n";
45
-    print "Average speed = " . ($total_words/$total_min) . "wpm\n";
46
-    print "Average of speeds = " . ($total_speed/$num) . "wpm\n";
44
+    print "Average length = " . ($total / $num) . "s\n";
45
+    print "Average speed = " . ($total_words / $total_min) . "wpm\n";
46
+    print "Average of speeds = " . ($total_speed / $num) . "wpm\n";
47 47
     print "\n";
48 48
 }
49 49
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,9 +25,13 @@
 block discarded – undo
25 25
         $body = strip_tags($row['body']);
26 26
         $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos+1) . ' group by video_timestamps.gid')->first();
27 27
         $next_atime = $qq['atime'];
28
-        if (!$next_atime) continue;
28
+        if (!$next_atime) {
29
+            continue;
30
+        }
29 31
         $duration = $next_atime - $atime;
30
-        if ($duration<=0) continue;
32
+        if ($duration<=0) {
33
+            continue;
34
+        }
31 35
         $words = preg_split('/\W+/', $body, -1, PREG_SPLIT_NO_EMPTY);
32 36
         $num_words = count($words);
33 37
         $speed = $num_words / ($duration/60);
Please login to merge, or discard this patch.
www/includes/easyparliament/commentreportlist.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         // available for editing, it's accurate.
25 25
         $this->_update_locked();
26 26
 
27
-        $data = $this->_get_data_by_recent ();
27
+        $data = $this->_get_data_by_recent();
28 28
 
29 29
         $this->render($data);
30 30
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $data = array();
99 99
         foreach ($q as $row) {
100
-            $data[] = array (
100
+            $data[] = array(
101 101
                 'report_id'		=> $row['report_id'],
102 102
                 'comment_id' 	=> $row['comment_id'],
103 103
                 'firstname'		=> $row['firstname'],
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             );
109 109
         }
110 110
         foreach ($r as $row) {
111
-            $data[] = array (
111
+            $data[] = array(
112 112
                 'report_id'		=> $row['report_id'],
113 113
                 'comment_id' 	=> $row['comment_id'],
114 114
                 'firstname'		=> $row['firstname'],
Please login to merge, or discard this patch.
www/includes/easyparliament/sidebars/calendar_future.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 list($firstyear, $firstmonth, $day) = explode('-', $min_future_date);
34 34
 list($finalyear, $finalmonth, $day) = explode('-', $max_future_date);
35 35
 
36
-$q =  $db->query("SELECT DISTINCT(event_date) AS event_date FROM future
36
+$q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future
37 37
     WHERE event_date >= :firstdate
38 38
     AND event_date <= :finaldate
39 39
     AND deleted = 0
Please login to merge, or discard this patch.
www/includes/easyparliament/hansardlist.php 3 patches
Spacing   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH."easyparliament/searchengine.php";
4
-include_once INCLUDESPATH."easyparliament/searchlog.php";
3
+include_once INCLUDESPATH . "easyparliament/searchengine.php";
4
+include_once INCLUDESPATH . "easyparliament/searchlog.php";
5 5
 
6 6
 /*
7 7
 
@@ -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 = array ();
56
+    public $speakers = array();
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 = array ();
69
+    public $epobjectid_to_gid = array();
70 70
     /*
71 71
     $this->epobjectid_to_gid[ $epobject_id ] => $gid;
72 72
     */
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 
116 116
 
117
-    public function display ($view, $args=array(), $format='html') {
117
+    public function display($view, $args = array(), $format = 'html') {
118 118
 
119 119
         // $view is what we're viewing by:
120 120
         // 	'gid' is the gid of a hansard object,
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
         if ($view == 'search' && (!defined('FRONT_END_SEARCH') || !FRONT_END_SEARCH))
142 142
             return false;
143 143
 
144
-        $validviews = array ('calendar', 'date', 'gid', 'person', 'search', 'search_video', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid');
144
+        $validviews = array('calendar', 'date', 'gid', 'person', 'search', 'search_video', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid');
145 145
         if (in_array($view, $validviews)) {
146 146
 
147 147
             // What function do we call for this view?
148
-            $function = '_get_data_by_'.$view;
148
+            $function = '_get_data_by_' . $view;
149 149
             // Get all the data that's to be rendered.
150 150
             $data = $this->$function($args);
151 151
 
152 152
         } else {
153 153
             // Don't have a valid $view.
154
-            $PAGE->error_message ("You haven't specified a view type.");
154
+            $PAGE->error_message("You haven't specified a view type.");
155 155
             return false;
156 156
         }
157 157
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 
174 174
 
175
-    public function render($view, $data, $format='html') {
175
+    public function render($view, $data, $format = 'html') {
176 176
         // Once we have the data that's to be rendered,
177 177
         // include the template.
178 178
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             return $data;
182 182
         }
183 183
 
184
-        include (INCLUDESPATH."easyparliament/templates/$format/hansard_$view" . ".php");
184
+        include (INCLUDESPATH . "easyparliament/templates/$format/hansard_$view" . ".php");
185 185
         return true;
186 186
 
187 187
     }
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
             $hdate = $q['hdate'];
227 227
             if ($hdate) {
228 228
                 $URL = new \MySociety\TheyWorkForYou\Url($this->listpage);
229
-                $URL->insert( array('d'=>$hdate) );
229
+                $URL->insert(array('d'=>$hdate));
230 230
 
231 231
                 // Work out a timestamp which is handy for comparing to now.
232 232
                 list($year, $month, $date) = explode('-', $hdate);
233
-                $timestamp = gmmktime (0, 0, 0, $month, $date, $year);
233
+                $timestamp = gmmktime(0, 0, 0, $month, $date, $year);
234 234
 
235
-                $data = array (
235
+                $data = array(
236 236
                     'hdate'		=> $hdate,
237 237
                     'timestamp'	=> $timestamp,
238 238
                     'listurl'	=> $URL->generate()
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         // Pass it an array of data about an item and it will return an
267 267
         // array of data about the item's section heading.
268 268
 
269
-        twfy_debug (get_class($this), "getting an item's section");
269
+        twfy_debug(get_class($this), "getting an item's section");
270 270
 
271 271
         if ($itemdata['htype'] != '10') {
272 272
 
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
             // so get the section info above this item.
276 276
 
277 277
             // For getting hansard data.
278
-            $input = array (
279
-                'amount' => array (
278
+            $input = array(
279
+                'amount' => array(
280 280
                     'body' => true
281 281
                 ),
282
-                'where' => array (
282
+                'where' => array(
283 283
                     'hansard.epobject_id=' => $itemdata['section_id']
284 284
                 )
285 285
             );
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
         // Pass it an array of data about an item and it will return an
307 307
         // array of data about the item's subsection heading.
308 308
 
309
-        twfy_debug (get_class($this), "getting an item's subsection");
309
+        twfy_debug(get_class($this), "getting an item's subsection");
310 310
 
311 311
         // What we return.
312
-        $subsectiondata = array ();
312
+        $subsectiondata = array();
313 313
 
314 314
         if ($itemdata['htype'] == '12' || $itemdata['htype'] == '13' || $itemdata['htype'] == '14') {
315 315
             // This item is a speech or procedural, so get the
316 316
             // subsection info above this item.
317 317
 
318 318
             // For getting hansard data.
319
-            $input = array (
320
-                'amount' => array (
319
+            $input = array(
320
+                'amount' => array(
321 321
                     'body' => true
322 322
                 ),
323
-                'where' => array (
323
+                'where' => array(
324 324
                     'hansard.epobject_id=' => $itemdata['subsection_id']
325 325
                 )
326 326
             );
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         // Pass it an array of item info, of a section/subsection, and this will return
348 348
         // data for the next/prev items.
349 349
 
350
-        twfy_debug (get_class($this), "getting next/prev items");
350
+        twfy_debug(get_class($this), "getting next/prev items");
351 351
 
352 352
         // What we return.
353 353
         $nextprevdata = array();
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
             $wherearr['hansard.epobject_id='] = $prev_item_id;
414 414
 
415 415
             // For getting hansard data.
416
-            $input = array (
417
-                'amount' => array (
416
+            $input = array(
417
+                'amount' => array(
418 418
                     'body' => true,
419 419
                     'speaker' => true
420 420
                 ),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
430 430
                     // Linking to the prev (sub)section.
431 431
                     $thing = $hansardmajors[$this->major]['singular'];
432
-                    $nextprevdata['prev'] = array (
432
+                    $nextprevdata['prev'] = array(
433 433
                         'body'		=> "Previous $thing",
434 434
                         'url'		=> $prevdata[0]['listurl'],
435 435
                         'title'		=> $prevdata[0]['body']
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
                     } else {
443 443
                         $title = '';
444 444
                     }
445
-                    $nextprevdata['prev'] = array (
445
+                    $nextprevdata['prev'] = array(
446 446
                         'body'		=> 'Previous speaker',
447 447
                         'url'		=> $prevdata[0]['commentsurl'],
448 448
                         'title'		=> $title
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
             $wherearr['hansard.epobject_id='] = $next_item_id;
459 459
 
460 460
             // For getting hansard data.
461
-            $input = array (
462
-                'amount' => array (
461
+            $input = array(
462
+                'amount' => array(
463 463
                     'body' => true,
464 464
                     'speaker' => true
465 465
                 ),
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
474 474
                     // Linking to the next (sub)section.
475 475
                     $thing = $hansardmajors[$this->major]['singular'];
476
-                    $nextprevdata['next'] = array (
476
+                    $nextprevdata['next'] = array(
477 477
                         'body'		=> "Next $thing",
478 478
                         'url'		=> $nextdata[0]['listurl'],
479 479
                         'title'		=> $nextdata[0]['body']
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
                     } else {
487 487
                         $title = '';
488 488
                     }
489
-                    $nextprevdata['next'] = array (
489
+                    $nextprevdata['next'] = array(
490 490
                         'body'		=> 'Next speaker',
491 491
                         'url'		=> $nextdata[0]['commentsurl'],
492 492
                         'title'		=> $title
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
         // containing the next/prev dates that contain items from
531 531
         // $this->major of hansard object.
532 532
 
533
-        twfy_debug (get_class($this), "getting next/prev dates");
533
+        twfy_debug(get_class($this), "getting next/prev dates");
534 534
 
535 535
         // What we return.
536
-        $nextprevdata = array ();
536
+        $nextprevdata = array();
537 537
 
538 538
         $URL = new \MySociety\TheyWorkForYou\Url($this->listpage);
539 539
 
540
-        $looper = array ("next", "prev");
540
+        $looper = array("next", "prev");
541 541
 
542 542
         foreach ($looper as $n => $nextorprev) {
543 543
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
             // when displaying the first day of debates.
562 562
             if ($q && $q['hdate'] != NULL) {
563 563
 
564
-                $URL->insert( array( 'd' => $q['hdate'] ) );
564
+                $URL->insert(array('d' => $q['hdate']));
565 565
 
566 566
                 if ($nextorprev == 'next') {
567 567
                     $body = 'Next day';
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
                 $title = format_date($q['hdate'], SHORTDATEFORMAT);
573 573
 
574
-                $nextprevdata[$nextorprev] = array (
574
+                $nextprevdata[$nextorprev] = array(
575 575
                     'hdate' => $q['hdate'],
576 576
                     'url' => $URL->generate(),
577 577
                     'body' => $body,
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         $thing = $hansardmajors[$this->major]['plural'];
586 586
         $URL->insert(array('y'=>$year));
587 587
 
588
-        $nextprevdata['up'] = array (
588
+        $nextprevdata['up'] = array(
589 589
             'body' 	=> "All of $year's $thing",
590 590
             'title'	=> '',
591 591
             'url' 	=> $URL->generate()
@@ -606,19 +606,19 @@  discard block
 block discarded – undo
606 606
         if (isset($args['date'])) {
607 607
             $date = $args['date'];
608 608
         } else {
609
-            $PAGE->error_message ("Sorry, we don't have a date.");
609
+            $PAGE->error_message("Sorry, we don't have a date.");
610 610
             return false;
611 611
         }
612 612
 
613 613
         if (!preg_match("/^(\d\d\d\d)-(\d{1,2})-(\d{1,2})$/", $date, $matches)) {
614
-            $PAGE->error_message ("Sorry, '" . _htmlentities($date) . "' isn't of the right format (YYYY-MM-DD).");
614
+            $PAGE->error_message("Sorry, '" . _htmlentities($date) . "' isn't of the right format (YYYY-MM-DD).");
615 615
             return false;
616 616
         }
617 617
 
618 618
         list(, $year, $month, $day) = $matches;
619 619
 
620 620
         if (!checkdate($month, $day, $year)) {
621
-            $PAGE->error_message ("Sorry, '" . _htmlentities($date) . "' isn't a valid date.");
621
+            $PAGE->error_message("Sorry, '" . _htmlentities($date) . "' isn't a valid date.");
622 622
             return false;
623 623
         }
624 624
 
@@ -636,29 +636,29 @@  discard block
 block discarded – undo
636 636
         global $PAGE;
637 637
 
638 638
         if (!isset($args['gid']) && $args['gid'] == '') {
639
-            $PAGE->error_message ("Sorry, we don't have an item gid.");
639
+            $PAGE->error_message("Sorry, we don't have an item gid.");
640 640
             return false;
641 641
         }
642 642
 
643 643
 
644 644
         // Get all the data just for this epobject_id.
645
-        $input = array (
646
-            'amount' => array (
645
+        $input = array(
646
+            'amount' => array(
647 647
                 'body' => true,
648 648
                 'speaker' => true,
649 649
                 'comment' => true,
650 650
                 'votes' => true
651 651
             ),
652
-            'where' => array (
652
+            'where' => array(
653 653
                 // Need to add the 'uk.org.publicwhip/debate/' or whatever on before
654 654
                 // looking in the DB.
655 655
                 'gid=' => $this->gidprefix . $args['gid']
656 656
             )
657 657
         );
658 658
 
659
-        twfy_debug (get_class($this), "looking for redirected gid");
659
+        twfy_debug(get_class($this), "looking for redirected gid");
660 660
         $gid = $this->gidprefix . $args['gid'];
661
-        $q = $this->db->query ("SELECT gid_to FROM gidredirect WHERE gid_from = :gid", array(':gid' => $gid))->first();
661
+        $q = $this->db->query("SELECT gid_to FROM gidredirect WHERE gid_from = :gid", array(':gid' => $gid))->first();
662 662
         if (!$q) {
663 663
             $itemdata = $this->_get_hansard_data($input);
664 664
         } else {
@@ -666,10 +666,10 @@  discard block
 block discarded – undo
666 666
                 $gid = $q['gid_to'];
667 667
                 $q = $this->db->query("SELECT gid_to FROM gidredirect WHERE gid_from = :gid", array(':gid' => $gid))->first();
668 668
             } while ($q);
669
-            twfy_debug (get_class($this), "found redirected gid $gid" );
669
+            twfy_debug(get_class($this), "found redirected gid $gid");
670 670
             $input['where'] = array('gid=' => $gid);
671 671
             $itemdata = $this->_get_hansard_data($input);
672
-            if (count($itemdata) > 0 ) {
672
+            if (count($itemdata) > 0) {
673 673
                 throw new RedirectException(fix_gid_from_db($gid));
674 674
             }
675 675
         }
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
             $this->check_gid_change($args['gid'], 'a', '');
684 684
 
685 685
             if (substr($args['gid'], -1) == 'L') {
686
-                $letts = array('a','b','c','d','e');
687
-                for ($i=0; $i<4; $i++) {
688
-                    $this->check_gid_change($args['gid'], $letts[$i], $letts[$i+1]);
686
+                $letts = array('a', 'b', 'c', 'd', 'e');
687
+                for ($i = 0; $i < 4; $i++) {
688
+                    $this->check_gid_change($args['gid'], $letts[$i], $letts[$i + 1]);
689 689
                 }
690 690
             }
691 691
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
             #	$u = $q['source_url'];
719 719
             #	$u = '<br><a href="'. $u . '">' . $u . '</a>';
720 720
             #}
721
-            $PAGE->error_message ("Sorry, there is no Hansard object with a gid of '" . _htmlentities($args['gid']) . "'.");
721
+            $PAGE->error_message("Sorry, there is no Hansard object with a gid of '" . _htmlentities($args['gid']) . "'.");
722 722
             return false;
723 723
         }
724 724
 
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
     }
728 728
 
729 729
     private function check_gid_change($gid, $from, $to) {
730
-        $input = array (
731
-            'amount' => array (
730
+        $input = array(
731
+            'amount' => array(
732 732
                 'body' => true,
733 733
                 'speaker' => true,
734 734
                 'comment' => true,
@@ -752,10 +752,10 @@  discard block
 block discarded – undo
752 752
 
753 753
         global $DATA, $this_page;
754 754
 
755
-        twfy_debug (get_class($this), "getting data by date");
755
+        twfy_debug(get_class($this), "getting data by date");
756 756
 
757 757
         // Where we'll put all the data we want to render.
758
-        $data = array ();
758
+        $data = array();
759 759
 
760 760
         $date = $this->_validate_date($args);
761 761
 
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
 
770 770
             // Get all the sections for this date.
771 771
             // Then for each of those we'll get the subsections and rows.
772
-            $input = array (
773
-                'amount' => array (
772
+            $input = array(
773
+                'amount' => array(
774 774
                     'body' => true,
775 775
                     'comment' => true,
776 776
                     'excerpt' => true
777 777
                 ),
778
-                'where' => array (
778
+                'where' => array(
779 779
                     'hdate=' => "$date",
780 780
                     'htype=' => '10',
781 781
                     'major=' => $this->major
@@ -791,20 +791,20 @@  discard block
 block discarded – undo
791 791
                 $data['rows'] = array();
792 792
 
793 793
                 $num_sections = count($sections);
794
-                for ($n=0; $n<$num_sections; $n++) {
794
+                for ($n = 0; $n < $num_sections; $n++) {
795 795
                     // For each section on this date, get the subsections within it.
796 796
 
797 797
                     // Get all the section data.
798 798
                     $sectionrow = $this->_get_section($sections[$n]);
799 799
 
800 800
                     // Get the subsections within the section.
801
-                    $input = array (
802
-                        'amount' => array (
801
+                    $input = array(
802
+                        'amount' => array(
803 803
                             'body' => true,
804 804
                             'comment' => true,
805 805
                             'excerpt' => true
806 806
                         ),
807
-                        'where' => array (
807
+                        'where' => array(
808 808
                             'section_id='	=> $sections[$n]['epobject_id'],
809 809
                             'htype='		=> '11',
810 810
                             'major='		=> $this->major
@@ -815,10 +815,10 @@  discard block
 block discarded – undo
815 815
                     $rows = $this->_get_hansard_data($input);
816 816
 
817 817
                     // Put the section at the top of the rows array.
818
-                    array_unshift ($rows, $sectionrow);
818
+                    array_unshift($rows, $sectionrow);
819 819
 
820 820
                     // Add the section heading and the subsections to the full list.
821
-                    $data['rows'] = array_merge ($data['rows'], $rows);
821
+                    $data['rows'] = array_merge($data['rows'], $rows);
822 822
                 }
823 823
             }
824 824
 
@@ -854,9 +854,9 @@  discard block
 block discarded – undo
854 854
             $major = '';
855 855
         }
856 856
 
857
-        $data = array ();
857
+        $data = array();
858 858
 
859
-        $q = $this->db->query ("SELECT DISTINCT(hdate)
859
+        $q = $this->db->query("SELECT DISTINCT(hdate)
860 860
                         FROM 	hansard
861 861
                         $major
862 862
                         ORDER BY hdate DESC
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
         $data = array();
890 890
 
891 891
         if (!isset($args['person_id'])) {
892
-            $PAGE->error_message ("Sorry, we need a valid person ID.");
892
+            $PAGE->error_message("Sorry, we need a valid person ID.");
893 893
             return $data;
894 894
         }
895 895
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
         $speeches = array();
931 931
         foreach ($q as $row) {
932
-            $speech = array (
932
+            $speech = array(
933 933
                 'subsection_id' => $row['subsection_id'],
934 934
                 'section_id' => $row['section_id'],
935 935
                 'htype' => $row['htype'],
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
             // Cache parent id to speed up _get_listurl
947 947
             $this->epobjectid_to_gid[$row['subsection_id']] = fix_gid_from_db($row['gid_subsection']);
948 948
 
949
-            $url_args = array ('p' => $row['person_id']);
949
+            $url_args = array('p' => $row['person_id']);
950 950
             $speech['listurl'] = $this->_get_listurl($speech, $url_args);
951 951
             $speeches[] = $speech;
952 952
         }
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
         if (count($speeches) > 0) {
955 955
             // Get the subsection texts.
956 956
             $num_speeches = count($speeches);
957
-            for ($n=0; $n<$num_speeches; $n++) {
957
+            for ($n = 0; $n < $num_speeches; $n++) {
958 958
                 $thing = $hansardmajors[$speeches[$n]['major']]['title'];
959 959
                 // Add the parent's body on...
960 960
                 $speeches[$n]['parent']['body'] = $speeches[$n]['body_section'] . ' | ' . $thing;
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
             // eg, by doing filter_user_input($s, 'strict');
989 989
             $searchstring = $args['s'];
990 990
         } else {
991
-            if ( isset($args['exceptions']) ) {
991
+            if (isset($args['exceptions'])) {
992 992
                 throw new \Exception('No search string provided.');
993 993
             } else {
994 994
                 $PAGE->error_message("No search string");
@@ -997,14 +997,14 @@  discard block
 block discarded – undo
997 997
         }
998 998
 
999 999
         // What we'll return.
1000
-        $data = array ();
1000
+        $data = array();
1001 1001
 
1002 1002
         $data['info']['s'] = $args['s'];
1003 1003
 
1004 1004
         // Allows us to specify how many results we want
1005 1005
         // Mainly for glossary term adding
1006 1006
         if (isset($args['num']) && $args['num']) {
1007
-            $results_per_page = $args['num']+0;
1007
+            $results_per_page = $args['num'] + 0;
1008 1008
         }
1009 1009
         else {
1010 1010
             $results_per_page = 20;
@@ -1032,16 +1032,16 @@  discard block
 block discarded – undo
1032 1032
         global $SEARCHENGINE;
1033 1033
 
1034 1034
         // For Xapian's equivalent of an SQL LIMIT clause.
1035
-        $first_result = ($page-1) * $results_per_page;
1035
+        $first_result = ($page - 1) * $results_per_page;
1036 1036
         $data['info']['first_result'] = $first_result + 1; // Take account of LIMIT's 0 base.
1037 1037
 
1038 1038
         // Get the gids from Xapian
1039 1039
         $sort_order = 'date';
1040 1040
         if (isset($args['o'])) {
1041
-            if ($args['o']=='d') $sort_order = 'newest';
1042
-            if ($args['o']=='o') $sort_order = 'oldest';
1043
-            elseif ($args['o']=='c') $sort_order = 'created';
1044
-            elseif ($args['o']=='r') $sort_order = 'relevance';
1041
+            if ($args['o'] == 'd') $sort_order = 'newest';
1042
+            if ($args['o'] == 'o') $sort_order = 'oldest';
1043
+            elseif ($args['o'] == 'c') $sort_order = 'created';
1044
+            elseif ($args['o'] == 'r') $sort_order = 'relevance';
1045 1045
         }
1046 1046
 
1047 1047
         $data['searchdescription'] = $SEARCHENGINE->query_description_long();
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
         // Log this query so we can improve them - if it wasn't a "popular
1053 1053
         // query" link
1054
-        if (! isset($args['pop']) or $args['pop'] != 1) {
1054
+        if (!isset($args['pop']) or $args['pop'] != 1) {
1055 1055
             global $SEARCHLOG;
1056 1056
             $SEARCHLOG->add(
1057 1057
             array('query' => $searchstring,
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
         $SEARCHENGINE->run_search($first_result, $results_per_page, $sort_order);
1068 1068
         $gids = $SEARCHENGINE->get_gids();
1069
-        if ($sort_order=='created') {
1069
+        if ($sort_order == 'created') {
1070 1070
             $createds = $SEARCHENGINE->get_createds();
1071 1071
         }
1072 1072
         $relevances = $SEARCHENGINE->get_relevances();
@@ -1082,13 +1082,13 @@  discard block
 block discarded – undo
1082 1082
 
1083 1083
         // Cycle through each result, munge the data, get more, and put it all in $data.
1084 1084
         $num_gids = count($gids);
1085
-        for ($n=0; $n<$num_gids; $n++) {
1085
+        for ($n = 0; $n < $num_gids; $n++) {
1086 1086
             $gid = $gids[$n];
1087 1087
             $relevancy = $relevances[$n];
1088 1088
             $collapsed = $SEARCHENGINE->collapsed[$n];
1089
-            if ($sort_order=='created') {
1089
+            if ($sort_order == 'created') {
1090 1090
                 #$created = substr($createds[$n], 0, strpos($createds[$n], ':'));
1091
-                if ($createds[$n]<$args['threshold']) {
1091
+                if ($createds[$n] < $args['threshold']) {
1092 1092
                     $data['info']['total_results'] = $n;
1093 1093
                     break;
1094 1094
                 }
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
                 , array(':gid' => $gid));
1151 1151
 
1152 1152
                 if ($q->rows() > 1) {
1153
-                    if ( $isset($args['exceptions']) ) {
1153
+                    if ($isset($args['exceptions'])) {
1154 1154
                         throw new \Exception("Got more than one row getting data for $gid.");
1155 1155
                     } else {
1156 1156
                         $PAGE->error_message("Got more than one row getting data for $gid");
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
                 //////////////////////////
1172 1172
                 // 2. Create the URL to link to this bit of text.
1173 1173
 
1174
-                $id_data = array (
1174
+                $id_data = array(
1175 1175
                     'major'            => $itemdata['major'],
1176 1176
                     'minor'            => $itemdata['minor'],
1177 1177
                     'htype'         => $itemdata['htype'],
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 
1183 1183
                 // We append the query onto the end of the URL as variable 's'
1184 1184
                 // so we can highlight them on the debate/wrans list page.
1185
-                $url_args = array ('s' => $searchstring);
1185
+                $url_args = array('s' => $searchstring);
1186 1186
 
1187 1187
                 $itemdata['listurl'] = $this->_get_listurl($id_data, $url_args, $encode);
1188 1188
 
@@ -1228,14 +1228,14 @@  discard block
 block discarded – undo
1228 1228
                     if (isset($subsection['body'])) $body .= ': ' . $subsection['body'];
1229 1229
                     if (isset($subsection['listurl'])) $listurl = $subsection['listurl'];
1230 1230
                     else $listurl = '';
1231
-                    $itemdata['parent'] = array (
1231
+                    $itemdata['parent'] = array(
1232 1232
                         'body' => $body,
1233 1233
                         'listurl' => $listurl
1234 1234
                     );
1235 1235
                     if ($itemdata['htype'] == 11) {
1236 1236
                         # Search result was a subsection heading; fetch the first entry
1237 1237
                         # from the wrans/wms to show under the heading
1238
-                        $input = array (
1238
+                        $input = array(
1239 1239
                             'amount' => array(
1240 1240
                                 'body' => true,
1241 1241
                                 'speaker' => true
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 
1479 1479
         $params[':major'] = $this->major;
1480 1480
         $params[':firstdate'] = $firstyear . '-' . $firstmonth . '-01';
1481
-        $q =  $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1481
+        $q = $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1482 1482
                         FROM		hansard
1483 1483
                         WHERE		major = :major
1484 1484
                         AND			hdate >= :firstdate
@@ -1544,9 +1544,9 @@  discard block
 block discarded – undo
1544 1544
             if ($action == 'recentyear') {
1545 1545
                 // Assuming there will be a previous year!
1546 1546
 
1547
-                $YEARURL->insert(array('y'=> $firstyear-1));
1547
+                $YEARURL->insert(array('y'=> $firstyear - 1));
1548 1548
 
1549
-                $nextprev['prev'] = array (
1549
+                $nextprev['prev'] = array(
1550 1550
                     'body' => 'Previous year',
1551 1551
                     'title' => $firstyear - 1,
1552 1552
                     'url' => $YEARURL->generate()
@@ -1554,8 +1554,8 @@  discard block
 block discarded – undo
1554 1554
 
1555 1555
             } else { // action is 'year'.
1556 1556
 
1557
-                $nextprev['prev'] = array ('body' => 'Previous year');
1558
-                $nextprev['next'] = array ('body' => 'Next year');
1557
+                $nextprev['prev'] = array('body' => 'Previous year');
1558
+                $nextprev['next'] = array('body' => 'Next year');
1559 1559
 
1560 1560
                 $q = $this->db->query("SELECT DATE_FORMAT(hdate, '%Y') AS year
1561 1561
                             FROM hansard WHERE major = :major
@@ -1650,14 +1650,14 @@  discard block
 block discarded – undo
1650 1650
         // $input['limit'] as a string for the $limit clause, eg '21,20'.
1651 1651
 
1652 1652
         $amount 		= isset($input['amount']) ? $input['amount'] : array();
1653
-        $wherearr 		= isset($input['where']) ? $input['where'] : array();
1653
+        $wherearr = isset($input['where']) ? $input['where'] : array();
1654 1654
         $order 			= isset($input['order']) ? $input['order'] : '';
1655 1655
         $limit 			= isset($input['limit']) ? $input['limit'] : '';
1656 1656
 
1657 1657
 
1658 1658
         // The fields to fetch from db. 'table' => array ('field1', 'field2').
1659
-        $fieldsarr = array (
1660
-            'hansard' => array ('epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'video_status', 'colnum')
1659
+        $fieldsarr = array(
1660
+            'hansard' => array('epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'video_status', 'colnum')
1661 1661
         );
1662 1662
 
1663 1663
         $params = array();
@@ -1669,23 +1669,23 @@  discard block
 block discarded – undo
1669 1669
         if ((isset($amount['body']) && $amount['body'] == true) ||
1670 1670
             (isset($amount['comment']) && $amount['comment'] == true)
1671 1671
             ) {
1672
-            $fieldsarr['epobject'] = array ('body');
1672
+            $fieldsarr['epobject'] = array('body');
1673 1673
             $join = 'LEFT OUTER JOIN epobject ON hansard.epobject_id = epobject.epobject_id';
1674 1674
         } else {
1675 1675
             $join = '';
1676 1676
         }
1677 1677
 
1678 1678
 
1679
-        $fieldsarr2 = array ();
1679
+        $fieldsarr2 = array();
1680 1680
         // Construct the $fields clause.
1681 1681
         foreach ($fieldsarr as $table => $tablesfields) {
1682 1682
             foreach ($tablesfields as $n => $field) {
1683
-                $fieldsarr2[] = $table.'.'.$field;
1683
+                $fieldsarr2[] = $table . '.' . $field;
1684 1684
             }
1685 1685
         }
1686 1686
         $fields = implode(', ', $fieldsarr2);
1687 1687
 
1688
-        $wherearr2 = array ();
1688
+        $wherearr2 = array();
1689 1689
         // Construct the $where clause.
1690 1690
         $i = 0;
1691 1691
         foreach ($wherearr as $key => $val) {
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
             $wherearr2[] = "$key :where$i";
1694 1694
             $i++;
1695 1695
         }
1696
-        $where = implode (" AND ", $wherearr2);
1696
+        $where = implode(" AND ", $wherearr2);
1697 1697
 
1698 1698
 
1699 1699
         if ($order != '') {
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
         }
1712 1712
 
1713 1713
         // Finally, do the query!
1714
-        $q = $this->db->query ("SELECT $fields
1714
+        $q = $this->db->query("SELECT $fields
1715 1715
                         FROM 	hansard
1716 1716
                         $join
1717 1717
                         WHERE $where
@@ -1736,23 +1736,23 @@  discard block
 block discarded – undo
1736 1736
             if (isset($item['gid'])) {
1737 1737
                 // Remove the "uk.org.publicwhip/blah/" from the gid:
1738 1738
                 // (In includes/utility.php)
1739
-                $item['gid'] = fix_gid_from_db( $item['gid'] );
1739
+                $item['gid'] = fix_gid_from_db($item['gid']);
1740 1740
             }
1741 1741
 
1742 1742
             // Add mentions if (a) it's a question in the written
1743 1743
             // answer section or (b) it's in the official reports
1744 1744
             // and the body text ends in a bracketed SPID.
1745
-            if (($this->major && $hansardmajors[$this->major]['page']=='spwrans') && ($item['htype'] == '12' && $item['minor'] == '1')) {
1745
+            if (($this->major && $hansardmajors[$this->major]['page'] == 'spwrans') && ($item['htype'] == '12' && $item['minor'] == '1')) {
1746 1746
                 // Get out the SPID:
1747
-                if ( preg_match('#\d{4}-\d\d-\d\d\.(.*?)\.q#', $item['gid'], $m) ) {
1747
+                if (preg_match('#\d{4}-\d\d-\d\d\.(.*?)\.q#', $item['gid'], $m)) {
1748 1748
                     $item['mentions'] = $this->_get_mentions($m[1]);
1749 1749
                 }
1750 1750
             }
1751 1751
 
1752 1752
             // The second case (b):
1753
-            if (($this->major && $hansardmajors[$this->major]['page']=='spdebates') && isset($item['body'])) {
1754
-                $stripped_body = preg_replace('/<[^>]+>/ms','',$item['body']);
1755
-                if ( preg_match('/\((S\d+\w+-\d+)\)/ms',$stripped_body,$m) ) {
1753
+            if (($this->major && $hansardmajors[$this->major]['page'] == 'spdebates') && isset($item['body'])) {
1754
+                $stripped_body = preg_replace('/<[^>]+>/ms', '', $item['body']);
1755
+                if (preg_match('/\((S\d+\w+-\d+)\)/ms', $stripped_body, $m)) {
1756 1756
                     $item['mentions'] = $this->_get_mentions($m[1]);
1757 1757
                 }
1758 1758
             }
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
             // Get the number of items within a section or subsection.
1766 1766
             // It could be that we can do this in the main query?
1767 1767
             // Not sure.
1768
-            if ( ($this->major && $hansardmajors[$this->major]['type']=='debate') && ($item['htype'] == '10' || $item['htype'] == '11') ) {
1768
+            if (($this->major && $hansardmajors[$this->major]['type'] == 'debate') && ($item['htype'] == '10' || $item['htype'] == '11')) {
1769 1769
 
1770 1770
                 if ($item['htype'] == '10') {
1771 1771
                     // Section - get a count of items within this section that
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
             // 'commentsurl' is the URL of the item on its own page, with comments.
1844 1844
 
1845 1845
             // All the things we need to work out a listurl!
1846
-            $item_data = array (
1846
+            $item_data = array(
1847 1847
                 'major'			=> $this->major,
1848 1848
                 'minor' 		=> $item['minor'],
1849 1849
                 'htype' 		=> $item['htype'],
@@ -1876,11 +1876,11 @@  discard block
 block discarded – undo
1876 1876
                 $item['htype'] == '12') {
1877 1877
                 // Debate speech or written answers (not questions).
1878 1878
 
1879
-                $item['votes'] = $this->_get_votes( $item['epobject_id'] );
1879
+                $item['votes'] = $this->_get_votes($item['epobject_id']);
1880 1880
             }
1881 1881
 
1882 1882
             // Get the speaker for this item, if applicable.
1883
-            if ( (isset($amount['speaker']) && $amount['speaker'] == true) &&
1883
+            if ((isset($amount['speaker']) && $amount['speaker'] == true) &&
1884 1884
                 $item['person_id'] != '') {
1885 1885
 
1886 1886
                 $item['speaker'] = $this->_get_speaker($item['person_id'], $item['hdate'], $item['htime'], $item['major']);
@@ -1891,7 +1891,7 @@  discard block
 block discarded – undo
1891 1891
             if (isset($amount['comment']) && $amount['comment'] == true) {
1892 1892
 
1893 1893
                 // All the things we need to get the comment data.
1894
-                $item_data = array (
1894
+                $item_data = array(
1895 1895
                     'htype' => $item['htype'],
1896 1896
                     'epobject_id' => $item['epobject_id']
1897 1897
                 );
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
     }
1965 1965
 
1966 1966
 
1967
-    public function _get_listurl ($id_data, $url_args=array(), $encode='html') {
1967
+    public function _get_listurl($id_data, $url_args = array(), $encode = 'html') {
1968 1968
         global $hansardmajors;
1969 1969
         // Generates an item's listurl - this is the 'contextual' url
1970 1970
         // for an item, in the full list view with an anchor (if appropriate).
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
                 $DATA->set_page_metadata('pbc_clause', 'url', 'pbc/' . $this->url . $id);
1994 1994
                 $LISTURL->remove(array('id'));
1995 1995
             } else {
1996
-                $LISTURL->insert( array( 'id' => $id_data['gid'] ) );
1996
+                $LISTURL->insert(array('id' => $id_data['gid']));
1997 1997
             }
1998 1998
         } else {
1999 1999
             // A debate speech or question/answer, etc.
@@ -2006,10 +2006,10 @@  discard block
 block discarded – undo
2006 2006
             // Find the gid of this item's (sub)section.
2007 2007
             $parent_gid = '';
2008 2008
 
2009
-            if (isset($this->epobjectid_to_gid[ $parent_epobject_id ])) {
2009
+            if (isset($this->epobjectid_to_gid[$parent_epobject_id])) {
2010 2010
                 // We've previously cached the gid for this epobject_id, so use that.
2011 2011
 
2012
-                $parent_gid = $this->epobjectid_to_gid[ $parent_epobject_id ];
2012
+                $parent_gid = $this->epobjectid_to_gid[$parent_epobject_id];
2013 2013
 
2014 2014
             } else {
2015 2015
                 // We haven't cached the gid, so fetch from db.
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
                     $parent_gid = fix_gid_from_db($r['gid']);
2026 2026
 
2027 2027
                     // Cache it for if we need it again:
2028
-                    $this->epobjectid_to_gid[ $parent_epobject_id ] = $parent_gid;
2028
+                    $this->epobjectid_to_gid[$parent_epobject_id] = $parent_gid;
2029 2029
                 }
2030 2030
             }
2031 2031
 
@@ -2040,13 +2040,13 @@  discard block
 block discarded – undo
2040 2040
                         $session = $qq['session'];
2041 2041
                         $this->bill_lookup[$minor] = array($title, $session);
2042 2042
                     }
2043
-                    $url = "$session/" . urlencode(str_replace(' ','_',$title));
2043
+                    $url = "$session/" . urlencode(str_replace(' ', '_', $title));
2044 2044
                     $parent_gid = preg_replace('#^.*?_.*?_#', '', $parent_gid);
2045 2045
                     global $DATA;
2046 2046
                     $DATA->set_page_metadata('pbc_clause', 'url', "pbc/$url/$parent_gid");
2047 2047
                     $LISTURL->remove(array('id'));
2048 2048
                 } else {
2049
-                    $LISTURL->insert( array( 'id' => $parent_gid ) );
2049
+                    $LISTURL->insert(array('id' => $parent_gid));
2050 2050
                 }
2051 2051
                 // Use a truncated form of this item's gid for the anchor.
2052 2052
                 $fragment = '#g' . gid_to_anchor($id_data['gid']);
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
         }
2055 2055
 
2056 2056
         if (count($url_args) > 0) {
2057
-            $LISTURL->insert( $url_args);
2057
+            $LISTURL->insert($url_args);
2058 2058
         }
2059 2059
 
2060 2060
         return $LISTURL->generate($encode) . $fragment;
@@ -2117,10 +2117,10 @@  discard block
 block discarded – undo
2117 2117
         $member = $this->_get_speaker_alone($q, $person_id, $hdate, $htime, $major);
2118 2118
 
2119 2119
         $URL = $this->_get_speaker_url($member['house']);
2120
-        $URL->insert( array ('p' => $person_id) );
2120
+        $URL->insert(array('p' => $person_id));
2121 2121
 
2122 2122
         $name = member_full_name($member['house'], $member['title'], $member['given_name'], $member['family_name'], $member['lordofname']);
2123
-        $speaker = array (
2123
+        $speaker = array(
2124 2124
             'member_id' => $member['member_id'],
2125 2125
             "name" => $name,
2126 2126
             'house' => $member['house'],
@@ -2248,12 +2248,12 @@  discard block
 block discarded – undo
2248 2248
                     array(':epobject_id' => $item_data['epobject_id']))->first();
2249 2249
 
2250 2250
                 // Add this comment to the data structure.
2251
-                $comment = array (
2251
+                $comment = array(
2252 2252
                     'comment_id' => $q['comment_id'],
2253 2253
                     'user_id'	=> $q['user_id'],
2254 2254
                     'body'		=> $q['body'],
2255 2255
                     'posted'	=> $q['posted'],
2256
-                    'username'	=> $q['firstname'] .' '. $q['lastname']
2256
+                    'username'	=> $q['firstname'] . ' ' . $q['lastname']
2257 2257
                 );
2258 2258
             }
2259 2259
 
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
         // or subsection itself, only the items within them. So
2264 2264
         // we don't get the most recent comment. Because there isn't one.
2265 2265
 
2266
-        $return = array (
2266
+        $return = array(
2267 2267
             'totalcomments' => $totalcomments,
2268 2268
             'comment' => $comment
2269 2269
         );
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
         // What it says on the tin.
2278 2278
         // $item_data must have 'htype' and 'epobject_id' elements. TODO: Check for major==4
2279 2279
 
2280
-        if (($hansardmajors[$this->major]['type']=='debate') &&
2280
+        if (($hansardmajors[$this->major]['type'] == 'debate') &&
2281 2281
             ($item_data['htype'] == '10' || $item_data['htype'] == '11')
2282 2282
             ) {
2283 2283
             // We'll be getting a count of the comments on all items
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
         // Then depending on what htype it is, we get the data for other items too.
2314 2314
         global $DATA, $this_page, $hansardmajors;
2315 2315
 
2316
-        twfy_debug (get_class($this), "getting data by gid");
2316
+        twfy_debug(get_class($this), "getting data by gid");
2317 2317
 
2318 2318
         // Get the information about the item this URL refers to.
2319 2319
         $itemdata = $this->_get_item($args);
@@ -2322,25 +2322,25 @@  discard block
 block discarded – undo
2322 2322
         }
2323 2323
 
2324 2324
         // If part of a Written Answer (just question or just answer), select the whole thing
2325
-        if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type']=='other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) {
2325
+        if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type'] == 'other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) {
2326 2326
             // find the gid of the subheading which holds this part
2327
-            $input = array (
2327
+            $input = array(
2328 2328
                 'amount' => array('gid' => true),
2329
-                'where' => array (
2329
+                'where' => array(
2330 2330
                     'epobject_id=' => $itemdata['subsection_id'],
2331 2331
                 ),
2332 2332
             );
2333 2333
             $parent = $this->_get_hansard_data($input);
2334 2334
             // display that item, i.e. the whole of the Written Answer
2335
-            twfy_debug (get_class($this), "instead of " . $args['gid'] . " selecting subheading gid " . $parent[0]['gid'] . " to get whole wrans");
2335
+            twfy_debug(get_class($this), "instead of " . $args['gid'] . " selecting subheading gid " . $parent[0]['gid'] . " to get whole wrans");
2336 2336
             $args['gid'] = $parent[0]['gid'];
2337 2337
             $this->_get_item($args);
2338 2338
             throw new RedirectException($args['gid']);
2339 2339
         }
2340 2340
 
2341 2341
         # If a WMS main heading, go to next gid
2342
-        if (isset($itemdata['major']) && $itemdata['major']==4 && $itemdata['htype'] == '10') {
2343
-            $input = array (
2342
+        if (isset($itemdata['major']) && $itemdata['major'] == 4 && $itemdata['htype'] == '10') {
2343
+            $input = array(
2344 2344
                 'amount' => array('gid' => true),
2345 2345
                 'where' => array(
2346 2346
                     'section_id=' => $itemdata['epobject_id'],
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
             );
2351 2351
             $next = $this->_get_hansard_data($input);
2352 2352
             if (!empty($next)) {
2353
-                twfy_debug (get_class($this), 'instead of ' . $args['gid'] . ' moving to ' . $next[0]['gid']);
2353
+                twfy_debug(get_class($this), 'instead of ' . $args['gid'] . ' moving to ' . $next[0]['gid']);
2354 2354
                 $args['gid'] = $next[0]['gid'];
2355 2355
                 $this->_get_item($args);
2356 2356
                 throw new RedirectException($args['gid']);
@@ -2402,16 +2402,16 @@  discard block
 block discarded – undo
2402 2402
         // Get the nextprev links for this item, to link to next/prev pages.
2403 2403
         // Duh.
2404 2404
         if ($itemdata['htype'] == '10') {
2405
-            $nextprev = $this->_get_nextprev_items( $sectionrow );
2405
+            $nextprev = $this->_get_nextprev_items($sectionrow);
2406 2406
             $data['info']['text_heading'] = $itemdata['body'];
2407 2407
 
2408 2408
         } elseif ($itemdata['htype'] == '11') {
2409
-            $nextprev = $this->_get_nextprev_items( $subsectionrow );
2409
+            $nextprev = $this->_get_nextprev_items($subsectionrow);
2410 2410
             $data['info']['text_heading'] = $itemdata['body'];
2411 2411
 
2412 2412
         } else {
2413 2413
             // Ordinary lowly item.
2414
-            $nextprev = $this->_get_nextprev_items( $itemdata );
2414
+            $nextprev = $this->_get_nextprev_items($itemdata);
2415 2415
 
2416 2416
             if (isset($subsectionrow['gid'])) {
2417 2417
                 $nextprev['up']['url'] 		= $subsectionrow['listurl'];
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
                 $nextprev['up']['url'] 		= $sectionrow['listurl'];
2421 2421
                 $nextprev['up']['title'] 	= $sectionrow['body'];
2422 2422
             }
2423
-            $nextprev['up']['body']		= 'See the whole debate';
2423
+            $nextprev['up']['body'] = 'See the whole debate';
2424 2424
         }
2425 2425
 
2426 2426
         // We can then access this from $PAGE and the templates.
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
         // Now get all the non-heading rows.
2430 2430
 
2431 2431
         // What data do we want for each item?
2432
-        $amount = array (
2432
+        $amount = array(
2433 2433
             'body' => true,
2434 2434
             'speaker' => true,
2435 2435
             'comment' => true,
@@ -2440,9 +2440,9 @@  discard block
 block discarded – undo
2440 2440
             // This item is a section, so we're displaying all the items within
2441 2441
             // it that aren't within a subsection.
2442 2442
 
2443
-            $input = array (
2443
+            $input = array(
2444 2444
                 'amount' => $amount,
2445
-                'where' => array (
2445
+                'where' => array(
2446 2446
                     'section_id=' => $itemdata['epobject_id'],
2447 2447
                     'subsection_id=' => $itemdata['epobject_id']
2448 2448
                 ),
@@ -2450,15 +2450,15 @@  discard block
 block discarded – undo
2450 2450
             );
2451 2451
 
2452 2452
             $data['rows'] = $this->_get_hansard_data($input);
2453
-            if (!count($data['rows']) || (count($data['rows'])==1 && strstr($data['rows'][0]['body'], 'was asked'))) {
2453
+            if (!count($data['rows']) || (count($data['rows']) == 1 && strstr($data['rows'][0]['body'], 'was asked'))) {
2454 2454
 
2455
-                $input = array (
2456
-                    'amount' => array (
2455
+                $input = array(
2456
+                    'amount' => array(
2457 2457
                         'body' => true,
2458 2458
                         'comment' => true,
2459 2459
                         'excerpt' => true
2460 2460
                     ),
2461
-                    'where' => array (
2461
+                    'where' => array(
2462 2462
                         'section_id='	=> $sectionrow['epobject_id'],
2463 2463
                         'htype='		=> '11',
2464 2464
                         'major='		=> $this->major
@@ -2474,9 +2474,9 @@  discard block
 block discarded – undo
2474 2474
         } elseif ($itemdata['htype'] == '11') {
2475 2475
             // This item is a subsection, so we're displaying everything within it.
2476 2476
 
2477
-            $input = array (
2477
+            $input = array(
2478 2478
                 'amount' => $amount,
2479
-                'where' => array (
2479
+                'where' => array(
2480 2480
                     'subsection_id=' => $itemdata['epobject_id']
2481 2481
                 ),
2482 2482
                 'order' => 'hpos ASC'
@@ -2497,10 +2497,10 @@  discard block
 block discarded – undo
2497 2497
             $subsectionrow['gid'] != $sectionrow['gid']) {
2498 2498
             // If we're looking at a section, there may not be a subsection.
2499 2499
             // And if the subsectionrow and sectionrow aren't the same.
2500
-            array_unshift ($data['rows'], $subsectionrow);
2500
+            array_unshift($data['rows'], $subsectionrow);
2501 2501
         }
2502 2502
 
2503
-        array_unshift ($data['rows'], $sectionrow);
2503
+        array_unshift($data['rows'], $sectionrow);
2504 2504
 
2505 2505
         return $data;
2506 2506
 
@@ -2509,10 +2509,10 @@  discard block
 block discarded – undo
2509 2509
     public function _get_data_by_column($args) {
2510 2510
         global $this_page;
2511 2511
 
2512
-        twfy_debug (get_class($this), "getting data by column");
2512
+        twfy_debug(get_class($this), "getting data by column");
2513 2513
 
2514
-        $input = array( 'amount' => array('body'=>true, 'comment'=>true, 'speaker'=>true),
2515
-        'where' => array( 'hdate='=>$args['date'], 'major=' => $this->major, 'gid LIKE ' =>'%.'.$args['column'].'.%' ),
2514
+        $input = array('amount' => array('body'=>true, 'comment'=>true, 'speaker'=>true),
2515
+        'where' => array('hdate='=>$args['date'], 'major=' => $this->major, 'gid LIKE ' =>'%.' . $args['column'] . '.%'),
2516 2516
         'order' => 'hpos'
2517 2517
         );
2518 2518
         $data = $this->_get_hansard_data($input);
@@ -2571,8 +2571,8 @@  discard block
 block discarded – undo
2571 2571
     public function get_gid_from_spid($spid) {
2572 2572
         // Fix the common errors of S.0 instead of S.O and leading
2573 2573
         // zeros in the numbers:
2574
-        $fixed_spid = preg_replace('/(S[0-9]+)0-([0-9]+)/','${1}O-${2}',$spid);
2575
-        $fixed_spid = preg_replace('/(S[0-9]+\w+)-0*([0-9]+)/','${1}-${2}',$fixed_spid);
2574
+        $fixed_spid = preg_replace('/(S[0-9]+)0-([0-9]+)/', '${1}O-${2}', $spid);
2575
+        $fixed_spid = preg_replace('/(S[0-9]+\w+)-0*([0-9]+)/', '${1}-${2}', $fixed_spid);
2576 2576
         $q = $this->db->query(
2577 2577
             "select mentioned_gid from mentions where gid = :gid_from_spid and (type = 4 or type = 6)",
2578 2578
             array(':gid_from_spid' => 'uk.org.publicwhip/spq/' . $fixed_spid)
@@ -2647,10 +2647,10 @@  discard block
 block discarded – undo
2647 2647
                         ", array(':major' => $this->major));
2648 2648
 
2649 2649
         // What we return.
2650
-        $data = array ();
2650
+        $data = array();
2651 2651
         $speeches = array();
2652 2652
         foreach ($q as $row) {
2653
-            $speech = array (
2653
+            $speech = array(
2654 2654
                 'subsection_id' => $row['subsection_id'],
2655 2655
                 'section_id' => $row['section_id'],
2656 2656
                 'htype' => $row['htype'],
@@ -2663,9 +2663,9 @@  discard block
 block discarded – undo
2663 2663
 
2664 2664
             // Remove the "uk.org.publicwhip/blah/" from the gid:
2665 2665
             // (In includes/utility.php)
2666
-            $speech['gid'] = fix_gid_from_db( $row['gid'] );
2666
+            $speech['gid'] = fix_gid_from_db($row['gid']);
2667 2667
             $speech['listurl'] = $this->_get_listurl($speech);
2668
-            $speech['speaker'] = $this->_get_speaker($row['person_id'], $row['hdate'], $row['htime'], $this->major );
2668
+            $speech['speaker'] = $this->_get_speaker($row['person_id'], $row['hdate'], $row['htime'], $this->major);
2669 2669
             $speeches[] = $speech;
2670 2670
         }
2671 2671
 
@@ -2673,10 +2673,10 @@  discard block
 block discarded – undo
2673 2673
             // Get the subsection texts.
2674 2674
 
2675 2675
             $num_speeches = count($speeches);
2676
-            for ($n=0; $n<$num_speeches; $n++) {
2676
+            for ($n = 0; $n < $num_speeches; $n++) {
2677 2677
                 //if ($this->major == 1) {
2678 2678
                     // Debate.
2679
-                    $parent = $this->_get_subsection ($speeches[$n]);
2679
+                    $parent = $this->_get_subsection($speeches[$n]);
2680 2680
 
2681 2681
                 //} elseif ($this->major == 3) {
2682 2682
                     // Wrans.
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
             $data['rows'] = $speeches;
2696 2696
 
2697 2697
         } else {
2698
-            $data['rows'] = array ();
2698
+            $data['rows'] = array();
2699 2699
         }
2700 2700
 
2701 2701
         $data['info']['days'] = $days;
@@ -2712,13 +2712,13 @@  discard block
 block discarded – undo
2712 2712
     }
2713 2713
 
2714 2714
 
2715
-    public function biggest_debates($args=array()) {
2715
+    public function biggest_debates($args = array()) {
2716 2716
         // So we can just get the data back for special formatting
2717 2717
         // on the front page, without doing the whole display() thing.
2718 2718
         return $this->_get_data_by_biggest_debates($args);
2719 2719
     }
2720 2720
 
2721
-    public function _get_data_by_featured_gid($args=array()) {
2721
+    public function _get_data_by_featured_gid($args = array()) {
2722 2722
         $params = array();
2723 2723
         $data = array();
2724 2724
 
@@ -2747,18 +2747,18 @@  discard block
 block discarded – undo
2747 2747
         if ($q) {
2748 2748
 
2749 2749
             // This array just used for getting further data about this debate.
2750
-            $item_data = array (
2750
+            $item_data = array(
2751 2751
                 'major'         => $this->major,
2752 2752
                 'minor'         => $q['minor'],
2753
-                'gid'           => fix_gid_from_db( $q['gid'] ),
2753
+                'gid'           => fix_gid_from_db($q['gid']),
2754 2754
                 'htype'         => $q['htype'],
2755 2755
                 'section_id'    => $q['section_id'],
2756 2756
                 'subsection_id' => $q['subsection_id'],
2757 2757
                 'epobject_id'   => $q['epobject_id']
2758 2758
             );
2759 2759
 
2760
-            $list_url      = $this->_get_listurl( $item_data );
2761
-            $totalcomments = $this->_get_comment_count_for_epobject( $item_data );
2760
+            $list_url      = $this->_get_listurl($item_data);
2761
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
2762 2762
 
2763 2763
             $body          = $q['body'];
2764 2764
             $hdate         = $q['hdate'];
@@ -2778,21 +2778,21 @@  discard block
 block discarded – undo
2778 2778
                                     ':subsection_id' => $item_data['subsection_id'],
2779 2779
                                 )
2780 2780
                             )->first();
2781
-                $section_body  = $r['sec_body'];
2781
+                $section_body = $r['sec_body'];
2782 2782
                 $subsection_body = $r['sub_body'];
2783
-                if ( $section_body && $subsection_body ) {
2783
+                if ($section_body && $subsection_body) {
2784 2784
                     $parentbody = "$section_body : $subsection_body";
2785 2785
                 } else {
2786 2786
                     $parentbody = "$section_body$subsection_body";
2787 2787
                 }
2788
-            } else if ( $item_data['htype'] == 10 ) {
2788
+            } else if ($item_data['htype'] == 10) {
2789 2789
                 $parentbody = $body;
2790 2790
             }
2791 2791
 
2792 2792
             // Get the question for this item.
2793
-            if ( $item_data['htype'] == 12 ) {
2793
+            if ($item_data['htype'] == 12) {
2794 2794
                 $childbody = $body;
2795
-                $speaker = $this->_get_speaker($q['person_id'], $q['hdate'], $q['htime'], $this->major );
2795
+                $speaker = $this->_get_speaker($q['person_id'], $q['hdate'], $q['htime'], $this->major);
2796 2796
             } else {
2797 2797
                 $r = $this->db->query("SELECT e.body, e.title,
2798 2798
                                         h.person_id, h.hdate, h.htime
@@ -2802,10 +2802,10 @@  discard block
 block discarded – undo
2802 2802
                                 ORDER BY hpos
2803 2803
                                 LIMIT 1
2804 2804
                                 ",
2805
-                                array( ':object_id' => $item_data['epobject_id'] )
2805
+                                array(':object_id' => $item_data['epobject_id'])
2806 2806
                 )->first();
2807 2807
                 $childbody = $r['body'];
2808
-                $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
2808
+                $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
2809 2809
             }
2810 2810
 
2811 2811
             $contentcount = 0;
@@ -2821,7 +2821,7 @@  discard block
 block discarded – undo
2821 2821
             }
2822 2822
 
2823 2823
             global $hansardmajors;
2824
-            $more_url = new \MySociety\TheyWorkForYou\Url( $hansardmajors[$this->major]['page_all'] );
2824
+            $more_url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$this->major]['page_all']);
2825 2825
             $details = array(
2826 2826
                 'body'          => $body,
2827 2827
                 'contentcount'  => $contentcount,
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
                 'more_url' => $more_url->generate()
2841 2841
             );
2842 2842
 
2843
-            $data = array (
2843
+            $data = array(
2844 2844
                 'gid' => $args['gid'],
2845 2845
                 'major' => $this->major,
2846 2846
                 'info' => array(),
@@ -2851,7 +2851,7 @@  discard block
 block discarded – undo
2851 2851
         return $data;
2852 2852
 
2853 2853
     }
2854
-    public function _get_data_by_recent_debates($args=array()) {
2854
+    public function _get_data_by_recent_debates($args = array()) {
2855 2855
         // Returns an array of some random recent debates from a set number of
2856 2856
         // recent days (that's recent days starting from the most recent day
2857 2857
         // that had any debates on).
@@ -2911,17 +2911,17 @@  discard block
 block discarded – undo
2911 2911
         foreach ($q as $row) {
2912 2912
 
2913 2913
             // This array just used for getting further data about this debate.
2914
-            $item_data = array (
2914
+            $item_data = array(
2915 2915
                 'major' => $this->major,
2916
-                'gid' => fix_gid_from_db( $row['gid'] ),
2916
+                'gid' => fix_gid_from_db($row['gid']),
2917 2917
                 'htype' => $row['htype'],
2918 2918
                 'section_id' => $row['section_id'],
2919 2919
                 'subsection_id' => $row['subsection_id'],
2920 2920
                 'epobject_id' => $row['epobject_id']
2921 2921
             );
2922 2922
 
2923
-            $list_url      = $this->_get_listurl( $item_data );
2924
-            $totalcomments = $this->_get_comment_count_for_epobject( $item_data );
2923
+            $list_url      = $this->_get_listurl($item_data);
2924
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
2925 2925
 
2926 2926
             $contentcount  = $row['count'];
2927 2927
             $body          = $row['body'];
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
                             LIMIT 1
2950 2950
                             ")->first();
2951 2951
             $childbody = $r['body'];
2952
-            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
2952
+            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
2953 2953
 
2954 2954
             $data[] = array(
2955 2955
                 'contentcount'  => $contentcount,
@@ -2969,7 +2969,7 @@  discard block
 block discarded – undo
2969 2969
 
2970 2970
         }
2971 2971
 
2972
-        $data = array (
2972
+        $data = array(
2973 2973
             'info' => array(),
2974 2974
             'data' => $data
2975 2975
         );
@@ -2978,7 +2978,7 @@  discard block
 block discarded – undo
2978 2978
 
2979 2979
     }
2980 2980
 
2981
-    public function _get_data_by_biggest_debates($args=array()) {
2981
+    public function _get_data_by_biggest_debates($args = array()) {
2982 2982
         // Returns an array of the debates with most speeches in from
2983 2983
         // a set number of recent days (that's recent days starting from the
2984 2984
         // most recent day that had any debates on).
@@ -3032,17 +3032,17 @@  discard block
 block discarded – undo
3032 3032
         foreach ($q as $row) {
3033 3033
 
3034 3034
             // This array just used for getting further data about this debate.
3035
-            $item_data = array (
3035
+            $item_data = array(
3036 3036
                 'major' => $this->major,
3037
-                'gid' => fix_gid_from_db( $row['gid'] ),
3037
+                'gid' => fix_gid_from_db($row['gid']),
3038 3038
                 'htype' => $row['htype'],
3039 3039
                 'section_id' => $row['section_id'],
3040 3040
                 'subsection_id' => $row['subsection_id'],
3041 3041
                 'epobject_id' => $row['epobject_id']
3042 3042
             );
3043 3043
 
3044
-            $list_url 		= $this->_get_listurl( $item_data );
3045
-            $totalcomments	= $this->_get_comment_count_for_epobject( $item_data );
3044
+            $list_url = $this->_get_listurl($item_data);
3045
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3046 3046
 
3047 3047
             $contentcount = $row['count'];
3048 3048
             $body = $row['body'];
@@ -3050,7 +3050,7 @@  discard block
 block discarded – undo
3050 3050
 
3051 3051
 
3052 3052
             // This array will be added to $data, which is what gets returned.
3053
-            $debate = array (
3053
+            $debate = array(
3054 3054
                 'contentcount'	=> $contentcount,
3055 3055
                 'body'			=> $body,
3056 3056
                 'hdate'			=> $hdate,
@@ -3078,7 +3078,7 @@  discard block
 block discarded – undo
3078 3078
                             LIMIT 1
3079 3079
                             ")->first();
3080 3080
             $childbody = $r['body'];
3081
-            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
3081
+            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
3082 3082
 
3083 3083
             $debate['child'] = array(
3084 3084
                 'body' => $childbody,
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
             $data[] = $debate;
3089 3089
         }
3090 3090
 
3091
-        $data = array (
3091
+        $data = array(
3092 3092
             'info' => array(),
3093 3093
             'data' => $data
3094 3094
         );
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
         return $q->first()['count'];
3112 3112
     }
3113 3113
 
3114
-    public function _get_data_by_recent_wrans ($args=array()) {
3114
+    public function _get_data_by_recent_wrans($args = array()) {
3115 3115
         global $hansardmajors;
3116 3116
 
3117 3117
         // $args['days'] is the number of days back to look for biggest debates.
@@ -3175,17 +3175,17 @@  discard block
 block discarded – undo
3175 3175
 
3176 3176
         foreach ($q as $row) {
3177 3177
             // This array just used for getting further data about this debate.
3178
-            $item_data = array (
3178
+            $item_data = array(
3179 3179
                 'major' => $this->major,
3180
-                'gid' => fix_gid_from_db( $row['gid'] ),
3180
+                'gid' => fix_gid_from_db($row['gid']),
3181 3181
                 'htype' => $row['htype'],
3182 3182
                 'section_id' => $row['section_id'],
3183 3183
                 'subsection_id' => $row['subsection_id'],
3184 3184
                 'epobject_id' => $row['epobject_id']
3185 3185
             );
3186 3186
 
3187
-            $list_url 		= $this->_get_listurl( $item_data );
3188
-            $totalcomments	= $this->_get_comment_count_for_epobject( $item_data );
3187
+            $list_url = $this->_get_listurl($item_data);
3188
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3189 3189
 
3190 3190
             $body = $row['body'];
3191 3191
             $hdate = $row['hdate'];
@@ -3211,25 +3211,25 @@  discard block
 block discarded – undo
3211 3211
                             LIMIT 1
3212 3212
                             ")->first();
3213 3213
             $childbody = $r['body'];
3214
-            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
3214
+            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
3215 3215
 
3216
-            $data[] = array (
3216
+            $data[] = array(
3217 3217
                 'body'			=> $body,
3218 3218
                 'hdate'			=> $hdate,
3219 3219
                 'list_url'		=> $list_url,
3220 3220
                 'totalcomments'	=> $totalcomments,
3221
-                'child'			=> array (
3221
+                'child'			=> array(
3222 3222
                     'body'		=> $childbody,
3223 3223
                     'speaker'	=> $speaker
3224 3224
                 ),
3225
-                'parent'		=> array (
3225
+                'parent'		=> array(
3226 3226
                     'body'		=> $parentbody
3227 3227
                 )
3228 3228
             );
3229 3229
 
3230 3230
         }
3231 3231
 
3232
-        $data = array (
3232
+        $data = array(
3233 3233
             'info' => array(),
3234 3234
             'data' => $data
3235 3235
         );
@@ -3246,7 +3246,7 @@  discard block
 block discarded – undo
3246 3246
     public $commentspage = 'pbc_speech';
3247 3247
     public $gidprefix = 'uk.org.publicwhip/standing/';
3248 3248
 
3249
-    public function __construct($session='', $title='') {
3249
+    public function __construct($session = '', $title = '') {
3250 3250
         parent::__construct();
3251 3251
         $this->bill_title = $title;
3252 3252
         $title = str_replace(' ', '_', $title);
@@ -3254,7 +3254,7 @@  discard block
 block discarded – undo
3254 3254
     }
3255 3255
 
3256 3256
     public function _get_committee($bill_id) {
3257
-        include_once INCLUDESPATH."easyparliament/member.php";
3257
+        include_once INCLUDESPATH . "easyparliament/member.php";
3258 3258
         $q = $this->db->query(
3259 3259
             'select count(*) as c from hansard
3260 3260
                 where major=6 and minor=:bill_id and htype=10',
@@ -3288,13 +3288,13 @@  discard block
 block discarded – undo
3288 3288
     public function _get_data_by_bill($args) {
3289 3289
         global $DATA, $this_page;
3290 3290
         $data = array();
3291
-        $input = array (
3292
-            'amount' => array (
3291
+        $input = array(
3292
+            'amount' => array(
3293 3293
                 'body' => true,
3294 3294
                 'comment' => true,
3295 3295
                 'excerpt' => true
3296 3296
             ),
3297
-            'where' => array (
3297
+            'where' => array(
3298 3298
                 'htype=' => '10',
3299 3299
                 'major=' => $this->major,
3300 3300
                 'minor=' => $args['id'],
@@ -3305,18 +3305,18 @@  discard block
 block discarded – undo
3305 3305
         if (count($sections) > 0) {
3306 3306
             $data['rows'] = array();
3307 3307
             $num_sections = count($sections);
3308
-            for ($n=0; $n<$num_sections; $n++) {
3308
+            for ($n = 0; $n < $num_sections; $n++) {
3309 3309
                 $sectionrow = $sections[$n];
3310 3310
                 list($sitting, $part) = $this->_get_sitting($sectionrow['gid']);
3311 3311
                 $sectionrow['sitting'] = $sitting;
3312 3312
                 $sectionrow['part'] = $part;
3313
-                $input = array (
3314
-                    'amount' => array (
3313
+                $input = array(
3314
+                    'amount' => array(
3315 3315
                         'body' => true,
3316 3316
                         'comment' => true,
3317 3317
                         'excerpt' => true
3318 3318
                     ),
3319
-                    'where' => array (
3319
+                    'where' => array(
3320 3320
                         'section_id='	=> $sectionrow['epobject_id'],
3321 3321
                         'htype='	=> '11',
3322 3322
                         'major='	=> $this->major
@@ -3324,8 +3324,8 @@  discard block
 block discarded – undo
3324 3324
                     'order' => 'hpos'
3325 3325
                 );
3326 3326
                 $rows = $this->_get_hansard_data($input);
3327
-                array_unshift ($rows, $sectionrow);
3328
-                $data['rows'] = array_merge ($data['rows'], $rows);
3327
+                array_unshift($rows, $sectionrow);
3328
+                $data['rows'] = array_merge($data['rows'], $rows);
3329 3329
             }
3330 3330
         }
3331 3331
         $data['info']['bill'] = $args['title'];
@@ -3381,8 +3381,8 @@  discard block
 block discarded – undo
3381 3381
 
3382 3382
         $YEARURL = new \MySociety\TheyWorkForYou\Url('pbc_session');
3383 3383
         $nextprev = array();
3384
-        $nextprev['prev'] = array ('body' => 'Previous session', 'title'=>'');
3385
-        $nextprev['next'] = array ('body' => 'Next session', 'title'=>'');
3384
+        $nextprev['prev'] = array('body' => 'Previous session', 'title'=>'');
3385
+        $nextprev['next'] = array('body' => 'Next session', 'title'=>'');
3386 3386
         $q = $this->db->query(
3387 3387
             "SELECT session FROM bills WHERE session < :session ORDER BY session DESC LIMIT 1",
3388 3388
             array(':session' => $session)
@@ -3419,11 +3419,11 @@  discard block
 block discarded – undo
3419 3419
             $session = $qq['session'];
3420 3420
             list($sitting, $part) = $this->_get_sitting($gid);
3421 3421
             $sitting_txt = make_ranking($sitting) . ' sitting';
3422
-            if ($part>0) $sitting .= ", part $part";
3422
+            if ($part > 0) $sitting .= ", part $part";
3423 3423
             $data[$hdate][] = array(
3424 3424
                 'bill'=> $title,
3425 3425
                 'sitting' => $sitting_txt,
3426
-                'url' => "/pbc/$session/" . urlencode(str_replace(' ','_',$title)) . '/#sitting' . $sitting,
3426
+                'url' => "/pbc/$session/" . urlencode(str_replace(' ', '_', $title)) . '/#sitting' . $sitting,
3427 3427
             );
3428 3428
         }
3429 3429
         return $data;
@@ -3432,7 +3432,7 @@  discard block
 block discarded – undo
3432 3432
     # Given a GID, parse out the sitting number and optional part from it
3433 3433
     public function _get_sitting($gid) {
3434 3434
         if (preg_match('#_(\d\d)-(\d)_#', $gid, $m))
3435
-            return array($m[1]+0, $m[2]);
3435
+            return array($m[1] + 0, $m[2]);
3436 3436
         return array(0, 0);
3437 3437
     }
3438 3438
 }
Please login to merge, or discard this patch.
Braces   +67 added lines, -36 removed lines patch added patch discarded remove patch
@@ -138,8 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
         global $PAGE;
140 140
 
141
-        if ($view == 'search' && (!defined('FRONT_END_SEARCH') || !FRONT_END_SEARCH))
142
-            return false;
141
+        if ($view == 'search' && (!defined('FRONT_END_SEARCH') || !FRONT_END_SEARCH)) {
142
+                    return false;
143
+        }
143 144
 
144 145
         $validviews = array ('calendar', 'date', 'gid', 'person', 'search', 'search_video', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid');
145 146
         if (in_array($view, $validviews)) {
@@ -326,10 +327,11 @@  discard block
 block discarded – undo
326 327
             );
327 328
 
328 329
             $subsectiondata = $this->_get_hansard_data($input);
329
-            if (count($subsectiondata) == 0)
330
-                $subsectiondata = null;
331
-            else
332
-                $subsectiondata = $subsectiondata[0];
330
+            if (count($subsectiondata) == 0) {
331
+                            $subsectiondata = null;
332
+            } else {
333
+                            $subsectiondata = $subsectiondata[0];
334
+            }
333 335
 
334 336
         } elseif ($itemdata['htype'] == '11') {
335 337
             // It's a subsection, so use the item itself.
@@ -1005,12 +1007,12 @@  discard block
 block discarded – undo
1005 1007
         // Mainly for glossary term adding
1006 1008
         if (isset($args['num']) && $args['num']) {
1007 1009
             $results_per_page = $args['num']+0;
1008
-        }
1009
-        else {
1010
+        } else {
1010 1011
             $results_per_page = 20;
1011 1012
         }
1012
-        if ($results_per_page > 1000)
1013
-            $results_per_page = 1000;
1013
+        if ($results_per_page > 1000) {
1014
+                    $results_per_page = 1000;
1015
+        }
1014 1016
 
1015 1017
         $data['info']['results_per_page'] = $results_per_page;
1016 1018
 
@@ -1038,10 +1040,16 @@  discard block
 block discarded – undo
1038 1040
         // Get the gids from Xapian
1039 1041
         $sort_order = 'date';
1040 1042
         if (isset($args['o'])) {
1041
-            if ($args['o']=='d') $sort_order = 'newest';
1042
-            if ($args['o']=='o') $sort_order = 'oldest';
1043
-            elseif ($args['o']=='c') $sort_order = 'created';
1044
-            elseif ($args['o']=='r') $sort_order = 'relevance';
1043
+            if ($args['o']=='d') {
1044
+                $sort_order = 'newest';
1045
+            }
1046
+            if ($args['o']=='o') {
1047
+                $sort_order = 'oldest';
1048
+            } elseif ($args['o']=='c') {
1049
+                $sort_order = 'created';
1050
+            } elseif ($args['o']=='r') {
1051
+                $sort_order = 'relevance';
1052
+            }
1045 1053
         }
1046 1054
 
1047 1055
         $data['searchdescription'] = $SEARCHENGINE->query_description_long();
@@ -1110,8 +1118,9 @@  discard block
 block discarded – undo
1110 1118
                     in_array($itemdata['chamber'], array(
1111 1119
                         'Commons: Main Chamber', 'Lords: Main Chamber',
1112 1120
                         'Commons: Westminster Hall',
1113
-                    )))
1114
-                        continue;
1121
+                    ))) {
1122
+                                        continue;
1123
+                }
1115 1124
 
1116 1125
                 list($cal_item, $cal_meta) = \MySociety\TheyWorkForYou\Utility\Calendar::meta($itemdata);
1117 1126
                 $body = $this->prepare_search_result_for_display($cal_item) . '.';
@@ -1224,10 +1233,17 @@  discard block
 block discarded – undo
1224 1233
                     $section = $this->_get_section($itemdata);
1225 1234
                     $subsection = $this->_get_subsection($itemdata);
1226 1235
                     $body = $hansardmajors[$itemdata['major']]['title'] . ' &#8212; ';
1227
-                    if (isset($section['body'])) $body .= $section['body'];
1228
-                    if (isset($subsection['body'])) $body .= ': ' . $subsection['body'];
1229
-                    if (isset($subsection['listurl'])) $listurl = $subsection['listurl'];
1230
-                    else $listurl = '';
1236
+                    if (isset($section['body'])) {
1237
+                        $body .= $section['body'];
1238
+                    }
1239
+                    if (isset($subsection['body'])) {
1240
+                        $body .= ': ' . $subsection['body'];
1241
+                    }
1242
+                    if (isset($subsection['listurl'])) {
1243
+                        $listurl = $subsection['listurl'];
1244
+                    } else {
1245
+                        $listurl = '';
1246
+                    }
1231 1247
                     $itemdata['parent'] = array (
1232 1248
                         'body' => $body,
1233 1249
                         'listurl' => $listurl
@@ -1552,7 +1568,8 @@  discard block
 block discarded – undo
1552 1568
                     'url' => $YEARURL->generate()
1553 1569
                 );
1554 1570
 
1555
-            } else { // action is 'year'.
1571
+            } else {
1572
+// action is 'year'.
1556 1573
 
1557 1574
                 $nextprev['prev'] = array ('body' => 'Previous year');
1558 1575
                 $nextprev['next'] = array ('body' => 'Next year');
@@ -1979,10 +1996,11 @@  discard block
 block discarded – undo
1979 1996
         // );
1980 1997
 
1981 1998
         // $url_args is an array of other key/value pairs to be appended in the GET string.
1982
-        if ($id_data['major'])
1983
-            $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']);
1984
-        else
1985
-            $LISTURL = new \MySociety\TheyWorkForYou\Url('wrans');
1999
+        if ($id_data['major']) {
2000
+                    $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']);
2001
+        } else {
2002
+                    $LISTURL = new \MySociety\TheyWorkForYou\Url('wrans');
2003
+        }
1986 2004
 
1987 2005
         $fragment = '';
1988 2006
 
@@ -2578,7 +2596,9 @@  discard block
 block discarded – undo
2578 2596
             array(':gid_from_spid' => 'uk.org.publicwhip/spq/' . $fixed_spid)
2579 2597
         )->first();
2580 2598
         $gid = $q['mentioned_gid'];
2581
-        if ($gid) return $gid;
2599
+        if ($gid) {
2600
+            return $gid;
2601
+        }
2582 2602
         return null;
2583 2603
     }
2584 2604
     public function old_get_gid_from_spid($spid) {
@@ -2587,7 +2607,9 @@  discard block
 block discarded – undo
2587 2607
             array(':gid_like' => 'uk.org.publicwhip/spwa/%.' . $spid . '.h')
2588 2608
         )->first();
2589 2609
         $gid = $q['gid'];
2590
-        if ($gid) return str_replace('uk.org.publicwhip/spwa/', '', $gid);
2610
+        if ($gid) {
2611
+            return str_replace('uk.org.publicwhip/spwa/', '', $gid);
2612
+        }
2591 2613
         return null;
2592 2614
     }
2593 2615
 }
@@ -2865,7 +2887,9 @@  discard block
 block discarded – undo
2865 2887
 
2866 2888
         // Get the most recent day on which we have a debate.
2867 2889
         $recentday = $this->most_recent_day();
2868
-        if (!count($recentday)) return $data;
2890
+        if (!count($recentday)) {
2891
+            return $data;
2892
+        }
2869 2893
 
2870 2894
         if (!isset($args['days']) || !is_numeric($args['days'])) {
2871 2895
             $args['days'] = 1;
@@ -2991,8 +3015,9 @@  discard block
 block discarded – undo
2991 3015
 
2992 3016
         // Get the most recent day on which we have a debate.
2993 3017
         $recentday = $this->most_recent_day();
2994
-        if (!count($recentday))
2995
-            return array();
3018
+        if (!count($recentday)) {
3019
+                    return array();
3020
+        }
2996 3021
 
2997 3022
         if (!isset($args['days']) || !is_numeric($args['days'])) {
2998 3023
             $args['days'] = 1;
@@ -3124,8 +3149,9 @@  discard block
 block discarded – undo
3124 3149
 
3125 3150
         // Get the most recent day on which we have wrans.
3126 3151
         $recentday = $this->most_recent_day();
3127
-        if (!count($recentday))
3128
-            return $data;
3152
+        if (!count($recentday)) {
3153
+                    return $data;
3154
+        }
3129 3155
 
3130 3156
         if (!isset($args['days']) || !is_numeric($args['days'])) {
3131 3157
             $args['days'] = 1;
@@ -3405,7 +3431,9 @@  discard block
 block discarded – undo
3405 3431
     }
3406 3432
 
3407 3433
     public function _get_data_by_recent_pbc_debates($args) {
3408
-        if (!isset($args['num'])) $args['num'] = 20;
3434
+        if (!isset($args['num'])) {
3435
+            $args['num'] = 20;
3436
+        }
3409 3437
         $q = $this->db->query('select gid, minor, hdate from hansard
3410 3438
             where htype=10 and major=6
3411 3439
             order by hdate desc limit ' . $args['num']);
@@ -3419,7 +3447,9 @@  discard block
 block discarded – undo
3419 3447
             $session = $qq['session'];
3420 3448
             list($sitting, $part) = $this->_get_sitting($gid);
3421 3449
             $sitting_txt = make_ranking($sitting) . ' sitting';
3422
-            if ($part>0) $sitting .= ", part $part";
3450
+            if ($part>0) {
3451
+                $sitting .= ", part $part";
3452
+            }
3423 3453
             $data[$hdate][] = array(
3424 3454
                 'bill'=> $title,
3425 3455
                 'sitting' => $sitting_txt,
@@ -3431,8 +3461,9 @@  discard block
 block discarded – undo
3431 3461
 
3432 3462
     # Given a GID, parse out the sitting number and optional part from it
3433 3463
     public function _get_sitting($gid) {
3434
-        if (preg_match('#_(\d\d)-(\d)_#', $gid, $m))
3435
-            return array($m[1]+0, $m[2]);
3464
+        if (preg_match('#_(\d\d)-(\d)_#', $gid, $m)) {
3465
+                    return array($m[1]+0, $m[2]);
3466
+        }
3436 3467
         return array(0, 0);
3437 3468
     }
3438 3469
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
                     // Linking to the prev (sub)section.
431 431
                     $thing = $hansardmajors[$this->major]['singular'];
432 432
                     $nextprevdata['prev'] = array (
433
-                        'body'		=> "Previous $thing",
433
+                        'body'		=> "previous $thing",
434 434
                         'url'		=> $prevdata[0]['listurl'],
435 435
                         'title'		=> $prevdata[0]['body']
436 436
                     );
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                     // Linking to the next (sub)section.
475 475
                     $thing = $hansardmajors[$this->major]['singular'];
476 476
                     $nextprevdata['next'] = array (
477
-                        'body'		=> "Next $thing",
477
+                        'body'		=> "next $thing",
478 478
                         'url'		=> $nextdata[0]['listurl'],
479 479
                         'title'		=> $nextdata[0]['body']
480 480
                     );
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
             $URL->remove(array('id'));
511 511
             $things = $hansardmajors[$itemdata['major']]['title'];
512 512
             $nextprevdata['up'] = array(
513
-                'body'	=> "All $things on " . format_date($itemdata['hdate'], SHORTDATEFORMAT),
513
+                'body'	=> "all $things on " . format_date($itemdata['hdate'], SHORTDATEFORMAT),
514 514
                 'title'	=> '',
515 515
                 'url' 	=> $URL->generate()
516 516
             );
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
             // The '!= NULL' bit is needed otherwise I was getting errors
561 561
             // when displaying the first day of debates.
562
-            if ($q && $q['hdate'] != NULL) {
562
+            if ($q && $q['hdate'] != null) {
563 563
 
564 564
                 $URL->insert( array( 'd' => $q['hdate'] ) );
565 565
 
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
                             WHERE	major = :major",
1392 1392
                 array(':major' => $this->major))->first();
1393 1393
 
1394
-            if ($q && $q['hdate'] != NULL) {
1394
+            if ($q && $q['hdate'] != null) {
1395 1395
                 $recentdate = $q['hdate'];
1396 1396
             } else {
1397 1397
                 $PAGE->error_message("Couldn't find the most recent date");
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
         }
1712 1712
 
1713 1713
         // Finally, do the query!
1714
-        $q = $this->db->query ("SELECT $fields
1714
+        $q = $this->db->query ("select $fields
1715 1715
                         FROM 	hansard
1716 1716
                         $join
1717 1717
                         WHERE $where
Please login to merge, or discard this patch.
www/includes/easyparliament/member.php 3 patches
Braces   +44 added lines, -26 removed lines patch added patch discarded remove patch
@@ -114,7 +114,9 @@  discard block
 block discarded – undo
114 114
         $last_party = null;
115 115
         foreach ($q as $row) {
116 116
             $house = $row['house'];
117
-            if (!in_array($house, $this->houses)) $this->houses[] = $house;
117
+            if (!in_array($house, $this->houses)) {
118
+                $this->houses[] = $house;
119
+            }
118 120
             $const = $row['constituency'];
119 121
             $party = $row['party'];
120 122
             $entered_house = $row['entered_house'];
@@ -217,7 +219,9 @@  discard block
 block discarded – undo
217 219
         }
218 220
 
219 221
         $normalised = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($constituency);
220
-        if ($normalised) $constituency = $normalised;
222
+        if ($normalised) {
223
+            $constituency = $normalised;
224
+        }
221 225
 
222 226
         $params = array();
223 227
 
@@ -256,10 +260,12 @@  discard block
 block discarded – undo
256 260
         $q = "SELECT person_id FROM person_names WHERE type = 'name' ";
257 261
         if ($this_page == 'peer') {
258 262
             $success = preg_match('#^(.*?) (.*?) of (.*?)$#', $name, $m);
259
-            if (!$success)
260
-                $success = preg_match('#^(.*?)() of (.*?)$#', $name, $m);
261
-            if (!$success)
262
-                $success = preg_match('#^(.*?) (.*?)()$#', $name, $m);
263
+            if (!$success) {
264
+                            $success = preg_match('#^(.*?)() of (.*?)$#', $name, $m);
265
+            }
266
+            if (!$success) {
267
+                            $success = preg_match('#^(.*?) (.*?)()$#', $name, $m);
268
+            }
263 269
             if (!$success) {
264 270
                 throw new MySociety\TheyWorkForYou\MemberException('Sorry, that name was not recognised.');
265 271
             }
@@ -269,8 +275,9 @@  discard block
 block discarded – undo
269 275
             $q .= "AND title = :title AND family_name = :family_name AND lordofname = :lordofname";
270 276
         } elseif ($this_page == 'msp' || $this_page == 'mla' || strstr($this_page, 'mp')) {
271 277
             $success = preg_match('#^(.*?) (.*?) (.*?)$#', $name, $m);
272
-            if (!$success)
273
-                $success = preg_match('#^(.*?)() (.*)$#', $name, $m);
278
+            if (!$success) {
279
+                            $success = preg_match('#^(.*?)() (.*)$#', $name, $m);
280
+            }
274 281
             if (!$success) {
275 282
                 throw new MySociety\TheyWorkForYou\MemberException('Sorry, that name was not recognised.');
276 283
             }
@@ -405,16 +412,17 @@  discard block
 block discarded – undo
405 412
         if (array_key_exists('public_whip_rebellions', $this->extra_info)) {
406 413
             $rebellions = $this->extra_info['public_whip_rebellions'];
407 414
             $rebel_desc = "<unknown>";
408
-            if ($rebellions == 0)
409
-                $rebel_desc = "never";
410
-            elseif ($rebellions <= 1)
411
-                $rebel_desc = "hardly ever";
412
-            elseif ($rebellions <= 3)
413
-                $rebel_desc = "occasionally";
414
-            elseif ($rebellions <= 5)
415
-                $rebel_desc = "sometimes";
416
-            elseif ($rebellions > 5)
417
-                $rebel_desc = "quite often";
415
+            if ($rebellions == 0) {
416
+                            $rebel_desc = "never";
417
+            } elseif ($rebellions <= 1) {
418
+                            $rebel_desc = "hardly ever";
419
+            } elseif ($rebellions <= 3) {
420
+                            $rebel_desc = "occasionally";
421
+            } elseif ($rebellions <= 5) {
422
+                            $rebel_desc = "sometimes";
423
+            } elseif ($rebellions > 5) {
424
+                            $rebel_desc = "quite often";
425
+            }
418 426
             $this->extra_info['public_whip_rebel_description'] = $rebel_desc;
419 427
         }
420 428
 
@@ -478,8 +486,9 @@  discard block
 block discarded – undo
478 486
     public function family_name() { return $this->family_name; }
479 487
     public function full_name($no_mp_title = false) {
480 488
         $title = $this->title;
481
-        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND))
482
-            $title = '';
489
+        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) {
490
+                    $title = '';
491
+        }
483 492
         return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname);
484 493
     }
485 494
     public function houses() {
@@ -495,8 +504,9 @@  discard block
 block discarded – undo
495 504
     public function party() { return $this->party; }
496 505
     public function party_text($party = null) {
497 506
         global $parties;
498
-        if (!$party)
499
-            $party = $this->party;
507
+        if (!$party) {
508
+                    $party = $this->party;
509
+        }
500 510
         if (isset($parties[$party])) {
501 511
             return $parties[$party];
502 512
         } else {
@@ -516,7 +526,9 @@  discard block
 block discarded – undo
516 526
     }
517 527
 
518 528
     public function entered_house_text($entered_house) {
519
-        if (!$entered_house) return '';
529
+        if (!$entered_house) {
530
+            return '';
531
+        }
520 532
         list($year, $month, $day) = explode('-', $entered_house);
521 533
         if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) {
522 534
             return $year;
@@ -541,7 +553,9 @@  discard block
 block discarded – undo
541 553
     }
542 554
 
543 555
     public function left_house_text($left_house) {
544
-        if (!$left_house) return '';
556
+        if (!$left_house) {
557
+            return '';
558
+        }
545 559
         list($year, $month, $day) = explode('-', $left_house);
546 560
         if (checkdate($month, $day, $year) && $year != '9999') {
547 561
             return format_date($left_house, LONGDATEFORMAT);
@@ -590,7 +604,9 @@  discard block
 block discarded – undo
590 604
             $lh = $this->left_house($h);
591 605
             $current[$h] = ($lh['date'] == '9999-12-31');
592 606
         }
593
-        if ($house) return $current[$house];
607
+        if ($house) {
608
+            return $current[$house];
609
+        }
594 610
         return $current;
595 611
     }
596 612
 
@@ -623,7 +639,9 @@  discard block
 block discarded – undo
623 639
 
624 640
     private function _previous_future_mps_query($direction) {
625 641
         $entered_house = $this->entered_house(HOUSE_TYPE_COMMONS);
626
-        if (is_null($entered_house)) return '';
642
+        if (is_null($entered_house)) {
643
+            return '';
644
+        }
627 645
         if ($direction == '>') {
628 646
             $order = '';
629 647
         } else {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@
 block discarded – undo
364 364
         $this->extra_info = array();
365 365
 
366 366
         $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id',
367
-                              array(':person_id' => $this->person_id));
367
+                                array(':person_id' => $this->person_id));
368 368
         $this->extra_info['office'] = $q->fetchAll();
369 369
 
370 370
         // Info specific to member id (e.g. attendance during that period of office)
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH."easyparliament/glossary.php";
3
+include_once INCLUDESPATH . "easyparliament/glossary.php";
4 4
 
5 5
 class MEMBER {
6 6
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
                 );
144 144
             }
145 145
 
146
-            if ( $house==HOUSE_TYPE_ROYAL 					# The Monarch
147
-                || (!$this->house_disp && $house==HOUSE_TYPE_LONDON_ASSEMBLY) # London Assembly
148
-                || (!$this->house_disp && $house==HOUSE_TYPE_SCOTLAND)	# MSPs and
149
-                || (!$this->house_disp && $house==HOUSE_TYPE_NI)	# MLAs have lowest priority
150
-                || ($this->house_disp!=HOUSE_TYPE_LORDS && $house==HOUSE_TYPE_LORDS)	# Lords have highest priority
151
-                || (!$this->house_disp && $house==HOUSE_TYPE_COMMONS) # MPs
146
+            if ($house == HOUSE_TYPE_ROYAL 					# The Monarch
147
+                || (!$this->house_disp && $house == HOUSE_TYPE_LONDON_ASSEMBLY) # London Assembly
148
+                || (!$this->house_disp && $house == HOUSE_TYPE_SCOTLAND)	# MSPs and
149
+                || (!$this->house_disp && $house == HOUSE_TYPE_NI)	# MLAs have lowest priority
150
+                || ($this->house_disp != HOUSE_TYPE_LORDS && $house == HOUSE_TYPE_LORDS)	# Lords have highest priority
151
+                || (!$this->house_disp && $house == HOUSE_TYPE_COMMONS) # MPs
152 152
             ) {
153 153
                 $this->house_disp = $house;
154 154
                 $this->constituency = $const;
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
         }
204 204
     }
205 205
 
206
-    public function postcode_to_person_id($postcode, $house=null) {
207
-        twfy_debug ('MP', "postcode_to_person_id converting postcode to person");
206
+    public function postcode_to_person_id($postcode, $house = null) {
207
+        twfy_debug('MP', "postcode_to_person_id converting postcode to person");
208 208
         $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($postcode));
209 209
         return $this->constituency_to_person_id($constituency, $house);
210 210
     }
211 211
 
212
-    public function constituency_to_person_id($constituency, $house=null) {
212
+    public function constituency_to_person_id($constituency, $house = null) {
213 213
         if ($constituency == '') {
214 214
             throw new MySociety\TheyWorkForYou\MemberException('Sorry, no constituency was found.');
215 215
         }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         }
249 249
     }
250 250
 
251
-    public function name_to_person_id($name, $const='') {
251
+    public function name_to_person_id($name, $const = '') {
252 252
         global $this_page;
253 253
         if ($name == '') {
254 254
             throw new MySociety\TheyWorkForYou\MemberException('Sorry, no name was found.');
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         global $THEUSER;
349 349
         if (is_object($THEUSER) && $THEUSER->postcode_is_set() && $this->current_member(1)) {
350 350
             $pc = $THEUSER->postcode();
351
-            twfy_debug ('MP', "set_users_mp converting postcode to person");
351
+            twfy_debug('MP', "set_users_mp converting postcode to person");
352 352
             $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
353 353
             if ($constituency == strtolower($this->constituency())) {
354 354
                 $this->the_users_mp = true;
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 
423 423
         if (isset($this->extra_info['public_whip_attendrank'])) {
424 424
             $prefix = ($this->house(HOUSE_TYPE_LORDS) ? 'L' : '');
425
-            $this->extra_info[$prefix.'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank'];
426
-            $this->extra_info[$prefix.'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof'];
427
-            $this->extra_info[$prefix.'public_whip_division_attendance_quintile'] = floor($this->extra_info['public_whip_attendrank'] / ($this->extra_info['public_whip_attendrank_outof']+1) * 5);
425
+            $this->extra_info[$prefix . 'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank'];
426
+            $this->extra_info[$prefix . 'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof'];
427
+            $this->extra_info[$prefix . 'public_whip_division_attendance_quintile'] = floor($this->extra_info['public_whip_attendrank'] / ($this->extra_info['public_whip_attendrank_outof'] + 1) * 5);
428 428
         }
429 429
         if ($this->house(HOUSE_TYPE_LORDS) && isset($this->extra_info['public_whip_division_attendance'])) {
430 430
             $this->extra_info['Lpublic_whip_division_attendance'] = $this->extra_info['public_whip_division_attendance'];
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         }
433 433
 
434 434
         if ($display && array_key_exists('register_member_interests_html', $this->extra_info) && ($this->extra_info['register_member_interests_html'] != '')) {
435
-            $args = array (
435
+            $args = array(
436 436
                 "sort" => "regexp_replace"
437 437
             );
438 438
             $GLOSSARY = new GLOSSARY($args);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         $GLOSSARY->glossarise($this->extra_info['register_member_interests_html']);
441 441
         }
442 442
 
443
-        $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:'.$this->person_id.'%" and confirmed and not deleted')->first();
443
+        $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:' . $this->person_id . '%" and confirmed and not deleted')->first();
444 444
         $this->extra_info['number_of_alerts'] = $q['c'];
445 445
 
446 446
         if (isset($this->extra_info['reading_ease'])) {
@@ -464,14 +464,14 @@  discard block
 block discarded – undo
464 464
         $this->extra_info['pbc'] = array();
465 465
         foreach ($q as $row) {
466 466
             $bill_id = $row['bill_id'];
467
-            $c = $this->db->query('select count(*) as c from hansard where major=6 and minor='.$bill_id.' and htype=10')->first();
467
+            $c = $this->db->query('select count(*) as c from hansard where major=6 and minor=' . $bill_id . ' and htype=10')->first();
468 468
             $c = $c['c'];
469 469
             $title = $row['title'];
470 470
             $attending = $row['a'];
471 471
             $chairman = $row['c'];
472 472
             $this->extra_info['pbc'][$bill_id] = array(
473 473
                 'title' => $title, 'session' => $row['session'],
474
-                'attending'=>$attending, 'chairman'=>($chairman>0), 'outof' => $c
474
+                'attending'=>$attending, 'chairman'=>($chairman > 0), 'outof' => $c
475 475
             );
476 476
         }
477 477
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
     public function family_name() { return $this->family_name; }
487 487
     public function full_name($no_mp_title = false) {
488 488
         $title = $this->title;
489
-        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND))
489
+        if ($no_mp_title && ($this->house_disp == HOUSE_TYPE_COMMONS || $this->house_disp == HOUSE_TYPE_NI || $this->house_disp == HOUSE_TYPE_SCOTLAND))
490 490
             $title = '';
491 491
         return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname);
492 492
     }
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
     }
514 514
 
515 515
     public function entered_house($house = null) {
516
-        if ( isset($house) ) {
517
-            if ( array_key_exists($house, $this->entered_house) ) {
516
+        if (isset($house)) {
517
+            if (array_key_exists($house, $this->entered_house)) {
518 518
                 return $this->entered_house[$house];
519 519
             } else {
520 520
                 return null;
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
     public function entered_house_text($entered_house) {
527 527
         if (!$entered_house) return '';
528 528
         list($year, $month, $day) = explode('-', $entered_house);
529
-        if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) {
529
+        if ($month == 1 && $day == 1 && $this->house(HOUSE_TYPE_LORDS)) {
530 530
             return $year;
531
-        } elseif ($month==0 && $day==0) {
531
+        } elseif ($month == 0 && $day == 0) {
532 532
             return $year;
533 533
         } elseif (checkdate($month, $day, $year) && $year != '9999') {
534 534
             return format_date($entered_house, LONGDATEFORMAT);
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
     }
539 539
 
540 540
     public function left_house($house = null) {
541
-        if ( isset($house) ) {
542
-            if ( array_key_exists($house, $this->left_house) ) {
541
+        if (isset($house)) {
542
+            if (array_key_exists($house, $this->left_house)) {
543 543
                 return $this->left_house[$house];
544 544
             } else {
545 545
                 return null;
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
         list($year, $month, $day) = explode('-', $left_house);
554 554
         if (checkdate($month, $day, $year) && $year != '9999') {
555 555
             return format_date($left_house, LONGDATEFORMAT);
556
-        } elseif ($month==0 && $day==0) {
556
+        } elseif ($month == 0 && $day == 0) {
557 557
             # Left house date is stored as 1942-00-00 to mean "at some point in 1941"
558 558
             return $year - 1;
559 559
         } else {
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
             $name = $row['given_name'] . ' ' . $row['family_name'];
672 672
             if ($last_pid != $pid) {
673 673
                 $mships[] = array(
674
-                    'href' => WEBPATH . 'mp/?pid='.$pid,
674
+                    'href' => WEBPATH . 'mp/?pid=' . $pid,
675 675
                     'text' => $name
676 676
                 );
677 677
                 $last_pid = $pid;
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/alert/index.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
       <?php } ?>
129 129
 
130 130
       <?php
131
-          if(
132
-              (isset($members) && $members->rows() > 0) ||
131
+            if(
132
+                (isset($members) && $members->rows() > 0) ||
133 133
               (isset($constituencies) && count($constituencies) > 0) ||
134 134
               ($alertsearch)
135
-          ) {
136
-              /* We need to disambiguate the user's instructions */
137
-              $member_options = false;
138
-      ?>
135
+            ) {
136
+                /* We need to disambiguate the user's instructions */
137
+                $member_options = false;
138
+        ?>
139 139
         <div class="alert-section alert-section--disambiguation">
140 140
             <div class="alert-section__primary">
141 141
 
142 142
               <?php if (isset($members) && $members->rows() > 0) {
143
-                  $member_options = true; ?>
143
+                    $member_options = true; ?>
144 144
                 <h3>Sign up for alerts when people matching <i><?= _htmlspecialchars($alertsearch) ?></i> speaks</h3>
145 145
                 <ul>
146 146
                   <?php
147 147
                     foreach ($members as $row) {
148
-                  ?>
148
+                    ?>
149 149
                     <li>
150 150
                         <form action="<?= $actionurl ?>" method="post">
151 151
                             <input type="hidden" name="t" value="<?= _htmlspecialchars($token) ?>">
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
               <?php } ?>
166 166
 
167 167
               <?php if (isset($constituencies) && count($constituencies) > 0) {
168
-                  $member_options = true; ?>
168
+                    $member_options = true; ?>
169 169
                 <h3>Sign up for alerts when MPs for constituencies matching <i><?= _htmlspecialchars($alertsearch) ?></i> speaks</h3>
170 170
                 <ul>
171 171
                 <?php foreach ($constituencies as $constituency => $member) { ?>
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <div class="full-page">
2 2
     <div class="full-page__row">
3 3
 
4
-      <?php if ( $message ) { ?>
4
+      <?php if ($message) { ?>
5 5
         <div class="alert-section alert-section--feedback">
6 6
             <div class="alert-section__primary">
7 7
                 <h3><?= $message['title'] ?></h3>
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
         </div>
13 13
       <?php } ?>
14 14
 
15
-      <?php if ( $results ) { ?>
15
+      <?php if ($results) { ?>
16 16
         <div class="alert-section alert-section--feedback">
17 17
             <div class="alert-section__primary">
18
-              <?php if ( $results == 'alert-confirmed' ) { ?>
18
+              <?php if ($results == 'alert-confirmed') { ?>
19 19
                 <h3>Your alert has been confirmed</h3>
20 20
                 <p>
21 21
                     You will now receive email alerts for the following criteria:
@@ -45,32 +45,32 @@  discard block
 block discarded – undo
45 45
                 </div>
46 46
                 </noscript>
47 47
 
48
-              <?php } elseif ( $results == 'alert-suspended' ) { ?>
48
+              <?php } elseif ($results == 'alert-suspended') { ?>
49 49
                 <h3>Alert suspended</h3>
50 50
                 <p>
51 51
                     You can reactivate the alert at any time, from the sidebar below.
52 52
                 </p>
53 53
 
54
-              <?php } elseif ( $results == 'alert-resumed' ) { ?>
54
+              <?php } elseif ($results == 'alert-resumed') { ?>
55 55
                 <h3>Alert resumed</h3>
56 56
                 <p>
57 57
                     You will now receive email alerts on any day when there
58 58
                     are entries in Hansard that match your criteria.
59 59
                 </p>
60 60
 
61
-              <?php } elseif ( $results == 'alert-deleted' ) { ?>
61
+              <?php } elseif ($results == 'alert-deleted') { ?>
62 62
                 <h3>Alert deleted</h3>
63 63
                 <p>
64 64
                     You will no longer receive this alert.
65 65
                 </p>
66 66
 
67
-              <?php } elseif ( $results == 'all-alerts-deleted' ) { ?>
67
+              <?php } elseif ($results == 'all-alerts-deleted') { ?>
68 68
                 <h3>All alerts deleted</h3>
69 69
                 <p>
70 70
                     You will no longer receive any alerts.
71 71
                 </p>
72 72
 
73
-              <?php } elseif ( $results == 'alert-fail' ) { ?>
73
+              <?php } elseif ($results == 'alert-fail') { ?>
74 74
                 <h3>Hmmm, something&rsquo;s not right</h3>
75 75
                 <p>
76 76
                     The link you followed to reach this page appears to be incomplete.
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
                     and let us know, and we'll help out!
87 87
                 </p>
88 88
 
89
-              <?php } elseif ( $results == 'alert-added' ) { ?>
89
+              <?php } elseif ($results == 'alert-added') { ?>
90 90
                 <h3>Your alert has been added</h3>
91 91
                 <p>
92 92
                     You will now receive email alerts on any day when
93 93
                     <?= _htmlspecialchars($criteria) ?> in parliament.
94 94
                 </p>
95 95
 
96
-              <?php } elseif ( $results == 'alert-confirmation' ) { ?>
96
+              <?php } elseif ($results == 'alert-confirmation') { ?>
97 97
                 <h3>We&rsquo;re nearly done&hellip;</h3>
98 98
                 <p>
99 99
                     You should receive an email shortly which will contain a link.
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
                     and receive future alerts. Thanks.
102 102
                 </p>
103 103
 
104
-              <?php } elseif ( $results == 'alert-exists' ) { ?>
104
+              <?php } elseif ($results == 'alert-exists') { ?>
105 105
                 <h3>You&rsquo;re already subscribed to that!</h3>
106 106
                 <p>
107 107
                     It&rsquo;s good to know you&rsquo;re keen though.
108 108
                 </p>
109 109
 
110
-              <?php } elseif ( $results == 'alert-already-signed' ) { ?>
110
+              <?php } elseif ($results == 'alert-already-signed') { ?>
111 111
                 <h3>We&rsquo;re nearly done</h3>
112 112
                 <p>
113 113
                     You should receive an email shortly which will contain a link.
114 114
                     You will need to follow that link to confirm your email address to receive the alert. Thanks.
115 115
                 </p>
116 116
 
117
-              <?php } elseif ( $results == 'alert-fail' ) { ?>
117
+              <?php } elseif ($results == 'alert-fail') { ?>
118 118
                 <h3>Alert could not be created</h3>
119 119
                 <p>
120 120
                     Sorry, we were unable to create that alert. Please
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       <?php } ?>
129 129
 
130 130
       <?php
131
-          if(
131
+          if (
132 132
               (isset($members) && $members->rows() > 0) ||
133 133
               (isset($constituencies) && count($constituencies) > 0) ||
134 134
               ($alertsearch)
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                             <input type="hidden" name="email" value="<?= _htmlspecialchars($email) ?>">
153 153
                             <input type="hidden" name="pid" value="<?= $row['person_id'] ?>">
154 154
                             When
155
-                            <?= member_full_name($row['house'], $row['title'], $row['given_name'], $row['family_name'], $row['lordofname'] ) ?>
155
+                            <?= member_full_name($row['house'], $row['title'], $row['given_name'], $row['family_name'], $row['lordofname']) ?>
156 156
                             <?php if ($row['constituency']) { ?>
157 157
                                 (<?= $row['constituency'] ?>)
158 158
                             <?php } ?>
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
               <?php } ?>
184 184
 
185 185
               <?php if ($alertsearch) {
186
-                if ( $member_options ) { ?>
186
+                if ($member_options) { ?>
187 187
                 <h3>Sign up for alerts for topics</h3>
188 188
                 <?php } else { ?>
189 189
                 <h3>Great! Can you just confirm what you mean?</h3>
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                             Receive alerts when <?= _htmlspecialchars($alertsearch_pretty) ?>
198 198
                             <input type="submit" class="button small" value="Subscribe">
199 199
                         </form>
200
-                      <?php if ( isset($mistakes['multiple']) ) { ?>
200
+                      <?php if (isset($mistakes['multiple'])) { ?>
201 201
                         <em class="error">
202 202
                             You have used a comma in your search term &ndash;
203 203
                             are you sure this is what you want? You cannot
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                             for each individual term.
207 207
                         </em>
208 208
                       <?php } ?>
209
-                      <?php if ( isset($mistakes['postcode_and']) ) { ?>
209
+                      <?php if (isset($mistakes['postcode_and'])) { ?>
210 210
                         <em class="error">
211 211
                             You have used a postcode and something else in your
212 212
                             search term &ndash; are you sure this is what you
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
             <div class="alert-section__secondary">
256 256
               <?php if ($email_verified) { ?>
257 257
 
258
-                  <?php if ( $alerts ) { ?>
258
+                  <?php if ($alerts) { ?>
259 259
                     <?php include('_list.php'); ?>
260 260
                   <?php } ?>
261 261
 
262
-                  <?php if ( $current_mp ) { ?>
262
+                  <?php if ($current_mp) { ?>
263 263
                     <h3>Your MP alert</h3>
264 264
                     <ul class="alerts-manage__list">
265 265
                         <li>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/section/_section_toc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $divisions_to_link = array();
4
-foreach($data['rows'] as $speech) {
4
+foreach ($data['rows'] as $speech) {
5 5
 
6 6
     # Only care about divisions...
7 7
     if ($speech['htype'] != 14) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                     <li><a href="#g<?= gid_to_anchor($speech['gid']) ?>">Division number <?= $division['number'] ?></a>
35 35
                         <?php if ($division['has_description']) { ?>
36 36
                             <br><span class="policy-vote__text">
37
-                                <?php include( dirname(__FILE__) . '/../divisions/_vote_description.php'); ?>
37
+                                <?php include(dirname(__FILE__) . '/../divisions/_vote_description.php'); ?>
38 38
                             </span>
39 39
                         <?php } ?>
40 40
 
Please login to merge, or discard this patch.