Passed
Pull Request — master (#1700)
by Struan
04:54
created
www/docs/postcode/index.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     exit;
61 61
 }
62 62
 
63
-function fetch_mp($pc, $constituencies, $house=null) {
63
+function fetch_mp($pc, $constituencies, $house = null) {
64 64
     global $THEUSER;
65 65
     $args = array('constituency' => $constituencies['WMC']);
66 66
     if ($house) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
     try {
70 70
         $MEMBER = new MEMBER($args);
71
-    } catch (MySociety\TheyWorkForYou\MemberException $e){
71
+    } catch (MySociety\TheyWorkForYou\MemberException $e) {
72 72
         postcode_error($e->getMessage());
73 73
     }
74 74
     if ($MEMBER->person_id()) {
Please login to merge, or discard this patch.
www/includes/easyparliament/page.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public $within_stripe_sidebar = false;
20 20
 
21 21
     public function page_start() {
22
-        if ( !$this->page_started() ) {
22
+        if (!$this->page_started()) {
23 23
             $this->checkForAdmin();
24 24
             $this->displayHeader();
25 25
         }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
         $data = $h->data;
34 34
         $data = array_merge($u->data, $data);
35
-        if ( isset($page_errors) ) {
35
+        if (isset($page_errors)) {
36 36
             $data['page_errors'] = $page_errors;
37 37
         }
38 38
         $data['banner_text'] = '';
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 $THISPAGE = new \MySociety\TheyWorkForYou\Url($this_page);
53 53
 
54 54
                 $LOGINURL = new \MySociety\TheyWorkForYou\Url('userlogin');
55
-                $LOGINURL->insert(array('ret' => $THISPAGE->generate('none') ));
55
+                $LOGINURL->insert(array('ret' => $THISPAGE->generate('none')));
56 56
 
57 57
                 $text = "<a href=\"" . $LOGINURL->generate() . '">' . gettext('You’d better sign in!') . '</a>';
58 58
             } else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 
69 69
     public function page_end() {
70
-        if ( !$this->page_started() ) {
70
+        if (!$this->page_started()) {
71 71
             $this->page_start();
72 72
         }
73 73
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
     }
103 103
 
104
-    public function stripe_start($type='side', $id='', $extra_class = '') {
104
+    public function stripe_start($type = 'side', $id = '', $extra_class = '') {
105 105
         // $type is one of:
106 106
         //  'full' - a full width div
107 107
         //  'side' - a white stripe with a coloured sidebar.
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 
136 136
 
137
-    public function stripe_end ($contents = array(), $extra = '') {
137
+    public function stripe_end($contents = array(), $extra = '') {
138 138
         // $contents is an array containing 0 or more hashes.
139 139
         // Each hash has two values, 'type' and 'content'.
140 140
         // 'Type' could be one of these:
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     public function include_sidebar_template($sidebarname) {
238 238
         global $this_page, $DATA;
239 239
 
240
-            $sidebarpath = INCLUDESPATH.'easyparliament/sidebars/'.$sidebarname.'.php';
240
+            $sidebarpath = INCLUDESPATH . 'easyparliament/sidebars/' . $sidebarname . '.php';
241 241
 
242 242
             if (file_exists($sidebarpath)) {
243 243
                 include $sidebarpath;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     }
246 246
 
247 247
 
248
-    public function block_start($data=array()) {
248
+    public function block_start($data = array()) {
249 249
         // Starts a 'block' div, used mostly on the home page,
250 250
         // on the MP page, and in the sidebars.
251 251
         // $data is a hash like this:
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         if (is_string($message)) {
393 393
             // Sometimes we're just sending a single line to this function
394 394
             // rather like the bigger array...
395
-            $message = array (
395
+            $message = array(
396 396
                 'text' => $message
397 397
             );
398 398
         }
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
         // if the page has started then we're most likely in an old school page
401 401
         // so we should just print out the error, otherwise stick it in the error
402 402
         // global which will then be displayed by the header template
403
-        if ( $this->page_started() ) {
403
+        if ($this->page_started()) {
404 404
             $this->message($message, 'error');
405 405
         } else {
406
-            if ( !isset($page_errors) ) {
406
+            if (!isset($page_errors)) {
407 407
                 $page_errors = array();
408 408
             }
409
-            $page_errors[]  = $message;
409
+            $page_errors[] = $message;
410 410
         }
411 411
 
412 412
         if ($fatal) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     }
424 424
 
425 425
 
426
-    public function message($message, $class='') {
426
+    public function message($message, $class = '') {
427 427
         // Generates a very simple but common page content.
428 428
         // Used for when a user logs out, or votes, or any simple thing
429 429
         // where there's a little message and probably a link elsewhere.
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
             if ($page_title != '') {
514 514
                 $page_title .= ': ';
515 515
             }
516
-            $page_title .= format_date ($info['date'], SHORTDATEFORMAT);
516
+            $page_title .= format_date($info['date'], SHORTDATEFORMAT);
517 517
         }
518 518
 
519 519
         if ($page_title != '') {
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
         if (isset($nextprev['up'])) {
570 570
 
571
-            $uplink = '<span class="up"><a href="' .  $nextprev['up']['url'] . '" title="' . $nextprev['up']['title'] . '">' . $nextprev['up']['body'] . '</a>';
571
+            $uplink = '<span class="up"><a href="' . $nextprev['up']['url'] . '" title="' . $nextprev['up']['title'] . '">' . $nextprev['up']['body'] . '</a>';
572 572
             if (get_http_var('s')) {
573 573
                 $URL = new \MySociety\TheyWorkForYou\Url($this_page);
574 574
                 $uplink .= '<br><a href="' . $URL->generate() . '">' . gettext('Remove highlighting') . '</a>';
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             $next = $nextprev['next'];
584 584
 
585 585
             if (isset($next['url'])) {
586
-                $nextlink = '<a href="' .  $next['url'] . '" title="' . $next['title'] . '" class="linkbutton">' . $next['body'] . ' &raquo;</a>';
586
+                $nextlink = '<a href="' . $next['url'] . '" title="' . $next['title'] . '" class="linkbutton">' . $next['body'] . ' &raquo;</a>';
587 587
             } else {
588 588
                 $nextlink = $next['body'] . ' &raquo;';
589 589
             }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
     }
601 601
 
602 602
 
603
-    public function search_form($value='') {
603
+    public function search_form($value = '') {
604 604
         global $SEARCHENGINE;
605 605
         // Search box on the search page.
606 606
         // If $value is set then it will be displayed in the form.
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
             }
631 631
 
632 632
         echo '<div class="mainsearchbox">';
633
-        if ($wtt<2) {
633
+        if ($wtt < 2) {
634 634
                 echo '<form action="', $URL->generate(), '" method="get">';
635 635
                 if (get_http_var('o')) {
636 636
                     echo '<input type="hidden" name="o" value="', _htmlentities(get_http_var('o')), '">';
@@ -663,16 +663,16 @@  discard block
 block discarded – undo
663 663
                     $ordering = 'd';
664 664
                 }
665 665
 
666
-                if ($ordering=='r') {
666
+                if ($ordering == 'r') {
667 667
                 print '<strong>' . gettext('Sorted by relevance') . '</strong>';
668 668
                 } else {
669 669
                 printf(gettext("<a href='%s'>Sort by relevance</a>"), $orderUrl->generate('html', array('o'=>'r')));
670 670
                 }
671 671
 
672 672
                 print "&nbsp;|&nbsp;";
673
-                if ($ordering=='d') {
673
+                if ($ordering == 'd') {
674 674
                 print '<strong>' . gettext('Sorted by date:') . ' ' . gettext('newest') . '</strong> / <a href="' . $orderUrl->generate('html', array('o'=>'o')) . '">' . gettext('oldest') . '</a>';
675
-                } elseif ($ordering=='o') {
675
+                } elseif ($ordering == 'o') {
676 676
                 print '<strong>' . gettext('Sorted by date:') . '</strong> <a href="' . $orderUrl->generate('html', array('o'=>'d')) . '">' . gettext('newest') . '</a> / <strong>' . gettext('oldest') . '</strong>';
677 677
                 } else {
678 678
                 print gettext("Sort by date:") . ' ';
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
                 }
686 686
 
687 687
             print "&nbsp;|&nbsp;";
688
-            if ($ordering=='p') {
688
+            if ($ordering == 'p') {
689 689
                 print '<strong>' . gettext('Use by person') . '</strong>';
690 690
             } else {
691 691
                 printf('<a href="%s">', $orderUrl->generate('html', array('o'=>'p')));
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
         echo '</form> </div>';
707 707
     }
708 708
 
709
-    public function login_form ($errors = array()) {
709
+    public function login_form($errors = array()) {
710 710
         // Used for /user/login/ and /user/prompt/
711 711
         // $errors is a hash of potential errors from a previous log in attempt.
712 712
         ?>
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     public function glossary_atoz(&$GLOSSARY) {
810 810
     // Print out a nice list of lettered links to glossary pages
811 811
 
812
-        $letters = array ();
812
+        $letters = array();
813 813
 
814 814
         foreach ($GLOSSARY->alphabet as $letter => $eps) {
815 815
             // if we're writing out the current letter (list or item)
@@ -840,14 +840,14 @@  discard block
 block discarded – undo
840 840
                     <div class="letters">
841 841
                         <ul>
842 842
     <?php
843
-        for ($n=0; $n<13; $n++) {
843
+        for ($n = 0; $n < 13; $n++) {
844 844
             print $letters[$n];
845 845
         }
846 846
         ?>
847 847
                         </ul>
848 848
                         <ul>
849 849
     <?php
850
-        for ($n=13; $n<26; $n++) {
850
+        for ($n = 13; $n < 26; $n++) {
851 851
             print $letters[$n];
852 852
         }
853 853
         ?>
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 
867 867
         // add some extra controls for the administrators
868 868
         if ($this_page == "admin_glossary") {
869
-            print "<a id=\"gl".$term['glossary_id']."\"></a>";
869
+            print "<a id=\"gl" . $term['glossary_id'] . "\"></a>";
870 870
             print "<h3>" . $term['title'] . "</h3>";
871 871
             $URL = new \MySociety\TheyWorkForYou\Url('admin_glossary');
872 872
             $URL->insert(array("delete_confirm" => $term['glossary_id']));
873 873
             $delete_url = $URL->generate();
874
-            $admin_links = "<br><small><a href=\"".$delete_url."\">delete</a></small>";
874
+            $admin_links = "<br><small><a href=\"" . $delete_url . "\">delete</a></small>";
875 875
         } else {
876 876
             $admin_links = "";
877 877
         }
@@ -892,9 +892,9 @@  discard block
 block discarded – undo
892 892
             // Add a direct search link for current glossary item
893 893
             $URL = new \MySociety\TheyWorkForYou\Url('search');
894 894
             // remember to quote the term for phrase matching in search
895
-            $URL->insert(array('s' => '"'.$term['title'].'"'));
895
+            $URL->insert(array('s' => '"' . $term['title'] . '"'));
896 896
             $search_url = $URL->generate();
897
-            printf ("\t\t\t\t<p>Search hansard for \"<a href=\"%s\" title=\"View search results for this glossary item\">%s</a>\"</p>", $search_url, $term['title']);
897
+            printf("\t\t\t\t<p>Search hansard for \"<a href=\"%s\" title=\"View search results for this glossary item\">%s</a>\"</p>", $search_url, $term['title']);
898 898
         }
899 899
     }
900 900
 
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 
970 970
             // Generate all the page links.
971 971
             $URL = new \MySociety\TheyWorkForYou\Url($this_page);
972
-            $URL->insert( array('wtt' => get_http_var('wtt')) );
972
+            $URL->insert(array('wtt' => get_http_var('wtt')));
973 973
             if (isset($pagedata['s'])) {
974 974
                 # XXX: Should be taken out in *one* place, not here + search_form etc.
975 975
                 $value = $pagedata['s'];
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
                 $body = trim_characters($report['body'], 0, 40);
1109 1109
 
1110
-                $tabledata['rows'][] = array (
1110
+                $tabledata['rows'][] = array(
1111 1111
                     _htmlentities($report['firstname'] . ' ' . $report['lastname']),
1112 1112
                     _htmlentities($body),
1113 1113
                     $report['reported'],
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
         // Returns HTML suitable for putting in the sidebar on Admin pages.
1190 1190
         global $this_page, $DATA;
1191 1191
 
1192
-        $pages = array ('admin_home',
1192
+        $pages = array('admin_home',
1193 1193
                 'admin_comments', 'admin_searchlogs', 'admin_popularsearches', 'admin_failedsearches',
1194 1194
                 'alert_stats', 'admin_statistics', 'admin_reportstats',
1195 1195
                 'admin_commentreports', 'admin_glossary', 'admin_glossary_pending', 'admin_badusers',
Please login to merge, or discard this patch.
www/includes/easyparliament/hansardlist.php 2 patches
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 
562 562
             // The '!= NULL' bit is needed otherwise I was getting errors
563 563
             // when displaying the first day of debates.
564
-            if ($q && $q['hdate'] != NULL) {
564
+            if ($q && $q['hdate'] != null) {
565 565
 
566 566
                 $URL->insert( array( 'd' => $q['hdate'] ) );
567 567
 
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                             WHERE	major = :major",
1411 1411
                 array(':major' => $this->major))->first();
1412 1412
 
1413
-            if ($q && $q['hdate'] != NULL) {
1413
+            if ($q && $q['hdate'] != null) {
1414 1414
                 $recentdate = $q['hdate'];
1415 1415
             } else {
1416 1416
                 $PAGE->error_message("Couldn't find the most recent date");
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
         }
1726 1726
 
1727 1727
         // Finally, do the query!
1728
-        $q = $this->db->query ("SELECT $fields
1728
+        $q = $this->db->query ("select $fields
1729 1729
                         FROM 	hansard
1730 1730
                         $join
1731 1731
                         WHERE $where
Please login to merge, or discard this patch.
Spacing   +220 added lines, -220 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,
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
             return false;
143 143
         }
144 144
 
145
-        $validviews = array ('calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid');
145
+        $validviews = array('calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid');
146 146
         if (in_array($view, $validviews)) {
147 147
 
148 148
             // What function do we call for this view?
149
-            $function = '_get_data_by_'.$view;
149
+            $function = '_get_data_by_' . $view;
150 150
             // Get all the data that's to be rendered.
151 151
             $data = $this->$function($args);
152 152
 
153 153
         } else {
154 154
             // Don't have a valid $view.
155
-            $PAGE->error_message ("You haven't specified a view type.");
155
+            $PAGE->error_message("You haven't specified a view type.");
156 156
             return false;
157 157
         }
158 158
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 
176
-    public function render($view, $data, $format='html') {
176
+    public function render($view, $data, $format = 'html') {
177 177
         // Once we have the data that's to be rendered,
178 178
         // include the template.
179 179
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             return $data;
183 183
         }
184 184
 
185
-        include (INCLUDESPATH."easyparliament/templates/$format/hansard_$view" . ".php");
185
+        include (INCLUDESPATH . "easyparliament/templates/$format/hansard_$view" . ".php");
186 186
         return true;
187 187
 
188 188
     }
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
             $hdate = $q['hdate'];
228 228
             if ($hdate) {
229 229
                 $URL = new \MySociety\TheyWorkForYou\Url($this->listpage);
230
-                $URL->insert( array('d'=>$hdate) );
230
+                $URL->insert(array('d'=>$hdate));
231 231
 
232 232
                 // Work out a timestamp which is handy for comparing to now.
233 233
                 list($year, $month, $date) = explode('-', $hdate);
234
-                $timestamp = gmmktime (0, 0, 0, $month, $date, $year);
234
+                $timestamp = gmmktime(0, 0, 0, $month, $date, $year);
235 235
 
236
-                $data = array (
236
+                $data = array(
237 237
                     'hdate'		=> $hdate,
238 238
                     'timestamp'	=> $timestamp,
239 239
                     'listurl'	=> $URL->generate()
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         // Pass it an array of data about an item and it will return an
268 268
         // array of data about the item's section heading.
269 269
 
270
-        twfy_debug (get_class($this), "getting an item's section");
270
+        twfy_debug(get_class($this), "getting an item's section");
271 271
 
272 272
         if ($itemdata['htype'] != '10') {
273 273
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
             // so get the section info above this item.
277 277
 
278 278
             // For getting hansard data.
279
-            $input = array (
280
-                'amount' => array (
279
+            $input = array(
280
+                'amount' => array(
281 281
                     'body' => true
282 282
                 ),
283
-                'where' => array (
283
+                'where' => array(
284 284
                     'hansard.epobject_id=' => $itemdata['section_id']
285 285
                 )
286 286
             );
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
         // Pass it an array of data about an item and it will return an
308 308
         // array of data about the item's subsection heading.
309 309
 
310
-        twfy_debug (get_class($this), "getting an item's subsection");
310
+        twfy_debug(get_class($this), "getting an item's subsection");
311 311
 
312 312
         // What we return.
313
-        $subsectiondata = array ();
313
+        $subsectiondata = array();
314 314
 
315 315
         if ($itemdata['htype'] == '12' || $itemdata['htype'] == '13' || $itemdata['htype'] == '14') {
316 316
             // This item is a speech or procedural, so get the
317 317
             // subsection info above this item.
318 318
 
319 319
             // For getting hansard data.
320
-            $input = array (
321
-                'amount' => array (
320
+            $input = array(
321
+                'amount' => array(
322 322
                     'body' => true
323 323
                 ),
324
-                'where' => array (
324
+                'where' => array(
325 325
                     'hansard.epobject_id=' => $itemdata['subsection_id']
326 326
                 )
327 327
             );
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         // Pass it an array of item info, of a section/subsection, and this will return
350 350
         // data for the next/prev items.
351 351
 
352
-        twfy_debug (get_class($this), "getting next/prev items");
352
+        twfy_debug(get_class($this), "getting next/prev items");
353 353
 
354 354
         // What we return.
355 355
         $nextprevdata = array();
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
             $wherearr['hansard.epobject_id='] = $prev_item_id;
416 416
 
417 417
             // For getting hansard data.
418
-            $input = array (
419
-                'amount' => array (
418
+            $input = array(
419
+                'amount' => array(
420 420
                     'body' => true,
421 421
                     'speaker' => true
422 422
                 ),
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
432 432
                     // Linking to the prev (sub)section.
433 433
                     $thing = $hansardmajors[$this->major]['singular'];
434
-                    $nextprevdata['prev'] = array (
434
+                    $nextprevdata['prev'] = array(
435 435
                         'body'		=> sprintf(gettext("Previous %s"), $thing),
436 436
                         'url'		=> $prevdata[0]['listurl'],
437 437
                         'title'		=> $prevdata[0]['body']
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
                     } else {
445 445
                         $title = '';
446 446
                     }
447
-                    $nextprevdata['prev'] = array (
447
+                    $nextprevdata['prev'] = array(
448 448
                         'body'		=> gettext('Previous speaker'),
449 449
                         'url'		=> $prevdata[0]['commentsurl'],
450 450
                         'title'		=> $title
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
             $wherearr['hansard.epobject_id='] = $next_item_id;
461 461
 
462 462
             // For getting hansard data.
463
-            $input = array (
464
-                'amount' => array (
463
+            $input = array(
464
+                'amount' => array(
465 465
                     'body' => true,
466 466
                     'speaker' => true
467 467
                 ),
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                 if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') {
476 476
                     // Linking to the next (sub)section.
477 477
                     $thing = $hansardmajors[$this->major]['singular'];
478
-                    $nextprevdata['next'] = array (
478
+                    $nextprevdata['next'] = array(
479 479
                         'body'		=> sprintf(gettext("Next %s"), $thing),
480 480
                         'url'		=> $nextdata[0]['listurl'],
481 481
                         'title'		=> $nextdata[0]['body']
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
                     } else {
489 489
                         $title = '';
490 490
                     }
491
-                    $nextprevdata['next'] = array (
491
+                    $nextprevdata['next'] = array(
492 492
                         'body'		=> gettext('Next speaker'),
493 493
                         'url'		=> $nextdata[0]['commentsurl'],
494 494
                         'title'		=> $title
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
         // containing the next/prev dates that contain items from
533 533
         // $this->major of hansard object.
534 534
 
535
-        twfy_debug (get_class($this), "getting next/prev dates");
535
+        twfy_debug(get_class($this), "getting next/prev dates");
536 536
 
537 537
         // What we return.
538
-        $nextprevdata = array ();
538
+        $nextprevdata = array();
539 539
 
540 540
         $URL = new \MySociety\TheyWorkForYou\Url($this->listpage);
541 541
 
542
-        $looper = array ("next", "prev");
542
+        $looper = array("next", "prev");
543 543
 
544 544
         foreach ($looper as $n => $nextorprev) {
545 545
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // when displaying the first day of debates.
564 564
             if ($q && $q['hdate'] != NULL) {
565 565
 
566
-                $URL->insert( array( 'd' => $q['hdate'] ) );
566
+                $URL->insert(array('d' => $q['hdate']));
567 567
 
568 568
                 if ($nextorprev == 'next') {
569 569
                     $body = gettext('Next day');
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 
574 574
                 $title = format_date($q['hdate'], SHORTDATEFORMAT);
575 575
 
576
-                $nextprevdata[$nextorprev] = array (
576
+                $nextprevdata[$nextorprev] = array(
577 577
                     'hdate' => $q['hdate'],
578 578
                     'url' => $URL->generate(),
579 579
                     'body' => $body,
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
         $thing = $hansardmajors[$this->major]['plural'];
588 588
         $URL->insert(array('y'=>$year));
589 589
 
590
-        $nextprevdata['up'] = array (
590
+        $nextprevdata['up'] = array(
591 591
             'body' 	=> sprintf(gettext("All of %s’s %s"), $year, $thing),
592 592
             'title'	=> '',
593 593
             'url' 	=> $URL->generate()
@@ -608,19 +608,19 @@  discard block
 block discarded – undo
608 608
         if (isset($args['date'])) {
609 609
             $date = $args['date'];
610 610
         } else {
611
-            $PAGE->error_message ("Sorry, we don't have a date.");
611
+            $PAGE->error_message("Sorry, we don't have a date.");
612 612
             return false;
613 613
         }
614 614
 
615 615
         if (!preg_match("/^(\d\d\d\d)-(\d{1,2})-(\d{1,2})$/", $date, $matches)) {
616
-            $PAGE->error_message ("Sorry, '" . _htmlentities($date) . "' isn't of the right format (YYYY-MM-DD).");
616
+            $PAGE->error_message("Sorry, '" . _htmlentities($date) . "' isn't of the right format (YYYY-MM-DD).");
617 617
             return false;
618 618
         }
619 619
 
620 620
         list(, $year, $month, $day) = $matches;
621 621
 
622 622
         if (!checkdate($month, $day, $year)) {
623
-            $PAGE->error_message ("Sorry, '" . _htmlentities($date) . "' isn't a valid date.");
623
+            $PAGE->error_message("Sorry, '" . _htmlentities($date) . "' isn't a valid date.");
624 624
             return false;
625 625
         }
626 626
 
@@ -638,29 +638,29 @@  discard block
 block discarded – undo
638 638
         global $PAGE;
639 639
 
640 640
         if (!isset($args['gid']) && $args['gid'] == '') {
641
-            $PAGE->error_message ("Sorry, we don't have an item gid.");
641
+            $PAGE->error_message("Sorry, we don't have an item gid.");
642 642
             return false;
643 643
         }
644 644
 
645 645
 
646 646
         // Get all the data just for this epobject_id.
647
-        $input = array (
648
-            'amount' => array (
647
+        $input = array(
648
+            'amount' => array(
649 649
                 'body' => true,
650 650
                 'speaker' => true,
651 651
                 'comment' => true,
652 652
                 'votes' => true
653 653
             ),
654
-            'where' => array (
654
+            'where' => array(
655 655
                 // Need to add the 'uk.org.publicwhip/debate/' or whatever on before
656 656
                 // looking in the DB.
657 657
                 'gid=' => $this->gidprefix . $args['gid']
658 658
             )
659 659
         );
660 660
 
661
-        twfy_debug (get_class($this), "looking for redirected gid");
661
+        twfy_debug(get_class($this), "looking for redirected gid");
662 662
         $gid = $this->gidprefix . $args['gid'];
663
-        $q = $this->db->query ("SELECT gid_to FROM gidredirect WHERE gid_from = :gid", array(':gid' => $gid))->first();
663
+        $q = $this->db->query("SELECT gid_to FROM gidredirect WHERE gid_from = :gid", array(':gid' => $gid))->first();
664 664
         if (!$q) {
665 665
             $itemdata = $this->_get_hansard_data($input);
666 666
         } else {
@@ -668,10 +668,10 @@  discard block
 block discarded – undo
668 668
                 $gid = $q['gid_to'];
669 669
                 $q = $this->db->query("SELECT gid_to FROM gidredirect WHERE gid_from = :gid", array(':gid' => $gid))->first();
670 670
             } while ($q);
671
-            twfy_debug (get_class($this), "found redirected gid $gid" );
671
+            twfy_debug(get_class($this), "found redirected gid $gid");
672 672
             $input['where'] = array('gid=' => $gid);
673 673
             $itemdata = $this->_get_hansard_data($input);
674
-            if (count($itemdata) > 0 ) {
674
+            if (count($itemdata) > 0) {
675 675
                 throw new RedirectException(fix_gid_from_db($gid));
676 676
             }
677 677
         }
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
             $this->check_gid_change($args['gid'], 'a', '');
686 686
 
687 687
             if (substr($args['gid'], -1) == 'L') {
688
-                $letts = array('a','b','c','d','e');
689
-                for ($i=0; $i<4; $i++) {
690
-                    $this->check_gid_change($args['gid'], $letts[$i], $letts[$i+1]);
688
+                $letts = array('a', 'b', 'c', 'd', 'e');
689
+                for ($i = 0; $i < 4; $i++) {
690
+                    $this->check_gid_change($args['gid'], $letts[$i], $letts[$i + 1]);
691 691
                 }
692 692
             }
693 693
 
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
             #	$u = $q['source_url'];
721 721
             #	$u = '<br><a href="'. $u . '">' . $u . '</a>';
722 722
             #}
723
-            $PAGE->error_message ("Sorry, there is no Hansard object with a gid of '" . _htmlentities($args['gid']) . "'.");
723
+            $PAGE->error_message("Sorry, there is no Hansard object with a gid of '" . _htmlentities($args['gid']) . "'.");
724 724
             return false;
725 725
         }
726 726
 
@@ -729,8 +729,8 @@  discard block
 block discarded – undo
729 729
     }
730 730
 
731 731
     private function check_gid_change($gid, $from, $to) {
732
-        $input = array (
733
-            'amount' => array (
732
+        $input = array(
733
+            'amount' => array(
734 734
                 'body' => true,
735 735
                 'speaker' => true,
736 736
                 'comment' => true,
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
 
755 755
         global $DATA, $this_page;
756 756
 
757
-        twfy_debug (get_class($this), "getting data by date");
757
+        twfy_debug(get_class($this), "getting data by date");
758 758
 
759 759
         // Where we'll put all the data we want to render.
760
-        $data = array ();
760
+        $data = array();
761 761
 
762 762
         $date = $this->_validate_date($args);
763 763
 
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
 
772 772
             // Get all the sections for this date.
773 773
             // Then for each of those we'll get the subsections and rows.
774
-            $input = array (
775
-                'amount' => array (
774
+            $input = array(
775
+                'amount' => array(
776 776
                     'body' => true,
777 777
                     'comment' => true,
778 778
                     'excerpt' => true
779 779
                 ),
780
-                'where' => array (
780
+                'where' => array(
781 781
                     'hdate=' => "$date",
782 782
                     'htype=' => '10',
783 783
                     'major=' => $this->major
@@ -793,20 +793,20 @@  discard block
 block discarded – undo
793 793
                 $data['rows'] = array();
794 794
 
795 795
                 $num_sections = count($sections);
796
-                for ($n=0; $n<$num_sections; $n++) {
796
+                for ($n = 0; $n < $num_sections; $n++) {
797 797
                     // For each section on this date, get the subsections within it.
798 798
 
799 799
                     // Get all the section data.
800 800
                     $sectionrow = $this->_get_section($sections[$n]);
801 801
 
802 802
                     // Get the subsections within the section.
803
-                    $input = array (
804
-                        'amount' => array (
803
+                    $input = array(
804
+                        'amount' => array(
805 805
                             'body' => true,
806 806
                             'comment' => true,
807 807
                             'excerpt' => true
808 808
                         ),
809
-                        'where' => array (
809
+                        'where' => array(
810 810
                             'section_id='	=> $sections[$n]['epobject_id'],
811 811
                             'htype='		=> '11',
812 812
                             'major='		=> $this->major
@@ -817,10 +817,10 @@  discard block
 block discarded – undo
817 817
                     $rows = $this->_get_hansard_data($input);
818 818
 
819 819
                     // Put the section at the top of the rows array.
820
-                    array_unshift ($rows, $sectionrow);
820
+                    array_unshift($rows, $sectionrow);
821 821
 
822 822
                     // Add the section heading and the subsections to the full list.
823
-                    $data['rows'] = array_merge ($data['rows'], $rows);
823
+                    $data['rows'] = array_merge($data['rows'], $rows);
824 824
                 }
825 825
             }
826 826
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
             $major = '';
857 857
         }
858 858
 
859
-        $data = array ();
859
+        $data = array();
860 860
 
861
-        $q = $this->db->query ("SELECT DISTINCT(hdate)
861
+        $q = $this->db->query("SELECT DISTINCT(hdate)
862 862
                         FROM 	hansard
863 863
                         $major
864 864
                         ORDER BY hdate DESC
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
         $data = array();
892 892
 
893 893
         if (!isset($args['person_id'])) {
894
-            $PAGE->error_message ("Sorry, we need a valid person ID.");
894
+            $PAGE->error_message("Sorry, we need a valid person ID.");
895 895
             return $data;
896 896
         }
897 897
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 
932 932
         $speeches = array();
933 933
         foreach ($q as $row) {
934
-            $speech = array (
934
+            $speech = array(
935 935
                 'subsection_id' => $row['subsection_id'],
936 936
                 'section_id' => $row['section_id'],
937 937
                 'htype' => $row['htype'],
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
             // Cache parent id to speed up _get_listurl
949 949
             $this->epobjectid_to_gid[$row['subsection_id']] = fix_gid_from_db($row['gid_subsection']);
950 950
 
951
-            $url_args = array ('p' => $row['person_id']);
951
+            $url_args = array('p' => $row['person_id']);
952 952
             $speech['listurl'] = $this->_get_listurl($speech, $url_args);
953 953
             $speeches[] = $speech;
954 954
         }
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
         if (count($speeches) > 0) {
957 957
             // Get the subsection texts.
958 958
             $num_speeches = count($speeches);
959
-            for ($n=0; $n<$num_speeches; $n++) {
959
+            for ($n = 0; $n < $num_speeches; $n++) {
960 960
                 $thing = $hansardmajors[$speeches[$n]['major']]['title'];
961 961
                 // Add the parent's body on...
962 962
                 $speeches[$n]['parent']['body'] = $speeches[$n]['body_section'] . ' | ' . $thing;
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
             // eg, by doing filter_user_input($s, 'strict');
988 988
             $searchstring = $args['s'];
989 989
         } else {
990
-            if ( isset($args['exceptions']) ) {
990
+            if (isset($args['exceptions'])) {
991 991
                 throw new \Exception('No search string provided.');
992 992
             } else {
993 993
                 $PAGE->error_message("No search string");
@@ -996,14 +996,14 @@  discard block
 block discarded – undo
996 996
         }
997 997
 
998 998
         // What we'll return.
999
-        $data = array ();
999
+        $data = array();
1000 1000
 
1001 1001
         $data['info']['s'] = $args['s'];
1002 1002
 
1003 1003
         // Allows us to specify how many results we want
1004 1004
         // Mainly for glossary term adding
1005 1005
         if (isset($args['num']) && is_numeric($args['num'])) {
1006
-            $results_per_page = (int)$args['num'];
1006
+            $results_per_page = (int) $args['num'];
1007 1007
         } else {
1008 1008
             $results_per_page = 20;
1009 1009
         }
@@ -1031,20 +1031,20 @@  discard block
 block discarded – undo
1031 1031
         global $SEARCHENGINE;
1032 1032
 
1033 1033
         // For Xapian's equivalent of an SQL LIMIT clause.
1034
-        $first_result = ($page-1) * $results_per_page;
1034
+        $first_result = ($page - 1) * $results_per_page;
1035 1035
         $data['info']['first_result'] = $first_result + 1; // Take account of LIMIT's 0 base.
1036 1036
 
1037 1037
         // Get the gids from Xapian
1038 1038
         $sort_order = 'date';
1039 1039
         if (isset($args['o'])) {
1040
-            if ($args['o']=='d') {
1040
+            if ($args['o'] == 'd') {
1041 1041
                 $sort_order = 'newest';
1042 1042
             }
1043
-            if ($args['o']=='o') {
1043
+            if ($args['o'] == 'o') {
1044 1044
                 $sort_order = 'oldest';
1045
-            } elseif ($args['o']=='c') {
1045
+            } elseif ($args['o'] == 'c') {
1046 1046
                 $sort_order = 'created';
1047
-            } elseif ($args['o']=='r') {
1047
+            } elseif ($args['o'] == 'r') {
1048 1048
                 $sort_order = 'relevance';
1049 1049
             }
1050 1050
         }
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
         // Log this query so we can improve them - if it wasn't a "popular
1058 1058
         // query" link
1059
-        if (! isset($args['pop']) or $args['pop'] != 1) {
1059
+        if (!isset($args['pop']) or $args['pop'] != 1) {
1060 1060
             global $SEARCHLOG;
1061 1061
             $SEARCHLOG->add(
1062 1062
             array('query' => $searchstring,
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
         $SEARCHENGINE->run_search($first_result, $results_per_page, $sort_order);
1073 1073
         $gids = $SEARCHENGINE->get_gids();
1074
-        if ($sort_order=='created') {
1074
+        if ($sort_order == 'created') {
1075 1075
             $createds = $SEARCHENGINE->get_createds();
1076 1076
         }
1077 1077
         $relevances = $SEARCHENGINE->get_relevances();
@@ -1087,13 +1087,13 @@  discard block
 block discarded – undo
1087 1087
 
1088 1088
         // Cycle through each result, munge the data, get more, and put it all in $data.
1089 1089
         $num_gids = count($gids);
1090
-        for ($n=0; $n<$num_gids; $n++) {
1090
+        for ($n = 0; $n < $num_gids; $n++) {
1091 1091
             $gid = $gids[$n];
1092 1092
             $relevancy = $relevances[$n];
1093 1093
             $collapsed = $SEARCHENGINE->collapsed[$n];
1094
-            if ($sort_order=='created') {
1094
+            if ($sort_order == 'created') {
1095 1095
                 #$created = substr($createds[$n], 0, strpos($createds[$n], ':'));
1096
-                if ($createds[$n]<$args['threshold']) {
1096
+                if ($createds[$n] < $args['threshold']) {
1097 1097
                     $data['info']['total_results'] = $n;
1098 1098
                     break;
1099 1099
                 }
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
                 , array(':gid' => $gid));
1163 1163
 
1164 1164
                 if ($q->rows() > 1) {
1165
-                    if ( $isset($args['exceptions']) ) {
1165
+                    if ($isset($args['exceptions'])) {
1166 1166
                         throw new \Exception("Got more than one row getting data for $gid.");
1167 1167
                     } else {
1168 1168
                         $PAGE->error_message("Got more than one row getting data for $gid");
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
                 //////////////////////////
1184 1184
                 // 2. Create the URL to link to this bit of text.
1185 1185
 
1186
-                $id_data = array (
1186
+                $id_data = array(
1187 1187
                     'major'            => $itemdata['major'],
1188 1188
                     'minor'            => $itemdata['minor'],
1189 1189
                     'htype'         => $itemdata['htype'],
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
                 // We append the query onto the end of the URL as variable 's'
1196 1196
                 // so we can highlight them on the debate/wrans list page.
1197
-                $url_args = array ('s' => $searchstring);
1197
+                $url_args = array('s' => $searchstring);
1198 1198
 
1199 1199
                 $itemdata['listurl'] = $this->_get_listurl($id_data, $url_args, $encode);
1200 1200
 
@@ -1247,14 +1247,14 @@  discard block
 block discarded – undo
1247 1247
                     } else {
1248 1248
                         $listurl = '';
1249 1249
                     }
1250
-                    $itemdata['parent'] = array (
1250
+                    $itemdata['parent'] = array(
1251 1251
                         'body' => $body,
1252 1252
                         'listurl' => $listurl
1253 1253
                     );
1254 1254
                     if ($itemdata['htype'] == 11) {
1255 1255
                         # Search result was a subsection heading; fetch the first entry
1256 1256
                         # from the wrans/wms to show under the heading
1257
-                        $input = array (
1257
+                        $input = array(
1258 1258
                             'amount' => array(
1259 1259
                                 'body' => true,
1260 1260
                                 'speaker' => true
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
         $extract = trim_characters(html_entity_decode($extract), $startpos, $length_of_extract);
1314 1314
 
1315 1315
         // Highlight search words
1316
-        $extract = mb_encode_numericentity( htmlentities($extract, ENT_QUOTES, 'UTF-8'), [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
1316
+        $extract = mb_encode_numericentity(htmlentities($extract, ENT_QUOTES, 'UTF-8'), [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
1317 1317
         $extract = $SEARCHENGINE->highlight($extract);
1318 1318
 
1319 1319
         return $extract;
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
         $params[':major'] = $this->major;
1500 1500
         $params[':firstdate'] = $firstyear . '-' . $firstmonth . '-01';
1501
-        $q =  $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1501
+        $q = $this->db->query("SELECT 	DISTINCT(hdate) AS hdate
1502 1502
                         FROM		hansard
1503 1503
                         WHERE		major = :major
1504 1504
                         AND			hdate >= :firstdate
@@ -1564,9 +1564,9 @@  discard block
 block discarded – undo
1564 1564
             if ($action == 'recentyear') {
1565 1565
                 // Assuming there will be a previous year!
1566 1566
 
1567
-                $YEARURL->insert(array('y'=> $firstyear-1));
1567
+                $YEARURL->insert(array('y'=> $firstyear - 1));
1568 1568
 
1569
-                $nextprev['prev'] = array (
1569
+                $nextprev['prev'] = array(
1570 1570
                     'body' => 'Previous year',
1571 1571
                     'title' => $firstyear - 1,
1572 1572
                     'url' => $YEARURL->generate()
@@ -1575,8 +1575,8 @@  discard block
 block discarded – undo
1575 1575
             } else {
1576 1576
                 // action is 'year'.
1577 1577
 
1578
-                $nextprev['prev'] = array ('body' => 'Previous year');
1579
-                $nextprev['next'] = array ('body' => 'Next year');
1578
+                $nextprev['prev'] = array('body' => 'Previous year');
1579
+                $nextprev['next'] = array('body' => 'Next year');
1580 1580
 
1581 1581
                 $q = $this->db->query("SELECT DATE_FORMAT(hdate, '%Y') AS year
1582 1582
                             FROM hansard WHERE major = :major
@@ -1665,14 +1665,14 @@  discard block
 block discarded – undo
1665 1665
         // $input['limit'] as a string for the $limit clause, eg '21,20'.
1666 1666
 
1667 1667
         $amount 		= isset($input['amount']) ? $input['amount'] : array();
1668
-        $wherearr 		= isset($input['where']) ? $input['where'] : array();
1668
+        $wherearr = isset($input['where']) ? $input['where'] : array();
1669 1669
         $order 			= isset($input['order']) ? $input['order'] : '';
1670 1670
         $limit 			= isset($input['limit']) ? $input['limit'] : '';
1671 1671
 
1672 1672
 
1673 1673
         // The fields to fetch from db. 'table' => array ('field1', 'field2').
1674
-        $fieldsarr = array (
1675
-            'hansard' => array ('epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'colnum')
1674
+        $fieldsarr = array(
1675
+            'hansard' => array('epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'colnum')
1676 1676
         );
1677 1677
 
1678 1678
         $params = array();
@@ -1684,23 +1684,23 @@  discard block
 block discarded – undo
1684 1684
         if ((isset($amount['body']) && $amount['body'] == true) ||
1685 1685
             (isset($amount['comment']) && $amount['comment'] == true)
1686 1686
             ) {
1687
-            $fieldsarr['epobject'] = array ('body');
1687
+            $fieldsarr['epobject'] = array('body');
1688 1688
             $join = 'LEFT OUTER JOIN epobject ON hansard.epobject_id = epobject.epobject_id';
1689 1689
         } else {
1690 1690
             $join = '';
1691 1691
         }
1692 1692
 
1693 1693
 
1694
-        $fieldsarr2 = array ();
1694
+        $fieldsarr2 = array();
1695 1695
         // Construct the $fields clause.
1696 1696
         foreach ($fieldsarr as $table => $tablesfields) {
1697 1697
             foreach ($tablesfields as $n => $field) {
1698
-                $fieldsarr2[] = $table.'.'.$field;
1698
+                $fieldsarr2[] = $table . '.' . $field;
1699 1699
             }
1700 1700
         }
1701 1701
         $fields = implode(', ', $fieldsarr2);
1702 1702
 
1703
-        $wherearr2 = array ();
1703
+        $wherearr2 = array();
1704 1704
         // Construct the $where clause.
1705 1705
         $i = 0;
1706 1706
         foreach ($wherearr as $key => $val) {
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
             $wherearr2[] = "$key :where$i";
1709 1709
             $i++;
1710 1710
         }
1711
-        $where = implode (" AND ", $wherearr2);
1711
+        $where = implode(" AND ", $wherearr2);
1712 1712
 
1713 1713
 
1714 1714
         if ($order != '') {
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
         }
1727 1727
 
1728 1728
         // Finally, do the query!
1729
-        $q = $this->db->query ("SELECT $fields
1729
+        $q = $this->db->query("SELECT $fields
1730 1730
                         FROM 	hansard
1731 1731
                         $join
1732 1732
                         WHERE $where
@@ -1751,23 +1751,23 @@  discard block
 block discarded – undo
1751 1751
             if (isset($item['gid'])) {
1752 1752
                 // Remove the "uk.org.publicwhip/blah/" from the gid:
1753 1753
                 // (In includes/utility.php)
1754
-                $item['gid'] = fix_gid_from_db( $item['gid'] );
1754
+                $item['gid'] = fix_gid_from_db($item['gid']);
1755 1755
             }
1756 1756
 
1757 1757
             // Add mentions if (a) it's a question in the written
1758 1758
             // answer section or (b) it's in the official reports
1759 1759
             // and the body text ends in a bracketed SPID.
1760
-            if (($this->major && $hansardmajors[$this->major]['page']=='spwrans') && ($item['htype'] == '12' && $item['minor'] == '1')) {
1760
+            if (($this->major && $hansardmajors[$this->major]['page'] == 'spwrans') && ($item['htype'] == '12' && $item['minor'] == '1')) {
1761 1761
                 // Get out the SPID:
1762
-                if ( preg_match('#\d{4}-\d\d-\d\d\.(.*?)\.q#', $item['gid'], $m) ) {
1762
+                if (preg_match('#\d{4}-\d\d-\d\d\.(.*?)\.q#', $item['gid'], $m)) {
1763 1763
                     $item['mentions'] = $this->_get_mentions($m[1]);
1764 1764
                 }
1765 1765
             }
1766 1766
 
1767 1767
             // The second case (b):
1768
-            if (($this->major && $hansardmajors[$this->major]['page']=='spdebates') && isset($item['body'])) {
1769
-                $stripped_body = preg_replace('/<[^>]+>/ms','',$item['body']);
1770
-                if ( preg_match('/\((S\d+\w+-\d+)\)/ms',$stripped_body,$m) ) {
1768
+            if (($this->major && $hansardmajors[$this->major]['page'] == 'spdebates') && isset($item['body'])) {
1769
+                $stripped_body = preg_replace('/<[^>]+>/ms', '', $item['body']);
1770
+                if (preg_match('/\((S\d+\w+-\d+)\)/ms', $stripped_body, $m)) {
1771 1771
                     $item['mentions'] = $this->_get_mentions($m[1]);
1772 1772
                 }
1773 1773
             }
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
             // Get the number of items within a section or subsection.
1781 1781
             // It could be that we can do this in the main query?
1782 1782
             // Not sure.
1783
-            if ( ($this->major && $hansardmajors[$this->major]['type']=='debate') && ($item['htype'] == '10' || $item['htype'] == '11') ) {
1783
+            if (($this->major && $hansardmajors[$this->major]['type'] == 'debate') && ($item['htype'] == '10' || $item['htype'] == '11')) {
1784 1784
 
1785 1785
                 if ($item['htype'] == '10') {
1786 1786
                     // Section - get a count of items within this section that
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
             // 'commentsurl' is the URL of the item on its own page, with comments.
1859 1859
 
1860 1860
             // All the things we need to work out a listurl!
1861
-            $item_data = array (
1861
+            $item_data = array(
1862 1862
                 'major'			=> $this->major,
1863 1863
                 'minor' 		=> $item['minor'],
1864 1864
                 'htype' 		=> $item['htype'],
@@ -1891,11 +1891,11 @@  discard block
 block discarded – undo
1891 1891
                 $item['htype'] == '12') {
1892 1892
                 // Debate speech or written answers (not questions).
1893 1893
 
1894
-                $item['votes'] = $this->_get_votes( $item['epobject_id'] );
1894
+                $item['votes'] = $this->_get_votes($item['epobject_id']);
1895 1895
             }
1896 1896
 
1897 1897
             // Get the speaker for this item, if applicable.
1898
-            if ( (isset($amount['speaker']) && $amount['speaker'] == true) &&
1898
+            if ((isset($amount['speaker']) && $amount['speaker'] == true) &&
1899 1899
                 $item['person_id'] != '') {
1900 1900
 
1901 1901
                 $item['speaker'] = $this->_get_speaker($item['person_id'], $item['hdate'], $item['htime'], $item['major']);
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
             if (isset($amount['comment']) && $amount['comment'] == true) {
1907 1907
 
1908 1908
                 // All the things we need to get the comment data.
1909
-                $item_data = array (
1909
+                $item_data = array(
1910 1910
                     'htype' => $item['htype'],
1911 1911
                     'epobject_id' => $item['epobject_id']
1912 1912
                 );
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
     }
1980 1980
 
1981 1981
 
1982
-    public function _get_listurl ($id_data, $url_args=array(), $encode='html') {
1982
+    public function _get_listurl($id_data, $url_args = array(), $encode = 'html') {
1983 1983
         global $hansardmajors;
1984 1984
         // Generates an item's listurl - this is the 'contextual' url
1985 1985
         // for an item, in the full list view with an anchor (if appropriate).
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
                 $DATA->set_page_metadata('pbc_clause', 'url', 'pbc/' . $this->url . $id);
2010 2010
                 $LISTURL->remove(array('id'));
2011 2011
             } else {
2012
-                $LISTURL->insert( array( 'id' => $id_data['gid'] ) );
2012
+                $LISTURL->insert(array('id' => $id_data['gid']));
2013 2013
             }
2014 2014
         } else {
2015 2015
             // A debate speech or question/answer, etc.
@@ -2022,10 +2022,10 @@  discard block
 block discarded – undo
2022 2022
             // Find the gid of this item's (sub)section.
2023 2023
             $parent_gid = '';
2024 2024
 
2025
-            if (isset($this->epobjectid_to_gid[ $parent_epobject_id ])) {
2025
+            if (isset($this->epobjectid_to_gid[$parent_epobject_id])) {
2026 2026
                 // We've previously cached the gid for this epobject_id, so use that.
2027 2027
 
2028
-                $parent_gid = $this->epobjectid_to_gid[ $parent_epobject_id ];
2028
+                $parent_gid = $this->epobjectid_to_gid[$parent_epobject_id];
2029 2029
 
2030 2030
             } else {
2031 2031
                 // We haven't cached the gid, so fetch from db.
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
                     $parent_gid = fix_gid_from_db($r['gid']);
2042 2042
 
2043 2043
                     // Cache it for if we need it again:
2044
-                    $this->epobjectid_to_gid[ $parent_epobject_id ] = $parent_gid;
2044
+                    $this->epobjectid_to_gid[$parent_epobject_id] = $parent_gid;
2045 2045
                 }
2046 2046
             }
2047 2047
 
@@ -2056,13 +2056,13 @@  discard block
 block discarded – undo
2056 2056
                         $session = $qq['session'];
2057 2057
                         $this->bill_lookup[$minor] = array($title, $session);
2058 2058
                     }
2059
-                    $url = "$session/" . urlencode(str_replace(' ','_',$title));
2059
+                    $url = "$session/" . urlencode(str_replace(' ', '_', $title));
2060 2060
                     $parent_gid = preg_replace('#^.*?_.*?_#', '', $parent_gid);
2061 2061
                     global $DATA;
2062 2062
                     $DATA->set_page_metadata('pbc_clause', 'url', "pbc/$url/$parent_gid");
2063 2063
                     $LISTURL->remove(array('id'));
2064 2064
                 } else {
2065
-                    $LISTURL->insert( array( 'id' => $parent_gid ) );
2065
+                    $LISTURL->insert(array('id' => $parent_gid));
2066 2066
                 }
2067 2067
                 // Use a truncated form of this item's gid for the anchor.
2068 2068
                 $fragment = '#g' . gid_to_anchor($id_data['gid']);
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
         }
2071 2071
 
2072 2072
         if (count($url_args) > 0) {
2073
-            $LISTURL->insert( $url_args);
2073
+            $LISTURL->insert($url_args);
2074 2074
         }
2075 2075
 
2076 2076
         return $LISTURL->generate($encode) . $fragment;
@@ -2133,10 +2133,10 @@  discard block
 block discarded – undo
2133 2133
         $member = $this->_get_speaker_alone($q, $person_id, $hdate, $htime, $major);
2134 2134
 
2135 2135
         $URL = $this->_get_speaker_url($member['house']);
2136
-        $URL->insert( array ('p' => $person_id) );
2136
+        $URL->insert(array('p' => $person_id));
2137 2137
 
2138 2138
         $name = member_full_name($member['house'], $member['title'], $member['given_name'], $member['family_name'], $member['lordofname']);
2139
-        $speaker = array (
2139
+        $speaker = array(
2140 2140
             'member_id' => $member['member_id'],
2141 2141
             "name" => $name,
2142 2142
             'house' => $member['house'],
@@ -2264,12 +2264,12 @@  discard block
 block discarded – undo
2264 2264
                     array(':epobject_id' => $item_data['epobject_id']))->first();
2265 2265
 
2266 2266
                 // Add this comment to the data structure.
2267
-                $comment = array (
2267
+                $comment = array(
2268 2268
                     'comment_id' => $q['comment_id'],
2269 2269
                     'user_id'	=> $q['user_id'],
2270 2270
                     'body'		=> $q['body'],
2271 2271
                     'posted'	=> $q['posted'],
2272
-                    'username'	=> $q['firstname'] .' '. $q['lastname']
2272
+                    'username'	=> $q['firstname'] . ' ' . $q['lastname']
2273 2273
                 );
2274 2274
             }
2275 2275
 
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
         // or subsection itself, only the items within them. So
2280 2280
         // we don't get the most recent comment. Because there isn't one.
2281 2281
 
2282
-        $return = array (
2282
+        $return = array(
2283 2283
             'totalcomments' => $totalcomments,
2284 2284
             'comment' => $comment
2285 2285
         );
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
         // What it says on the tin.
2294 2294
         // $item_data must have 'htype' and 'epobject_id' elements. TODO: Check for major==4
2295 2295
 
2296
-        if (($hansardmajors[$this->major]['type']=='debate') &&
2296
+        if (($hansardmajors[$this->major]['type'] == 'debate') &&
2297 2297
             ($item_data['htype'] == '10' || $item_data['htype'] == '11')
2298 2298
             ) {
2299 2299
             // We'll be getting a count of the comments on all items
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
         // Then depending on what htype it is, we get the data for other items too.
2330 2330
         global $DATA, $this_page, $hansardmajors;
2331 2331
 
2332
-        twfy_debug (get_class($this), "getting data by gid");
2332
+        twfy_debug(get_class($this), "getting data by gid");
2333 2333
 
2334 2334
         // Get the information about the item this URL refers to.
2335 2335
         $itemdata = $this->_get_item($args);
@@ -2338,25 +2338,25 @@  discard block
 block discarded – undo
2338 2338
         }
2339 2339
 
2340 2340
         // If part of a Written Answer (just question or just answer), select the whole thing
2341
-        if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type']=='other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) {
2341
+        if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type'] == 'other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) {
2342 2342
             // find the gid of the subheading which holds this part
2343
-            $input = array (
2343
+            $input = array(
2344 2344
                 'amount' => array('gid' => true),
2345
-                'where' => array (
2345
+                'where' => array(
2346 2346
                     'epobject_id=' => $itemdata['subsection_id'],
2347 2347
                 ),
2348 2348
             );
2349 2349
             $parent = $this->_get_hansard_data($input);
2350 2350
             // display that item, i.e. the whole of the Written Answer
2351
-            twfy_debug (get_class($this), "instead of " . $args['gid'] . " selecting subheading gid " . $parent[0]['gid'] . " to get whole wrans");
2351
+            twfy_debug(get_class($this), "instead of " . $args['gid'] . " selecting subheading gid " . $parent[0]['gid'] . " to get whole wrans");
2352 2352
             $args['gid'] = $parent[0]['gid'];
2353 2353
             $this->_get_item($args);
2354 2354
             throw new RedirectException($args['gid']);
2355 2355
         }
2356 2356
 
2357 2357
         # If a WMS main heading, go to next gid
2358
-        if (isset($itemdata['major']) && $itemdata['major']==4 && $itemdata['htype'] == '10') {
2359
-            $input = array (
2358
+        if (isset($itemdata['major']) && $itemdata['major'] == 4 && $itemdata['htype'] == '10') {
2359
+            $input = array(
2360 2360
                 'amount' => array('gid' => true),
2361 2361
                 'where' => array(
2362 2362
                     'section_id=' => $itemdata['epobject_id'],
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
             );
2367 2367
             $next = $this->_get_hansard_data($input);
2368 2368
             if (!empty($next)) {
2369
-                twfy_debug (get_class($this), 'instead of ' . $args['gid'] . ' moving to ' . $next[0]['gid']);
2369
+                twfy_debug(get_class($this), 'instead of ' . $args['gid'] . ' moving to ' . $next[0]['gid']);
2370 2370
                 $args['gid'] = $next[0]['gid'];
2371 2371
                 $this->_get_item($args);
2372 2372
                 throw new RedirectException($args['gid']);
@@ -2418,16 +2418,16 @@  discard block
 block discarded – undo
2418 2418
         // Get the nextprev links for this item, to link to next/prev pages.
2419 2419
         // Duh.
2420 2420
         if ($itemdata['htype'] == '10') {
2421
-            $nextprev = $this->_get_nextprev_items( $sectionrow );
2421
+            $nextprev = $this->_get_nextprev_items($sectionrow);
2422 2422
             $data['info']['text_heading'] = $itemdata['body'];
2423 2423
 
2424 2424
         } elseif ($itemdata['htype'] == '11') {
2425
-            $nextprev = $this->_get_nextprev_items( $subsectionrow );
2425
+            $nextprev = $this->_get_nextprev_items($subsectionrow);
2426 2426
             $data['info']['text_heading'] = $itemdata['body'];
2427 2427
 
2428 2428
         } else {
2429 2429
             // Ordinary lowly item.
2430
-            $nextprev = $this->_get_nextprev_items( $itemdata );
2430
+            $nextprev = $this->_get_nextprev_items($itemdata);
2431 2431
 
2432 2432
             if (isset($subsectionrow['gid'])) {
2433 2433
                 $nextprev['up']['url'] 		= $subsectionrow['listurl'];
@@ -2436,7 +2436,7 @@  discard block
 block discarded – undo
2436 2436
                 $nextprev['up']['url'] 		= $sectionrow['listurl'];
2437 2437
                 $nextprev['up']['title'] 	= $sectionrow['body'];
2438 2438
             }
2439
-            $nextprev['up']['body']		= gettext('See the whole debate');
2439
+            $nextprev['up']['body'] = gettext('See the whole debate');
2440 2440
         }
2441 2441
 
2442 2442
         // We can then access this from $PAGE and the templates.
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
         // Now get all the non-heading rows.
2446 2446
 
2447 2447
         // What data do we want for each item?
2448
-        $amount = array (
2448
+        $amount = array(
2449 2449
             'body' => true,
2450 2450
             'speaker' => true,
2451 2451
             'comment' => true,
@@ -2456,9 +2456,9 @@  discard block
 block discarded – undo
2456 2456
             // This item is a section, so we're displaying all the items within
2457 2457
             // it that aren't within a subsection.
2458 2458
 
2459
-            $input = array (
2459
+            $input = array(
2460 2460
                 'amount' => $amount,
2461
-                'where' => array (
2461
+                'where' => array(
2462 2462
                     'section_id=' => $itemdata['epobject_id'],
2463 2463
                     'subsection_id=' => $itemdata['epobject_id']
2464 2464
                 ),
@@ -2466,15 +2466,15 @@  discard block
 block discarded – undo
2466 2466
             );
2467 2467
 
2468 2468
             $data['rows'] = $this->_get_hansard_data($input);
2469
-            if (!count($data['rows']) || (count($data['rows'])==1 && strstr($data['rows'][0]['body'], 'was asked'))) {
2469
+            if (!count($data['rows']) || (count($data['rows']) == 1 && strstr($data['rows'][0]['body'], 'was asked'))) {
2470 2470
 
2471
-                $input = array (
2472
-                    'amount' => array (
2471
+                $input = array(
2472
+                    'amount' => array(
2473 2473
                         'body' => true,
2474 2474
                         'comment' => true,
2475 2475
                         'excerpt' => true
2476 2476
                     ),
2477
-                    'where' => array (
2477
+                    'where' => array(
2478 2478
                         'section_id='	=> $sectionrow['epobject_id'],
2479 2479
                         'htype='		=> '11',
2480 2480
                         'major='		=> $this->major
@@ -2490,9 +2490,9 @@  discard block
 block discarded – undo
2490 2490
         } elseif ($itemdata['htype'] == '11') {
2491 2491
             // This item is a subsection, so we're displaying everything within it.
2492 2492
 
2493
-            $input = array (
2493
+            $input = array(
2494 2494
                 'amount' => $amount,
2495
-                'where' => array (
2495
+                'where' => array(
2496 2496
                     'subsection_id=' => $itemdata['epobject_id']
2497 2497
                 ),
2498 2498
                 'order' => 'hpos ASC'
@@ -2513,10 +2513,10 @@  discard block
 block discarded – undo
2513 2513
             $subsectionrow['gid'] != $sectionrow['gid']) {
2514 2514
             // If we're looking at a section, there may not be a subsection.
2515 2515
             // And if the subsectionrow and sectionrow aren't the same.
2516
-            array_unshift ($data['rows'], $subsectionrow);
2516
+            array_unshift($data['rows'], $subsectionrow);
2517 2517
         }
2518 2518
 
2519
-        array_unshift ($data['rows'], $sectionrow);
2519
+        array_unshift($data['rows'], $sectionrow);
2520 2520
 
2521 2521
         return $data;
2522 2522
 
@@ -2525,10 +2525,10 @@  discard block
 block discarded – undo
2525 2525
     public function _get_data_by_column($args) {
2526 2526
         global $this_page;
2527 2527
 
2528
-        twfy_debug (get_class($this), "getting data by column");
2528
+        twfy_debug(get_class($this), "getting data by column");
2529 2529
 
2530
-        $input = array( 'amount' => array('body'=>true, 'comment'=>true, 'speaker'=>true),
2531
-        'where' => array( 'hdate='=>$args['date'], 'major=' => $this->major, 'gid LIKE ' =>'%.'.$args['column'].'.%' ),
2530
+        $input = array('amount' => array('body'=>true, 'comment'=>true, 'speaker'=>true),
2531
+        'where' => array('hdate='=>$args['date'], 'major=' => $this->major, 'gid LIKE ' =>'%.' . $args['column'] . '.%'),
2532 2532
         'order' => 'hpos'
2533 2533
         );
2534 2534
         $data = $this->_get_hansard_data($input);
@@ -2608,8 +2608,8 @@  discard block
 block discarded – undo
2608 2608
     public function get_gid_from_spid($spid) {
2609 2609
         // Fix the common errors of S.0 instead of S.O and leading
2610 2610
         // zeros in the numbers:
2611
-        $fixed_spid = preg_replace('/(S[0-9]+)0-([0-9]+)/','${1}O-${2}',$spid);
2612
-        $fixed_spid = preg_replace('/(S[0-9]+\w+)-0*([0-9]+)/','${1}-${2}',$fixed_spid);
2611
+        $fixed_spid = preg_replace('/(S[0-9]+)0-([0-9]+)/', '${1}O-${2}', $spid);
2612
+        $fixed_spid = preg_replace('/(S[0-9]+\w+)-0*([0-9]+)/', '${1}-${2}', $fixed_spid);
2613 2613
         $q = $this->db->query(
2614 2614
             "select mentioned_gid from mentions where gid = :gid_from_spid and (type = 4 or type = 6)",
2615 2615
             array(':gid_from_spid' => 'uk.org.publicwhip/spq/' . $fixed_spid)
@@ -2688,10 +2688,10 @@  discard block
 block discarded – undo
2688 2688
                         ", array(':major' => $this->major));
2689 2689
 
2690 2690
         // What we return.
2691
-        $data = array ();
2691
+        $data = array();
2692 2692
         $speeches = array();
2693 2693
         foreach ($q as $row) {
2694
-            $speech = array (
2694
+            $speech = array(
2695 2695
                 'subsection_id' => $row['subsection_id'],
2696 2696
                 'section_id' => $row['section_id'],
2697 2697
                 'htype' => $row['htype'],
@@ -2704,9 +2704,9 @@  discard block
 block discarded – undo
2704 2704
 
2705 2705
             // Remove the "uk.org.publicwhip/blah/" from the gid:
2706 2706
             // (In includes/utility.php)
2707
-            $speech['gid'] = fix_gid_from_db( $row['gid'] );
2707
+            $speech['gid'] = fix_gid_from_db($row['gid']);
2708 2708
             $speech['listurl'] = $this->_get_listurl($speech);
2709
-            $speech['speaker'] = $this->_get_speaker($row['person_id'], $row['hdate'], $row['htime'], $this->major );
2709
+            $speech['speaker'] = $this->_get_speaker($row['person_id'], $row['hdate'], $row['htime'], $this->major);
2710 2710
             $speeches[] = $speech;
2711 2711
         }
2712 2712
 
@@ -2714,10 +2714,10 @@  discard block
 block discarded – undo
2714 2714
             // Get the subsection texts.
2715 2715
 
2716 2716
             $num_speeches = count($speeches);
2717
-            for ($n=0; $n<$num_speeches; $n++) {
2717
+            for ($n = 0; $n < $num_speeches; $n++) {
2718 2718
                 //if ($this->major == 1) {
2719 2719
                     // Debate.
2720
-                    $parent = $this->_get_subsection ($speeches[$n]);
2720
+                    $parent = $this->_get_subsection($speeches[$n]);
2721 2721
 
2722 2722
                 //} elseif ($this->major == 3) {
2723 2723
                     // Wrans.
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
             $data['rows'] = $speeches;
2737 2737
 
2738 2738
         } else {
2739
-            $data['rows'] = array ();
2739
+            $data['rows'] = array();
2740 2740
         }
2741 2741
 
2742 2742
         $data['info']['days'] = $days;
@@ -2753,13 +2753,13 @@  discard block
 block discarded – undo
2753 2753
     }
2754 2754
 
2755 2755
 
2756
-    public function biggest_debates($args=array()) {
2756
+    public function biggest_debates($args = array()) {
2757 2757
         // So we can just get the data back for special formatting
2758 2758
         // on the front page, without doing the whole display() thing.
2759 2759
         return $this->_get_data_by_biggest_debates($args);
2760 2760
     }
2761 2761
 
2762
-    public function _get_data_by_featured_gid($args=array()) {
2762
+    public function _get_data_by_featured_gid($args = array()) {
2763 2763
         $params = array();
2764 2764
         $data = array();
2765 2765
 
@@ -2788,18 +2788,18 @@  discard block
 block discarded – undo
2788 2788
         if ($q) {
2789 2789
 
2790 2790
             // This array just used for getting further data about this debate.
2791
-            $item_data = array (
2791
+            $item_data = array(
2792 2792
                 'major'         => $this->major,
2793 2793
                 'minor'         => $q['minor'],
2794
-                'gid'           => fix_gid_from_db( $q['gid'] ),
2794
+                'gid'           => fix_gid_from_db($q['gid']),
2795 2795
                 'htype'         => $q['htype'],
2796 2796
                 'section_id'    => $q['section_id'],
2797 2797
                 'subsection_id' => $q['subsection_id'],
2798 2798
                 'epobject_id'   => $q['epobject_id']
2799 2799
             );
2800 2800
 
2801
-            $list_url      = $this->_get_listurl( $item_data );
2802
-            $totalcomments = $this->_get_comment_count_for_epobject( $item_data );
2801
+            $list_url      = $this->_get_listurl($item_data);
2802
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
2803 2803
 
2804 2804
             $body          = $q['body'];
2805 2805
             $hdate         = $q['hdate'];
@@ -2819,21 +2819,21 @@  discard block
 block discarded – undo
2819 2819
                                     ':subsection_id' => $item_data['subsection_id'],
2820 2820
                                 )
2821 2821
                             )->first();
2822
-                $section_body  = $r['sec_body'];
2822
+                $section_body = $r['sec_body'];
2823 2823
                 $subsection_body = $r['sub_body'];
2824
-                if ( $section_body && $subsection_body ) {
2824
+                if ($section_body && $subsection_body) {
2825 2825
                     $parentbody = "$section_body : $subsection_body";
2826 2826
                 } else {
2827 2827
                     $parentbody = "$section_body$subsection_body";
2828 2828
                 }
2829
-            } else if ( $item_data['htype'] == 10 ) {
2829
+            } else if ($item_data['htype'] == 10) {
2830 2830
                 $parentbody = $body;
2831 2831
             }
2832 2832
 
2833 2833
             // Get the question for this item.
2834
-            if ( $item_data['htype'] == 12 ) {
2834
+            if ($item_data['htype'] == 12) {
2835 2835
                 $childbody = $body;
2836
-                $speaker = $this->_get_speaker($q['person_id'], $q['hdate'], $q['htime'], $this->major );
2836
+                $speaker = $this->_get_speaker($q['person_id'], $q['hdate'], $q['htime'], $this->major);
2837 2837
             } else {
2838 2838
                 $r = $this->db->query("SELECT e.body, e.title,
2839 2839
                                         h.person_id, h.hdate, h.htime
@@ -2843,10 +2843,10 @@  discard block
 block discarded – undo
2843 2843
                                 ORDER BY hpos
2844 2844
                                 LIMIT 1
2845 2845
                                 ",
2846
-                                array( ':object_id' => $item_data['epobject_id'] )
2846
+                                array(':object_id' => $item_data['epobject_id'])
2847 2847
                 )->first();
2848 2848
                 $childbody = $r['body'];
2849
-                $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
2849
+                $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
2850 2850
             }
2851 2851
 
2852 2852
             $contentcount = 0;
@@ -2862,7 +2862,7 @@  discard block
 block discarded – undo
2862 2862
             }
2863 2863
 
2864 2864
             global $hansardmajors;
2865
-            $more_url = new \MySociety\TheyWorkForYou\Url( $hansardmajors[$this->major]['page_all'] );
2865
+            $more_url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$this->major]['page_all']);
2866 2866
             $details = array(
2867 2867
                 'body'          => $body,
2868 2868
                 'contentcount'  => $contentcount,
@@ -2881,7 +2881,7 @@  discard block
 block discarded – undo
2881 2881
                 'more_url' => $more_url->generate()
2882 2882
             );
2883 2883
 
2884
-            $data = array (
2884
+            $data = array(
2885 2885
                 'gid' => $args['gid'],
2886 2886
                 'major' => $this->major,
2887 2887
                 'info' => array(),
@@ -2892,7 +2892,7 @@  discard block
 block discarded – undo
2892 2892
         return $data;
2893 2893
 
2894 2894
     }
2895
-    public function _get_data_by_recent_debates($args=array()) {
2895
+    public function _get_data_by_recent_debates($args = array()) {
2896 2896
         // Returns an array of some random recent debates from a set number of
2897 2897
         // recent days (that's recent days starting from the most recent day
2898 2898
         // that had any debates on).
@@ -2954,17 +2954,17 @@  discard block
 block discarded – undo
2954 2954
         foreach ($q as $row) {
2955 2955
 
2956 2956
             // This array just used for getting further data about this debate.
2957
-            $item_data = array (
2957
+            $item_data = array(
2958 2958
                 'major' => $this->major,
2959
-                'gid' => fix_gid_from_db( $row['gid'] ),
2959
+                'gid' => fix_gid_from_db($row['gid']),
2960 2960
                 'htype' => $row['htype'],
2961 2961
                 'section_id' => $row['section_id'],
2962 2962
                 'subsection_id' => $row['subsection_id'],
2963 2963
                 'epobject_id' => $row['epobject_id']
2964 2964
             );
2965 2965
 
2966
-            $list_url      = $this->_get_listurl( $item_data );
2967
-            $totalcomments = $this->_get_comment_count_for_epobject( $item_data );
2966
+            $list_url      = $this->_get_listurl($item_data);
2967
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
2968 2968
 
2969 2969
             $contentcount  = $row['count'];
2970 2970
             $body          = $row['body'];
@@ -2992,7 +2992,7 @@  discard block
 block discarded – undo
2992 2992
                             LIMIT 1
2993 2993
                             ")->first();
2994 2994
             $childbody = $r['body'];
2995
-            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
2995
+            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
2996 2996
 
2997 2997
             $data[] = array(
2998 2998
                 'contentcount'  => $contentcount,
@@ -3012,7 +3012,7 @@  discard block
 block discarded – undo
3012 3012
 
3013 3013
         }
3014 3014
 
3015
-        $data = array (
3015
+        $data = array(
3016 3016
             'info' => array(),
3017 3017
             'data' => $data
3018 3018
         );
@@ -3021,7 +3021,7 @@  discard block
 block discarded – undo
3021 3021
 
3022 3022
     }
3023 3023
 
3024
-    public function _get_data_by_biggest_debates($args=array()) {
3024
+    public function _get_data_by_biggest_debates($args = array()) {
3025 3025
         // Returns an array of the debates with most speeches in from
3026 3026
         // a set number of recent days (that's recent days starting from the
3027 3027
         // most recent day that had any debates on).
@@ -3076,17 +3076,17 @@  discard block
 block discarded – undo
3076 3076
         foreach ($q as $row) {
3077 3077
 
3078 3078
             // This array just used for getting further data about this debate.
3079
-            $item_data = array (
3079
+            $item_data = array(
3080 3080
                 'major' => $this->major,
3081
-                'gid' => fix_gid_from_db( $row['gid'] ),
3081
+                'gid' => fix_gid_from_db($row['gid']),
3082 3082
                 'htype' => $row['htype'],
3083 3083
                 'section_id' => $row['section_id'],
3084 3084
                 'subsection_id' => $row['subsection_id'],
3085 3085
                 'epobject_id' => $row['epobject_id']
3086 3086
             );
3087 3087
 
3088
-            $list_url 		= $this->_get_listurl( $item_data );
3089
-            $totalcomments	= $this->_get_comment_count_for_epobject( $item_data );
3088
+            $list_url = $this->_get_listurl($item_data);
3089
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3090 3090
 
3091 3091
             $contentcount = $row['count'];
3092 3092
             $body = $row['body'];
@@ -3094,7 +3094,7 @@  discard block
 block discarded – undo
3094 3094
 
3095 3095
 
3096 3096
             // This array will be added to $data, which is what gets returned.
3097
-            $debate = array (
3097
+            $debate = array(
3098 3098
                 'contentcount'	=> $contentcount,
3099 3099
                 'body'			=> $body,
3100 3100
                 'hdate'			=> $hdate,
@@ -3122,7 +3122,7 @@  discard block
 block discarded – undo
3122 3122
                             LIMIT 1
3123 3123
                             ")->first();
3124 3124
             $childbody = $r['body'];
3125
-            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
3125
+            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
3126 3126
 
3127 3127
             $debate['child'] = array(
3128 3128
                 'body' => $childbody,
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
             $data[] = $debate;
3133 3133
         }
3134 3134
 
3135
-        $data = array (
3135
+        $data = array(
3136 3136
             'info' => array(),
3137 3137
             'data' => $data
3138 3138
         );
@@ -3155,7 +3155,7 @@  discard block
 block discarded – undo
3155 3155
         return $q->first()['count'];
3156 3156
     }
3157 3157
 
3158
-    public function _get_data_by_recent_wrans ($args=array()) {
3158
+    public function _get_data_by_recent_wrans($args = array()) {
3159 3159
         global $hansardmajors;
3160 3160
 
3161 3161
         // $args['days'] is the number of days back to look for biggest debates.
@@ -3220,17 +3220,17 @@  discard block
 block discarded – undo
3220 3220
 
3221 3221
         foreach ($q as $row) {
3222 3222
             // This array just used for getting further data about this debate.
3223
-            $item_data = array (
3223
+            $item_data = array(
3224 3224
                 'major' => $this->major,
3225
-                'gid' => fix_gid_from_db( $row['gid'] ),
3225
+                'gid' => fix_gid_from_db($row['gid']),
3226 3226
                 'htype' => $row['htype'],
3227 3227
                 'section_id' => $row['section_id'],
3228 3228
                 'subsection_id' => $row['subsection_id'],
3229 3229
                 'epobject_id' => $row['epobject_id']
3230 3230
             );
3231 3231
 
3232
-            $list_url 		= $this->_get_listurl( $item_data );
3233
-            $totalcomments	= $this->_get_comment_count_for_epobject( $item_data );
3232
+            $list_url = $this->_get_listurl($item_data);
3233
+            $totalcomments = $this->_get_comment_count_for_epobject($item_data);
3234 3234
 
3235 3235
             $body = $row['body'];
3236 3236
             $hdate = $row['hdate'];
@@ -3256,25 +3256,25 @@  discard block
 block discarded – undo
3256 3256
                             LIMIT 1
3257 3257
                             ")->first();
3258 3258
             $childbody = $r['body'];
3259
-            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major );
3259
+            $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major);
3260 3260
 
3261
-            $data[] = array (
3261
+            $data[] = array(
3262 3262
                 'body'			=> $body,
3263 3263
                 'hdate'			=> $hdate,
3264 3264
                 'list_url'		=> $list_url,
3265 3265
                 'totalcomments'	=> $totalcomments,
3266
-                'child'			=> array (
3266
+                'child'			=> array(
3267 3267
                     'body'		=> $childbody,
3268 3268
                     'speaker'	=> $speaker
3269 3269
                 ),
3270
-                'parent'		=> array (
3270
+                'parent'		=> array(
3271 3271
                     'body'		=> $parentbody
3272 3272
                 )
3273 3273
             );
3274 3274
 
3275 3275
         }
3276 3276
 
3277
-        $data = array (
3277
+        $data = array(
3278 3278
             'info' => array(),
3279 3279
             'data' => $data
3280 3280
         );
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
     public $commentspage = 'pbc_speech';
3292 3292
     public $gidprefix = 'uk.org.publicwhip/standing/';
3293 3293
 
3294
-    public function __construct($session='', $title='') {
3294
+    public function __construct($session = '', $title = '') {
3295 3295
         parent::__construct();
3296 3296
         $this->bill_title = $title;
3297 3297
         $title = str_replace(' ', '_', $title);
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
     }
3300 3300
 
3301 3301
     public function _get_committee($bill_id) {
3302
-        include_once INCLUDESPATH."easyparliament/member.php";
3302
+        include_once INCLUDESPATH . "easyparliament/member.php";
3303 3303
         $q = $this->db->query(
3304 3304
             'select count(*) as c from hansard
3305 3305
                 where major=6 and minor=:bill_id and htype=10',
@@ -3333,13 +3333,13 @@  discard block
 block discarded – undo
3333 3333
     public function _get_data_by_bill($args) {
3334 3334
         global $DATA, $this_page;
3335 3335
         $data = array();
3336
-        $input = array (
3337
-            'amount' => array (
3336
+        $input = array(
3337
+            'amount' => array(
3338 3338
                 'body' => true,
3339 3339
                 'comment' => true,
3340 3340
                 'excerpt' => true
3341 3341
             ),
3342
-            'where' => array (
3342
+            'where' => array(
3343 3343
                 'htype=' => '10',
3344 3344
                 'major=' => $this->major,
3345 3345
                 'minor=' => $args['id'],
@@ -3350,18 +3350,18 @@  discard block
 block discarded – undo
3350 3350
         if (count($sections) > 0) {
3351 3351
             $data['rows'] = array();
3352 3352
             $num_sections = count($sections);
3353
-            for ($n=0; $n<$num_sections; $n++) {
3353
+            for ($n = 0; $n < $num_sections; $n++) {
3354 3354
                 $sectionrow = $sections[$n];
3355 3355
                 list($sitting, $part) = $this->_get_sitting($sectionrow['gid']);
3356 3356
                 $sectionrow['sitting'] = $sitting;
3357 3357
                 $sectionrow['part'] = $part;
3358
-                $input = array (
3359
-                    'amount' => array (
3358
+                $input = array(
3359
+                    'amount' => array(
3360 3360
                         'body' => true,
3361 3361
                         'comment' => true,
3362 3362
                         'excerpt' => true
3363 3363
                     ),
3364
-                    'where' => array (
3364
+                    'where' => array(
3365 3365
                         'section_id='	=> $sectionrow['epobject_id'],
3366 3366
                         'htype='	=> '11',
3367 3367
                         'major='	=> $this->major
@@ -3369,8 +3369,8 @@  discard block
 block discarded – undo
3369 3369
                     'order' => 'hpos'
3370 3370
                 );
3371 3371
                 $rows = $this->_get_hansard_data($input);
3372
-                array_unshift ($rows, $sectionrow);
3373
-                $data['rows'] = array_merge ($data['rows'], $rows);
3372
+                array_unshift($rows, $sectionrow);
3373
+                $data['rows'] = array_merge($data['rows'], $rows);
3374 3374
             }
3375 3375
         }
3376 3376
         $data['info']['bill'] = $args['title'];
@@ -3426,8 +3426,8 @@  discard block
 block discarded – undo
3426 3426
 
3427 3427
         $YEARURL = new \MySociety\TheyWorkForYou\Url('pbc_session');
3428 3428
         $nextprev = array();
3429
-        $nextprev['prev'] = array ('body' => 'Previous session', 'title'=>'');
3430
-        $nextprev['next'] = array ('body' => 'Next session', 'title'=>'');
3429
+        $nextprev['prev'] = array('body' => 'Previous session', 'title'=>'');
3430
+        $nextprev['next'] = array('body' => 'Next session', 'title'=>'');
3431 3431
         $q = $this->db->query(
3432 3432
             "SELECT session FROM bills WHERE session < :session ORDER BY session DESC LIMIT 1",
3433 3433
             array(':session' => $session)
@@ -3464,13 +3464,13 @@  discard block
 block discarded – undo
3464 3464
             $session = $qq['session'];
3465 3465
             list($sitting, $part) = $this->_get_sitting($gid);
3466 3466
             $sitting_txt = make_ranking($sitting) . ' sitting';
3467
-            if ($part>0) {
3467
+            if ($part > 0) {
3468 3468
                 $sitting .= ", part $part";
3469 3469
             }
3470 3470
             $data[$hdate][] = array(
3471 3471
                 'bill'=> $title,
3472 3472
                 'sitting' => $sitting_txt,
3473
-                'url' => "/pbc/$session/" . urlencode(str_replace(' ','_',$title)) . '/#sitting' . $sitting,
3473
+                'url' => "/pbc/$session/" . urlencode(str_replace(' ', '_', $title)) . '/#sitting' . $sitting,
3474 3474
             );
3475 3475
         }
3476 3476
         return $data;
@@ -3479,7 +3479,7 @@  discard block
 block discarded – undo
3479 3479
     # Given a GID, parse out the sitting number and optional part from it
3480 3480
     public function _get_sitting($gid) {
3481 3481
         if (preg_match('#_(\d\d)-(\d)_#', $gid, $m)) {
3482
-            return array($m[1]+0, $m[2]);
3482
+            return array($m[1] + 0, $m[2]);
3483 3483
         }
3484 3484
         return array(0, 0);
3485 3485
     }
Please login to merge, or discard this patch.
www/includes/easyparliament/alert.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public $token_checked = null;
42 42
     private $alert_id = "";
43 43
     public $email = "";
44
-    public $criteria = "";		// Sets the terms that are used to produce the search results.
44
+    public $criteria = ""; // Sets the terms that are used to produce the search results.
45 45
 
46 46
     private $db;
47 47
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             $contents = array('criteria' => $row['criteria'], 'count' => $row['cnt']);
73 73
             $data[] = $contents;
74 74
         }
75
-        $data = array ('alerts' => $data);
75
+        $data = array('alerts' => $data);
76 76
         return $data;
77 77
     }
78 78
 
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
         $data = $q->fetchAll();
102 102
         $info = "Alert";
103
-        $data = array ('info' => $info, 'data' => $data);
103
+        $data = array('info' => $info, 'data' => $data);
104 104
 
105 105
         return $data;
106 106
     }
107 107
 
108
-    public function add($details, $confirmation_email=false, $instantly_confirm=true) {
108
+    public function add($details, $confirmation_email = false, $instantly_confirm = true) {
109 109
 
110 110
         // Adds a new alert's info into the database.
111 111
         // Then calls another function to send them a confirmation email.
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             // This gives a code for their email address which is then joined
171 171
             // to the timestamp so as to provide a unique ID for each alert.
172 172
 
173
-            $token = substr( password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16 );
173
+            $token = substr(password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16);
174 174
 
175 175
             // Full stops don't work well at the end of URLs in emails, so
176 176
             // replace them. And double slash would be treated as single and
@@ -244,19 +244,19 @@  discard block
 block discarded – undo
244 244
 
245 245
         $urltoken = $this->alert_id . '-' . $this->registrationtoken;
246 246
 
247
-        if ( isset($details['confirm_base']) && $details['confirm_base'] !== '' ) {
247
+        if (isset($details['confirm_base']) && $details['confirm_base'] !== '') {
248 248
             $confirmurl = $details['confirm_base'] . $urltoken;
249 249
         } else {
250 250
             $confirmurl = 'https://' . DOMAIN . '/A/' . $urltoken;
251 251
         }
252 252
 
253 253
         // Arrays we need to send a templated email.
254
-        $data = array (
254
+        $data = array(
255 255
             'to' 		=> $details['email'],
256 256
             'template' 	=> 'alert_confirmation'
257 257
         );
258 258
 
259
-        $merge = array (
259
+        $merge = array(
260 260
             'CONFIRMURL'	=> $confirmurl,
261 261
             'CRITERIA'	=> $this->criteria_pretty()
262 262
         );
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     }
271 271
 
272 272
     public function send_already_signedup_email($details) {
273
-        $data = array (
273
+        $data = array(
274 274
             'to' 		=> $details['email'],
275 275
             'template' 	=> 'alert_already_signedup'
276 276
         );
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details);
279 279
         $this->criteria = $criteria;
280 280
 
281
-        $merge = array (
281
+        $merge = array(
282 282
             'CRITERIA'	=> $this->criteria_pretty()
283 283
         );
284 284
 
@@ -449,20 +449,20 @@  discard block
 block discarded – undo
449 449
     public function email() { return $this->email; }
450 450
     public function criteria() { return $this->criteria; }
451 451
     public function criteria_pretty($html = false) {
452
-        $criteria = explode(' ',$this->criteria);
452
+        $criteria = explode(' ', $this->criteria);
453 453
         $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($this->criteria));
454 454
         $words = array();
455 455
         foreach ($criteria as $c) {
456
-            if (!preg_match('#^speaker:(\d+)#',$c,$m)) {
456
+            if (!preg_match('#^speaker:(\d+)#', $c, $m)) {
457 457
                 $words[] = $c;
458 458
             }
459 459
         }
460 460
         $criteria = '';
461 461
         if (count($words)) {
462
-            $criteria .= ($html?'<li>':'* ') . sprintf(gettext('Mentions of [%s]'), implode(' ', $words)) . ($html?'</li>':'') . "\n";
462
+            $criteria .= ($html ? '<li>' : '* ') . sprintf(gettext('Mentions of [%s]'), implode(' ', $words)) . ($html ? '</li>' : '') . "\n";
463 463
         }
464 464
         if ($spokenby) {
465
-            $criteria .= ($html?'<li>':'* ') . sprintf(gettext("Things by %s"), implode(' or ', $spokenby)) . ($html?'</li>':'') . "\n";
465
+            $criteria .= ($html ? '<li>' : '* ') . sprintf(gettext("Things by %s"), implode(' or ', $spokenby)) . ($html ? '</li>' : '') . "\n";
466 466
         }
467 467
         return $criteria;
468 468
     }
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/homepage/recent-votes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if ( count($divisions) > 0 ) { ?>
1
+<?php if (count($divisions) > 0) { ?>
2 2
     <h2 style="position: relative;">
3 3
         <?= gettext('Recent Votes') ?>
4 4
         <div class="meta excerpt__category"><a href="/divisions/"><?= gettext('Show all recent votes') ?></a></div>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/alert/index.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
       <?php } ?>
117 117
 
118 118
       <?php
119
-          if(
120
-              $members ||
119
+            if(
120
+                $members ||
121 121
               (isset($constituencies) && count($constituencies) > 0) ||
122 122
               ($alertsearch)
123
-          ) {
124
-              /* We need to disambiguate the user's instructions */
125
-              $member_options = false;
126
-      ?>
123
+            ) {
124
+                /* We need to disambiguate the user's instructions */
125
+                $member_options = false;
126
+        ?>
127 127
         <div class="alert-section alert-section--disambiguation">
128 128
             <div class="alert-section__primary">
129 129
 
130 130
               <?php if ($members) {
131
-                  $member_options = true; ?>
131
+                    $member_options = true; ?>
132 132
                 <h3><?= sprintf(gettext('Sign up for alerts when people matching <i>%s</i> speaks'), _htmlspecialchars($alertsearch)) ?></h3>
133 133
                 <ul>
134 134
                   <?php
135 135
                     foreach ($members as $row) {
136
-                  ?>
136
+                    ?>
137 137
                     <li>
138 138
                         <form action="<?= $actionurl ?>" method="post">
139 139
                             <input type="hidden" name="t" value="<?= _htmlspecialchars($token) ?>">
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
               <?php } ?>
155 155
 
156 156
               <?php if (isset($constituencies) && count($constituencies) > 0) {
157
-                  $member_options = true; ?>
157
+                    $member_options = true; ?>
158 158
                 <h3><?= sprintf(gettext('Sign up for alerts when MPs for constituencies matching <i>%s</i> speaks'), _htmlspecialchars($alertsearch)) ?></h3>
159 159
                 <ul>
160 160
                 <?php foreach ($constituencies as $constituency => $member) { ?>
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                             are mentioned in the same debate.') ?>
204 204
                           <?php if (isset($member_alertsearch)) {
205 205
                                 printf(gettext('Did you mean to get alerts for when your representative mentions something instead? If so maybe you want to subscribe to…'));
206
-                          } ?>
206
+                            } ?>
207 207
                         </em>
208 208
                       <?php } ?>
209 209
                     </li>
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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><?= gettext('Your alert has been confirmed') ?></h3>
20 20
                 <p>
21 21
                     <?= gettext('You will now receive email alerts for the following criteria:') ?>
@@ -44,31 +44,31 @@  discard block
 block discarded – undo
44 44
                 </div>
45 45
                 </noscript>
46 46
 
47
-              <?php } elseif ( $results == 'alert-suspended' ) { ?>
47
+              <?php } elseif ($results == 'alert-suspended') { ?>
48 48
                 <h3><?= gettext('Alert suspended') ?></h3>
49 49
                 <p>
50 50
                     <?= gettext('You can reactivate the alert at any time, from the sidebar below.') ?>
51 51
                 </p>
52 52
 
53
-              <?php } elseif ( $results == 'alert-resumed' ) { ?>
53
+              <?php } elseif ($results == 'alert-resumed') { ?>
54 54
                 <h3><?= gettext('Alert resumed') ?></h3>
55 55
                 <p>
56 56
                     <?= gettext('You will now receive email alerts on any day when there are entries in Hansard that match your criteria.') ?>
57 57
                 </p>
58 58
 
59
-              <?php } elseif ( $results == 'alert-deleted' ) { ?>
59
+              <?php } elseif ($results == 'alert-deleted') { ?>
60 60
                 <h3><?= gettext('Alert deleted') ?></h3>
61 61
                 <p>
62 62
                     <?= gettext('You will no longer receive this alert.') ?>
63 63
                 </p>
64 64
 
65
-              <?php } elseif ( $results == 'all-alerts-deleted' ) { ?>
65
+              <?php } elseif ($results == 'all-alerts-deleted') { ?>
66 66
                 <h3><?= gettext('All alerts deleted') ?></h3>
67 67
                 <p>
68 68
                     <?= gettext('You will no longer receive any alerts.') ?>
69 69
                 </p>
70 70
 
71
-              <?php } elseif ( $results == 'alert-fail' ) { ?>
71
+              <?php } elseif ($results == 'alert-fail') { ?>
72 72
                 <h3><?= gettext('Hmmm, something’s not right') ?></h3>
73 73
                 <p>
74 74
                     <?= gettext('The link you followed to reach this page appears to be incomplete.') ?>
@@ -80,31 +80,31 @@  discard block
 block discarded – undo
80 80
                     <?= sprintf(gettext('If you still get this message, please do <a href="mailto:%s">email us</a> and let us know, and we’ll help out!'), str_replace('@', '&#64;', CONTACTEMAIL)) ?>
81 81
                 </p>
82 82
 
83
-              <?php } elseif ( $results == 'alert-added' ) { ?>
83
+              <?php } elseif ($results == 'alert-added') { ?>
84 84
                 <h3><?= gettext('Your alert has been added') ?></h3>
85 85
                 <p>
86 86
                     <?= sprintf(gettext('You will now receive email alerts on any day when %s in parliament.'), _htmlspecialchars($criteria)) ?>
87 87
                 </p>
88 88
 
89
-              <?php } elseif ( $results == 'alert-confirmation' ) { ?>
89
+              <?php } elseif ($results == 'alert-confirmation') { ?>
90 90
                 <h3><?= gettext('We’re nearly done…') ?></h3>
91 91
                 <p>
92 92
                     <?= gettext('You should receive an email shortly which will contain a link. You will need to follow that link to confirm your email address and receive future alerts. Thanks.') ?>
93 93
                 </p>
94 94
 
95
-              <?php } elseif ( $results == 'alert-exists' ) { ?>
95
+              <?php } elseif ($results == 'alert-exists') { ?>
96 96
                 <h3><?= gettext('You’re already subscribed to that!') ?></h3>
97 97
                 <p>
98 98
                     <?= gettext('It’s good to know you’re keen though.') ?>
99 99
                 </p>
100 100
 
101
-              <?php } elseif ( $results == 'alert-already-signed' ) { ?>
101
+              <?php } elseif ($results == 'alert-already-signed') { ?>
102 102
                 <h3><?= gettext('We’re nearly done') ?></h3>
103 103
                 <p>
104 104
                     <?= gettext('You should receive an email shortly which will contain a link. You will need to follow that link to confirm your email address and receive future alerts. Thanks.') ?>
105 105
                 </p>
106 106
 
107
-              <?php } elseif ( $results == 'alert-fail' ) { ?>
107
+              <?php } elseif ($results == 'alert-fail') { ?>
108 108
                 <h3><?= gettext('Alert could not be created') ?></h3>
109 109
                 <p>
110 110
                     <?= sprintf(gettext('Sorry, we were unable to create that alert. Please <a href="mailto:%s">let us know</a>. Thanks.'), str_replace('@', '&#64;', CONTACTEMAIL)) ?>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
       <?php } ?>
117 117
 
118 118
       <?php
119
-          if(
119
+          if (
120 120
               $members ||
121 121
               (isset($constituencies) && count($constituencies) > 0) ||
122 122
               ($alertsearch)
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
               <?php } ?>
173 173
 
174 174
               <?php if ($alertsearch) {
175
-                if ( $member_options ) { ?>
175
+                if ($member_options) { ?>
176 176
                 <h3><?= gettext('Sign up for alerts for topics') ?></h3>
177 177
                 <?php } else { ?>
178 178
                 <h3><?= gettext('Great! Can you just confirm what you mean?') ?></h3>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                             <?= sprintf(gettext('Receive alerts when %s'), _htmlspecialchars($alertsearch_pretty)) ?>
187 187
                             <input type="submit" class="button small" value="<?= gettext('Subscribe') ?>">
188 188
                         </form>
189
-                      <?php if ( isset($mistakes['multiple']) ) { ?>
189
+                      <?php if (isset($mistakes['multiple'])) { ?>
190 190
                         <em class="error"><?= gettext('
191 191
                             You have used a comma in your search term –
192 192
                             are you sure this is what you want? You cannot
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                             for each individual term.') ?>
196 196
                         </em>
197 197
                       <?php } ?>
198
-                      <?php if ( isset($mistakes['postcode_and']) ) { ?>
198
+                      <?php if (isset($mistakes['postcode_and'])) { ?>
199 199
                         <em class="error"><?= gettext('
200 200
                             You have used a postcode and something else in your
201 201
                             search term – are you sure this is what you
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
             <div class="alert-section__secondary">
254 254
               <?php if ($email_verified) { ?>
255 255
 
256
-                  <?php if ( $alerts ) { ?>
256
+                  <?php if ($alerts) { ?>
257 257
                     <?php include('_list.php'); ?>
258 258
                   <?php } ?>
259 259
 
260
-                  <?php if ( $current_mp ) { ?>
260
+                  <?php if ($current_mp) { ?>
261 261
                     <h3><?= gettext('Your MP alert') ?></h3>
262 262
                     <ul class="alerts-manage__list">
263 263
                         <li>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/alert/_list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <h3><?= gettext('Your current email alerts') ?></h3>
2 2
 
3 3
 <ul class="alerts-manage__list">
4
-  <?php foreach ( $alerts as $alert ) { ?>
4
+  <?php foreach ($alerts as $alert) { ?>
5 5
     <li>
6 6
         <?= sprintf(gettext('When %s'), _htmlspecialchars($alert['criteria'])) ?>.
7 7
         <form action="<?= $actionurl ?>" method="POST">
8 8
             <input type="hidden" name="t" value="<?= _htmlspecialchars($alert['token']) ?>">
9
-          <?php if ( $alert['status'] == 'unconfirmed' ) { ?>
9
+          <?php if ($alert['status'] == 'unconfirmed') { ?>
10 10
             <input type="submit" class="button small" name="action" value="<?= gettext('Confirm') ?>">
11
-          <?php } elseif ( $alert['status'] == 'suspended' ) { ?>
11
+          <?php } elseif ($alert['status'] == 'suspended') { ?>
12 12
             <input type="submit" class="button small" name="action" value="<?= gettext('Resume') ?>">
13 13
           <?php } else { ?>
14 14
             <input type="submit" class="button button--secondary small" name="action" value="<?= gettext('Suspend') ?>">
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/form_main.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
             <input type="text" name="q" value="<?= _htmlentities($search_keyword) ?>" class="form-control">
5 5
             <input type="submit" class="button" value="<?= gettext('Search') ?>">
6 6
         </p>
7
-      <?php if (isset($warnings) ) { ?>
7
+      <?php if (isset($warnings)) { ?>
8 8
         <p class="error">
9 9
             <?= $warnings ?>
10 10
         </p>
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         <p>
19 19
             <ul class="search-result-display-options">
20 20
                 <li><a href="#options" class="search-options-toggle js-toggle-search-options"><?= gettext('Advanced search') ?></a></li>
21
-              <?php if ( $is_adv ) { ?>
21
+              <?php if ($is_adv) { ?>
22 22
                 <?= $search_phrase ? '<li>' . gettext('Exactly:') . ' ' . _htmlentities($search_phrase) . '</li>' : '' ?>
23 23
                 <?= $search_exclude ? '<li>' . gettext('Excluding:') . ' ' . _htmlentities($search_exclude) . '</li>' : '' ?>
24 24
                 <?= $search_from ? '<li>' . gettext('From:') . ' ' . _htmlentities($search_from) . '</li>' : '' ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/person.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
     <img src="<?= $member->image()['url'] ?>" alt="">
3 3
     <h3 class="search-result__title"><a href="<?= $member->url() ?>"><?= $member->full_name() ?></a></h3>
4 4
     <?php $latest_membership = $member->getMostRecentMembership(); ?>
5
-    <?php if ( $latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL ) { ?>
5
+    <?php if ($latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL) { ?>
6 6
         <p class="search-result__description">
7 7
             <?= $latest_membership['current'] ? '' : 'Former' ?>
8 8
             <?= $latest_membership['party'] == 'Bishop' ? '' : $latest_membership['party'] ?>
9 9
             <?= $latest_membership['rep_name'] ?>
10
-            <?php if ( $latest_membership['constituency'] ) { ?>
10
+            <?php if ($latest_membership['constituency']) { ?>
11 11
                 <?= sprintf(gettext('for %s'), $latest_membership['constituency']) ?>
12 12
             <?php } ?>
13 13
             (<?= format_date($latest_membership['start_date'], SHORTDATEFORMAT) ?> – <?= $latest_membership['current'] ? gettext('current') : format_date($latest_membership['end_date'], SHORTDATEFORMAT); ?>)
Please login to merge, or discard this patch.