Passed
Push — master ( 9b6994...2073b4 )
by Struan
17:27
created
www/includes/easyparliament/templates/api/hansard_gid.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,4 +67,4 @@
 block discarded – undo
67 67
     api_output($out);
68 68
 } else {
69 69
     api_error('Nothing');
70
-   }
70
+    }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 if (isset ($data['rows'])) {
15 15
     for ($i=0; $i<count($data['rows']); $i++) {
16 16
         $row = $data['rows'][$i];
17
-        if (count($row) == 0) continue;
17
+        if (count($row) == 0) {
18
+            continue;
19
+        }
18 20
         if ($row['htype'] == '12') {
19 21
             if (isset($row['speaker']) && count($row['speaker']) > 0) {
20 22
                 $speaker = $row['speaker'];
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
                     $desc .= $speaker['constituency'] . ', ';
37 39
                 }
38 40
                 $desc .= _htmlentities($speaker['party']);
39
-                if ($desc) $row['speaker']['desc'] = $desc;
41
+                if ($desc) {
42
+                    $row['speaker']['desc'] = $desc;
43
+                }
40 44
             }
41 45
         }
42 46
         $out[] = $row;
@@ -52,8 +56,9 @@  discard block
 block discarded – undo
52 56
                 $has_content = false;
53 57
             }
54 58
             $entry = $row;
55
-            if (isset($row['excerpt']))
56
-                $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200);
59
+            if (isset($row['excerpt'])) {
60
+                            $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200);
61
+            }
57 62
             if ($has_content) {
58 63
             } else {
59 64
                 unset($entry['listurl']);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 $out = array();
14 14
 if (isset ($data['rows'])) {
15
-    for ($i=0; $i<count($data['rows']); $i++) {
15
+    for ($i = 0; $i < count($data['rows']); $i++) {
16 16
         $row = $data['rows'][$i];
17 17
         if (count($row) == 0) continue;
18 18
         if ($row['htype'] == '12') {
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/api/hansard_date.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 if (isset ($data['rows'])) {
13 13
     $out = array();
14
-    for ($i=0; $i<count($data['rows']); $i++) {
14
+    for ($i = 0; $i < count($data['rows']); $i++) {
15 15
         $row = $data['rows'][$i];
16 16
 
17 17
         if ($row['htype'] == '10' && isset($row['excerpt']) && strstr($row['excerpt'], "was asked&#8212;")) {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         if ($row['htype'] == '10') {
41 41
             $out[] = array('entry' => $entry, 'subs' => array());
42 42
         } else {
43
-            $out[sizeof($out)-1]['subs'][] = $entry;
43
+            $out[sizeof($out) - 1]['subs'][] = $entry;
44 44
         }
45 45
 
46 46
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@
 block discarded – undo
27 27
         }
28 28
 
29 29
         $entry = $row;
30
-        if (isset($row['excerpt']))
31
-            $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200);
30
+        if (isset($row['excerpt'])) {
31
+                    $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200);
32
+        }
32 33
         if ($has_content) {
33 34
         } else {
34 35
             unset($entry['listurl']);
Please login to merge, or discard this patch.
www/includes/easyparliament/sidebars/search_filters.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  <select id="section" name="section">
67 67
  <option value="">Any
68 68
 <?php
69
- optgroups(array(
69
+    optgroups(array(
70 70
     'UK Parliament' => array(
71 71
         'uk' => 'All UK',
72 72
         'debates' => 'House of Commons debates',
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         'sp' => 'Debates',
86 86
         'spwrans' => 'Written answers',
87 87
     ),
88
- ), $section);
89
- ?>
88
+    ), $section);
89
+    ?>
90 90
  </select>
91 91
  <div class="help">
92 92
  Restrict results to a particular parliament or assembly that we cover (e.g. the
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 if (preg_match('#\s*([0-9/.-]*)\.\.([0-9/.-]*)#', $filter_ss, $m)) {
24 24
     $from = $m[1];
25 25
     $to = $m[2];
26
-    $filter_ss =  preg_replace('#\s*([0-9/.-]*)\.\.([0-9/.-]*)#', '', $filter_ss);
26
+    $filter_ss = preg_replace('#\s*([0-9/.-]*)\.\.([0-9/.-]*)#', '', $filter_ss);
27 27
 }
28 28
 $section = get_http_var('section');
29 29
 if (preg_match('#\s*section:([a-z]*)#', $filter_ss, $m)) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     $filter_ss = preg_replace('#\s*speaker:[0-9]*#', '', $filter_ss);
37 37
 }
38 38
 
39
-$this->block_start(array( 'title' => "Filtering your results"));
39
+$this->block_start(array('title' => "Filtering your results"));
40 40
 
41 41
 ?>
42 42
 <form method="get" action="/search/">
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
         echo '<optgroup label="', $key, '">';
6 6
         foreach ($values as $k => $v) {
7 7
             echo '<option';
8
-            if ($current == $k) echo ' selected';
8
+            if ($current == $k) {
9
+                echo ' selected';
10
+            }
9 11
             echo ' value="', $k, '">', $v;
10 12
         }
11 13
         echo "</optgroup>\n";
Please login to merge, or discard this patch.
www/includes/easyparliament/comment.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -210,8 +210,8 @@
 block discarded – undo
210 210
                             array(':epobject_id' => $this->epobject_id));
211 211
 
212 212
             if ($q->rows() > 0) {
213
-                 // If you change stuff here, you might have to change it in
214
-                 // $COMMENTLIST->_get_comment_data() too...
213
+                    // If you change stuff here, you might have to change it in
214
+                    // $COMMENTLIST->_get_comment_data() too...
215 215
 
216 216
                 $gid = fix_gid_from_db($q->field(0, 'gid')); // In includes/utility.php
217 217
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public $body = '';
32 32
     public $posted = '';
33 33
     public $visible = false;
34
-    public $modflagged = NULL;	// Is a datetime when set.
34
+    public $modflagged = null;	// Is a datetime when set.
35 35
     public $firstname = '';	// Of the person who posted it.
36 36
     public $lastname = '';
37 37
     public $url = '';
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $flag = "'$date'";
139 139
 
140 140
         } elseif ($switch == 'off') {
141
-            $date = NULL;
141
+            $date = null;
142 142
             $flag = 'NULL';
143 143
 
144 144
         } else {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
     public $body = '';
32 32
     public $posted = '';
33 33
     public $visible = false;
34
-    public $modflagged = NULL;	// Is a datetime when set.
35
-    public $firstname = '';	// Of the person who posted it.
34
+    public $modflagged = NULL; // Is a datetime when set.
35
+    public $firstname = ''; // Of the person who posted it.
36 36
     public $lastname = '';
37 37
     public $url = '';
38 38
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public $exists = false;
42 42
 
43 43
 
44
-    public function __construct($comment_id='') {
44
+    public function __construct($comment_id = '') {
45 45
 
46 46
         $this->db = new ParlDB;
47 47
 
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
             if ($q->rows() > 0) {
70 70
 
71 71
                 $this->comment_id 	= $comment_id;
72
-                $this->user_id		= $q->field(0, 'user_id');
72
+                $this->user_id = $q->field(0, 'user_id');
73 73
                 $this->epobject_id	= $q->field(0, 'epobject_id');
74
-                $this->body			= $q->field(0, 'body');
75
-                $this->posted		= $q->field(0, 'posted');
76
-                $this->visible		= $q->field(0, 'visible');
77
-                $this->modflagged	= $q->field(0, 'modflagged');
74
+                $this->body = $q->field(0, 'body');
75
+                $this->posted = $q->field(0, 'posted');
76
+                $this->visible = $q->field(0, 'visible');
77
+                $this->modflagged = $q->field(0, 'modflagged');
78 78
 
79 79
                 // Sets the URL and username for this comment. Duh.
80 80
                 $this->_set_url();
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
     public function comments_enabled() { return $this->comments_enabled; }
105 105
 
106 106
 
107
-    public function display($format='html', $template='comments') {
107
+    public function display($format = 'html', $template = 'comments') {
108 108
 
109
-        $data['comments'][0] = array (
109
+        $data['comments'][0] = array(
110 110
             'comment_id'	=> $this->comment_id,
111 111
             'user_id'		=> $this->user_id,
112 112
             'epobject_id'	=> $this->epobject_id,
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $flag = 'NULL';
143 143
 
144 144
         } else {
145
-            $PAGE->error_message ("Why are you trying to switch this comment's modflag to '" . _htmlentities($switch) . "'!");
145
+            $PAGE->error_message("Why are you trying to switch this comment's modflag to '" . _htmlentities($switch) . "'!");
146 146
         }
147 147
 
148 148
         $q = $this->db->query("UPDATE comments
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             $this->modflagged = $date;
155 155
             return true;
156 156
         } else {
157
-            $message = array (
157
+            $message = array(
158 158
                 'title' => 'Sorry',
159 159
                 'text' => "We couldn't update the annotation's modflag."
160 160
             );
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             if ($q->success()) {
177 177
                 return true;
178 178
             } else {
179
-                $message = array (
179
+                $message = array(
180 180
                     'title' => 'Sorry',
181 181
                     'text' => "We were unable to delete the annotation."
182 182
                 );
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             }
186 186
 
187 187
         } else {
188
-            $message = array (
188
+            $message = array(
189 189
                 'title' => 'Sorry',
190 190
                 'text' => "You are not authorised to delete annotations."
191 191
             );
Please login to merge, or discard this patch.
www/includes/easyparliament/member.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $this->extra_info = array();
363 363
 
364 364
         $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id',
365
-                              array(':person_id' => $this->person_id));
365
+                                array(':person_id' => $this->person_id));
366 366
         for ($row=0; $row<$q->rows(); $row++) {
367 367
             $this->extra_info['office'][] = $q->row($row);
368 368
         }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         $q = $this->db->query('select bill_id,session,title,sum(attending) as a,sum(chairman) as c
451 451
             from pbc_members, bills
452 452
             where bill_id = bills.id and person_id = ' . $this->person_id()
453
-             . ' group by bill_id order by session desc');
453
+                . ' group by bill_id order by session desc');
454 454
         $this->extra_info['pbc'] = array();
455 455
         for ($i=0; $i<$q->rows(); $i++) {
456 456
             $bill_id = $q->field($i, 'bill_id');
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH."easyparliament/glossary.php";
3
+include_once INCLUDESPATH . "easyparliament/glossary.php";
4 4
 
5 5
 class MEMBER {
6 6
 
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 
113 113
         $this->house_disp = 0;
114 114
         $last_party = null;
115
-        for ($row=0; $row<$q->rows(); $row++) {
115
+        for ($row = 0; $row < $q->rows(); $row++) {
116 116
             $house          = $q->field($row, 'house');
117 117
             if (!in_array($house, $this->houses)) $this->houses[] = $house;
118 118
             $const          = $q->field($row, 'constituency');
119
-            $party		= $q->field($row, 'party');
120
-            $entered_house	= $q->field($row, 'entered_house');
121
-            $left_house	= $q->field($row, 'left_house');
122
-            $entered_reason	= $q->field($row, 'entered_reason');
123
-            $left_reason	= $q->field($row, 'left_reason');
119
+            $party = $q->field($row, 'party');
120
+            $entered_house = $q->field($row, 'entered_house');
121
+            $left_house = $q->field($row, 'left_house');
122
+            $entered_reason = $q->field($row, 'entered_reason');
123
+            $left_reason = $q->field($row, 'left_reason');
124 124
 
125 125
             if (!isset($this->entered_house[$house]) || $entered_house < $this->entered_house[$house]['date']) {
126 126
                 $this->entered_house[$house] = array(
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
                 );
143 143
             }
144 144
 
145
-            if ( $house==HOUSE_TYPE_ROYAL 					# The Monarch
146
-                || (!$this->house_disp && $house==HOUSE_TYPE_SCOTLAND)	# MSPs and
147
-                || (!$this->house_disp && $house==HOUSE_TYPE_NI)	# MLAs have lowest priority
148
-                || ($this->house_disp!=HOUSE_TYPE_LORDS && $house==HOUSE_TYPE_LORDS)	# Lords have highest priority
149
-                || (!$this->house_disp && $house==HOUSE_TYPE_COMMONS) # MPs
145
+            if ($house == HOUSE_TYPE_ROYAL 					# The Monarch
146
+                || (!$this->house_disp && $house == HOUSE_TYPE_SCOTLAND)	# MSPs and
147
+                || (!$this->house_disp && $house == HOUSE_TYPE_NI)	# MLAs have lowest priority
148
+                || ($this->house_disp != HOUSE_TYPE_LORDS && $house == HOUSE_TYPE_LORDS)	# Lords have highest priority
149
+                || (!$this->house_disp && $house == HOUSE_TYPE_COMMONS) # MPs
150 150
             ) {
151 151
                 $this->house_disp = $house;
152 152
                 $this->constituency = $const;
153 153
                 $this->party = $party;
154 154
 
155
-                $this->member_id	= $q->field($row, 'member_id');
156
-                $this->title		= $q->field($row, 'title');
155
+                $this->member_id = $q->field($row, 'member_id');
156
+                $this->title = $q->field($row, 'title');
157 157
                 $this->given_name = $q->field($row, 'given_name');
158 158
                 $this->family_name = $q->field($row, 'family_name');
159 159
                 $this->lordofname = $q->field($row, 'lordofname');
160
-                $this->person_id	= $q->field($row, 'person_id');
160
+                $this->person_id = $q->field($row, 'person_id');
161 161
             }
162 162
 
163 163
             if (($last_party && $party && $party != $last_party) || $left_reason == 'changed_party') {
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
         }
202 202
     }
203 203
 
204
-    public function postcode_to_person_id($postcode, $house=null) {
205
-        twfy_debug ('MP', "postcode_to_person_id converting postcode to person");
204
+    public function postcode_to_person_id($postcode, $house = null) {
205
+        twfy_debug('MP', "postcode_to_person_id converting postcode to person");
206 206
         $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($postcode));
207 207
         return $this->constituency_to_person_id($constituency, $house);
208 208
     }
209 209
 
210
-    public function constituency_to_person_id($constituency, $house=null) {
210
+    public function constituency_to_person_id($constituency, $house = null) {
211 211
         if ($constituency == '') {
212 212
             throw new MySociety\TheyWorkForYou\MemberException('Sorry, no constituency was found.');
213 213
         }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         }
247 247
     }
248 248
 
249
-    public function name_to_person_id($name, $const='') {
249
+    public function name_to_person_id($name, $const = '') {
250 250
         global $this_page;
251 251
         if ($name == '') {
252 252
             throw new MySociety\TheyWorkForYou\MemberException('Sorry, no name was found.');
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
         # More than one person ID matching the given name
298 298
         $person_ids = array();
299
-        for ($i=0; $i<$q->rows; ++$i) {
299
+        for ($i = 0; $i < $q->rows; ++$i) {
300 300
             $pid = $q->field($i, 'person_id');
301 301
             $person_ids[$pid] = 1;
302 302
         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $q = $this->db->query($q, $params);
327 327
         if ($q->rows > 1) {
328 328
             $person_ids = array();
329
-            for ($i=0; $i<$q->rows(); ++$i) {
329
+            for ($i = 0; $i < $q->rows(); ++$i) {
330 330
                 $person_ids[$q->field($i, 'person_id')] = $q->field($i, 'constituency');
331 331
             }
332 332
             throw new MySociety\TheyWorkForYou\MemberMultipleException($person_ids);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         global $THEUSER;
345 345
         if (is_object($THEUSER) && $THEUSER->postcode_is_set() && $this->current_member(1)) {
346 346
             $pc = $THEUSER->postcode();
347
-            twfy_debug ('MP', "set_users_mp converting postcode to person");
347
+            twfy_debug('MP', "set_users_mp converting postcode to person");
348 348
             $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
349 349
             if ($constituency == strtolower($this->constituency())) {
350 350
                 $this->the_users_mp = true;
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
         $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id',
367 367
                               array(':person_id' => $this->person_id));
368
-        for ($row=0; $row<$q->rows(); $row++) {
368
+        for ($row = 0; $row < $q->rows(); $row++) {
369 369
             $this->extra_info['office'][] = $q->row($row);
370 370
         }
371 371
 
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 
421 421
         if (isset($this->extra_info['public_whip_attendrank'])) {
422 422
             $prefix = ($this->house(HOUSE_TYPE_LORDS) ? 'L' : '');
423
-            $this->extra_info[$prefix.'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank'];
424
-            $this->extra_info[$prefix.'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof'];
425
-            $this->extra_info[$prefix.'public_whip_division_attendance_quintile'] = floor($this->extra_info['public_whip_attendrank'] / ($this->extra_info['public_whip_attendrank_outof']+1) * 5);
423
+            $this->extra_info[$prefix . 'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank'];
424
+            $this->extra_info[$prefix . 'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof'];
425
+            $this->extra_info[$prefix . 'public_whip_division_attendance_quintile'] = floor($this->extra_info['public_whip_attendrank'] / ($this->extra_info['public_whip_attendrank_outof'] + 1) * 5);
426 426
         }
427 427
         if ($this->house(HOUSE_TYPE_LORDS) && isset($this->extra_info['public_whip_division_attendance'])) {
428 428
             $this->extra_info['Lpublic_whip_division_attendance'] = $this->extra_info['public_whip_division_attendance'];
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
         }
431 431
 
432 432
         if ($display && array_key_exists('register_member_interests_html', $this->extra_info) && ($this->extra_info['register_member_interests_html'] != '')) {
433
-            $args = array (
433
+            $args = array(
434 434
                 "sort" => "regexp_replace"
435 435
             );
436 436
             $GLOSSARY = new GLOSSARY($args);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
         $GLOSSARY->glossarise($this->extra_info['register_member_interests_html']);
439 439
         }
440 440
 
441
-        $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:'.$this->person_id.'%" and confirmed and not deleted');
441
+        $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:' . $this->person_id . '%" and confirmed and not deleted');
442 442
         $this->extra_info['number_of_alerts'] = $q->field(0, 'c');
443 443
 
444 444
         if (isset($this->extra_info['reading_ease'])) {
@@ -454,16 +454,16 @@  discard block
 block discarded – undo
454 454
             where bill_id = bills.id and person_id = ' . $this->person_id()
455 455
              . ' group by bill_id order by session desc');
456 456
         $this->extra_info['pbc'] = array();
457
-        for ($i=0; $i<$q->rows(); $i++) {
457
+        for ($i = 0; $i < $q->rows(); $i++) {
458 458
             $bill_id = $q->field($i, 'bill_id');
459
-            $c = $this->db->query('select count(*) as c from hansard where major=6 and minor='.$bill_id.' and htype=10');
459
+            $c = $this->db->query('select count(*) as c from hansard where major=6 and minor=' . $bill_id . ' and htype=10');
460 460
             $c = $c->field(0, 'c');
461 461
             $title = $q->field($i, 'title');
462 462
             $attending = $q->field($i, 'a');
463 463
             $chairman = $q->field($i, 'c');
464 464
             $this->extra_info['pbc'][$bill_id] = array(
465 465
                 'title' => $title, 'session' => $q->field($i, 'session'),
466
-                'attending'=>$attending, 'chairman'=>($chairman>0), 'outof' => $c
466
+                'attending'=>$attending, 'chairman'=>($chairman > 0), 'outof' => $c
467 467
             );
468 468
         }
469 469
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     public function family_name() { return $this->family_name; }
479 479
     public function full_name($no_mp_title = false) {
480 480
         $title = $this->title;
481
-        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND))
481
+        if ($no_mp_title && ($this->house_disp == HOUSE_TYPE_COMMONS || $this->house_disp == HOUSE_TYPE_NI || $this->house_disp == HOUSE_TYPE_SCOTLAND))
482 482
             $title = '';
483 483
         return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname);
484 484
     }
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
     }
506 506
 
507 507
     public function entered_house($house = null) {
508
-        if ( isset($house) ) {
509
-            if ( array_key_exists($house, $this->entered_house) ) {
508
+        if (isset($house)) {
509
+            if (array_key_exists($house, $this->entered_house)) {
510 510
                 return $this->entered_house[$house];
511 511
             } else {
512 512
                 return null;
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
     public function entered_house_text($entered_house) {
519 519
         if (!$entered_house) return '';
520 520
         list($year, $month, $day) = explode('-', $entered_house);
521
-        if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) {
521
+        if ($month == 1 && $day == 1 && $this->house(HOUSE_TYPE_LORDS)) {
522 522
             return $year;
523
-        } elseif ($month==0 && $day==0) {
523
+        } elseif ($month == 0 && $day == 0) {
524 524
             return $year;
525 525
         } elseif (checkdate($month, $day, $year) && $year != '9999') {
526 526
             return format_date($entered_house, LONGDATEFORMAT);
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     public function left_house($house = null) {
533
-        if ( isset($house) ) {
534
-            if ( array_key_exists($house, $this->left_house) ) {
533
+        if (isset($house)) {
534
+            if (array_key_exists($house, $this->left_house)) {
535 535
                 return $this->left_house[$house];
536 536
             } else {
537 537
                 return null;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
         list($year, $month, $day) = explode('-', $left_house);
546 546
         if (checkdate($month, $day, $year) && $year != '9999') {
547 547
             return format_date($left_house, LONGDATEFORMAT);
548
-        } elseif ($month==0 && $day==0) {
548
+        } elseif ($month == 0 && $day == 0) {
549 549
             # Left house date is stored as 1942-00-00 to mean "at some point in 1941"
550 550
             return $year - 1;
551 551
         } else {
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
             $name = $q->field($r, 'given_name') . ' ' . $q->field($r, 'family_name');
648 648
             if ($last_pid != $pid) {
649 649
                 $mships[] = array(
650
-                    'href' => WEBPATH . 'mp/?pid='.$pid,
650
+                    'href' => WEBPATH . 'mp/?pid=' . $pid,
651 651
                     'text' => $name
652 652
                 );
653 653
                 $last_pid = $pid;
Please login to merge, or discard this patch.
Braces   +44 added lines, -26 removed lines patch added patch discarded remove patch
@@ -114,7 +114,9 @@  discard block
 block discarded – undo
114 114
         $last_party = null;
115 115
         for ($row=0; $row<$q->rows(); $row++) {
116 116
             $house          = $q->field($row, 'house');
117
-            if (!in_array($house, $this->houses)) $this->houses[] = $house;
117
+            if (!in_array($house, $this->houses)) {
118
+                $this->houses[] = $house;
119
+            }
118 120
             $const          = $q->field($row, 'constituency');
119 121
             $party		= $q->field($row, 'party');
120 122
             $entered_house	= $q->field($row, 'entered_house');
@@ -217,7 +219,9 @@  discard block
 block discarded – undo
217 219
         }
218 220
 
219 221
         $normalised = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($constituency);
220
-        if ($normalised) $constituency = $normalised;
222
+        if ($normalised) {
223
+            $constituency = $normalised;
224
+        }
221 225
 
222 226
         $params = array();
223 227
 
@@ -256,10 +260,12 @@  discard block
 block discarded – undo
256 260
         $q = "SELECT person_id FROM person_names WHERE type = 'name' ";
257 261
         if ($this_page == 'peer') {
258 262
             $success = preg_match('#^(.*?) (.*?) of (.*?)$#', $name, $m);
259
-            if (!$success)
260
-                $success = preg_match('#^(.*?)() of (.*?)$#', $name, $m);
261
-            if (!$success)
262
-                $success = preg_match('#^(.*?) (.*?)()$#', $name, $m);
263
+            if (!$success) {
264
+                            $success = preg_match('#^(.*?)() of (.*?)$#', $name, $m);
265
+            }
266
+            if (!$success) {
267
+                            $success = preg_match('#^(.*?) (.*?)()$#', $name, $m);
268
+            }
263 269
             if (!$success) {
264 270
                 throw new MySociety\TheyWorkForYou\MemberException('Sorry, that name was not recognised.');
265 271
             }
@@ -269,8 +275,9 @@  discard block
 block discarded – undo
269 275
             $q .= "AND title = :title AND family_name = :family_name AND lordofname = :lordofname";
270 276
         } elseif ($this_page == 'msp' || $this_page == 'mla' || strstr($this_page, 'mp')) {
271 277
             $success = preg_match('#^(.*?) (.*?) (.*?)$#', $name, $m);
272
-            if (!$success)
273
-                $success = preg_match('#^(.*?)() (.*)$#', $name, $m);
278
+            if (!$success) {
279
+                            $success = preg_match('#^(.*?)() (.*)$#', $name, $m);
280
+            }
274 281
             if (!$success) {
275 282
                 throw new MySociety\TheyWorkForYou\MemberException('Sorry, that name was not recognised.');
276 283
             }
@@ -405,16 +412,17 @@  discard block
 block discarded – undo
405 412
         if (array_key_exists('public_whip_rebellions', $this->extra_info)) {
406 413
             $rebellions = $this->extra_info['public_whip_rebellions'];
407 414
             $rebel_desc = "<unknown>";
408
-            if ($rebellions == 0)
409
-                $rebel_desc = "never";
410
-            elseif ($rebellions <= 1)
411
-                $rebel_desc = "hardly ever";
412
-            elseif ($rebellions <= 3)
413
-                $rebel_desc = "occasionally";
414
-            elseif ($rebellions <= 5)
415
-                $rebel_desc = "sometimes";
416
-            elseif ($rebellions > 5)
417
-                $rebel_desc = "quite often";
415
+            if ($rebellions == 0) {
416
+                            $rebel_desc = "never";
417
+            } elseif ($rebellions <= 1) {
418
+                            $rebel_desc = "hardly ever";
419
+            } elseif ($rebellions <= 3) {
420
+                            $rebel_desc = "occasionally";
421
+            } elseif ($rebellions <= 5) {
422
+                            $rebel_desc = "sometimes";
423
+            } elseif ($rebellions > 5) {
424
+                            $rebel_desc = "quite often";
425
+            }
418 426
             $this->extra_info['public_whip_rebel_description'] = $rebel_desc;
419 427
         }
420 428
 
@@ -478,8 +486,9 @@  discard block
 block discarded – undo
478 486
     public function family_name() { return $this->family_name; }
479 487
     public function full_name($no_mp_title = false) {
480 488
         $title = $this->title;
481
-        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND))
482
-            $title = '';
489
+        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) {
490
+                    $title = '';
491
+        }
483 492
         return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname);
484 493
     }
485 494
     public function houses() {
@@ -495,8 +504,9 @@  discard block
 block discarded – undo
495 504
     public function party() { return $this->party; }
496 505
     public function party_text($party = null) {
497 506
         global $parties;
498
-        if (!$party)
499
-            $party = $this->party;
507
+        if (!$party) {
508
+                    $party = $this->party;
509
+        }
500 510
         if (isset($parties[$party])) {
501 511
             return $parties[$party];
502 512
         } else {
@@ -516,7 +526,9 @@  discard block
 block discarded – undo
516 526
     }
517 527
 
518 528
     public function entered_house_text($entered_house) {
519
-        if (!$entered_house) return '';
529
+        if (!$entered_house) {
530
+            return '';
531
+        }
520 532
         list($year, $month, $day) = explode('-', $entered_house);
521 533
         if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) {
522 534
             return $year;
@@ -541,7 +553,9 @@  discard block
 block discarded – undo
541 553
     }
542 554
 
543 555
     public function left_house_text($left_house) {
544
-        if (!$left_house) return '';
556
+        if (!$left_house) {
557
+            return '';
558
+        }
545 559
         list($year, $month, $day) = explode('-', $left_house);
546 560
         if (checkdate($month, $day, $year) && $year != '9999') {
547 561
             return format_date($left_house, LONGDATEFORMAT);
@@ -590,7 +604,9 @@  discard block
 block discarded – undo
590 604
             $lh = $this->left_house($h);
591 605
             $current[$h] = ($lh['date'] == '9999-12-31');
592 606
         }
593
-        if ($house) return $current[$house];
607
+        if ($house) {
608
+            return $current[$house];
609
+        }
594 610
         return $current;
595 611
     }
596 612
 
@@ -623,7 +639,9 @@  discard block
 block discarded – undo
623 639
 
624 640
     private function _previous_future_mps_query($direction) {
625 641
         $entered_house = $this->entered_house(HOUSE_TYPE_COMMONS);
626
-        if (is_null($entered_house)) return '';
642
+        if (is_null($entered_house)) {
643
+            return '';
644
+        }
627 645
         if ($direction == '>') {
628 646
             $order = '';
629 647
         } else {
Please login to merge, or discard this patch.
www/includes/easyparliament/recess.php 2 patches
Braces   +30 added lines, -19 removed lines patch added patch discarded remove patch
@@ -362,12 +362,13 @@  discard block
 block discarded – undo
362 362
         } else {
363 363
             $from = "$year-7-" . $dates[$year][7]['more'];
364 364
         }
365
-        if (!isset($dates[$year][9]))
366
-            $to = "$year-08-31";
367
-        elseif (isset($dates[$year][9]['all']))
368
-            $to = "$year-10-" . $dates[$year][10]['less'];
369
-        else
370
-            $to = "$year-9-" . $dates[$year][9]['less'];
365
+        if (!isset($dates[$year][9])) {
366
+                    $to = "$year-08-31";
367
+        } elseif (isset($dates[$year][9]['all'])) {
368
+                    $to = "$year-10-" . $dates[$year][10]['less'];
369
+        } else {
370
+                    $to = "$year-9-" . $dates[$year][9]['less'];
371
+        }
371 372
     }
372 373
     if ( (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])
373 374
     || (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more'])
@@ -375,11 +376,17 @@  discard block
 block discarded – undo
375 376
     || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) ) {
376 377
         switch ($month) {
377 378
             case 1: case 12: $recess = 'Christmas Recess'; break;
378
-            case 2: if ($body==1 || $body==101) $recess = 'Half Term Week';
379
-                elseif ($body==4) $recess = 'February Recess';
379
+            case 2: if ($body==1 || $body==101) {
380
+                $recess = 'Half Term Week';
381
+            } elseif ($body==4) {
382
+                    $recess = 'February Recess';
383
+                }
380 384
                 break;
381
-            case 3: if ($body==1 || $body==101) $recess = 'Easter Recess';
382
-                elseif ($body==4) $recess = 'Spring Recess';
385
+            case 3: if ($body==1 || $body==101) {
386
+                $recess = 'Easter Recess';
387
+            } elseif ($body==4) {
388
+                    $recess = 'Spring Recess';
389
+                }
383 390
                 break;
384 391
             case 4: if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) {
385 392
                     $recess = 'Election Recess';
@@ -417,9 +424,13 @@  discard block
 block discarded – undo
417 424
                     trigger_error("Argh9");
418 425
                 }
419 426
                 break;
420
-            case 10: if ($body==1 || $body==101) $recess = 'Conference Recess';
421
-                elseif ($body==4) $recess = 'Autumn Recess';
422
-                elseif ($body==5) $recess = 'Halloween Recess';
427
+            case 10: if ($body==1 || $body==101) {
428
+                $recess = 'Conference Recess';
429
+            } elseif ($body==4) {
430
+                    $recess = 'Autumn Recess';
431
+                } elseif ($body==5) {
432
+                    $recess = 'Halloween Recess';
433
+                }
423 434
                 break;
424 435
             case 11: $recess = 'Autumn Recess';
425 436
                 break;
@@ -427,9 +438,9 @@  discard block
 block discarded – undo
427 438
         }
428 439
         if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) {
429 440
             $to = "$year-$month-" . $dates[$year][$month]['less'];
430
-            if ($month==1)
431
-                $from = ($year-1)."-12-" . $dates[$year-1][12]['more'];
432
-            else {
441
+            if ($month==1) {
442
+                            $from = ($year-1)."-12-" . $dates[$year-1][12]['more'];
443
+            } else {
433 444
                 for ($newmonth = $month-1; $newmonth>=1; $newmonth--) {
434 445
                     if (isset($dates[$year][$newmonth]['more'])) {
435 446
                         $from = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['more'];
@@ -440,9 +451,9 @@  discard block
 block discarded – undo
440 451
         }
441 452
         if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) {
442 453
             $from = "$year-$month-" . $dates[$year][$month]['more'];
443
-            if ($month==12)
444
-                $to = ($year+1)."-01-" . $dates[$year+1][1]['less'];
445
-            else {
454
+            if ($month==12) {
455
+                            $to = ($year+1)."-01-" . $dates[$year+1][1]['less'];
456
+            } else {
446 457
                 for ($newmonth = $month+1; $newmonth<=12; $newmonth++) {
447 458
                     if (isset($dates[$year][$newmonth]['less'])) {
448 459
                         $to = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['less'];
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
12 12
     ),
13 13
     2001 => array(
14 14
         1=>array('less'=>8),
15
-        2=>array('between'=>array(15,26)),
16
-        4=>array('between'=>array(10,23)),
15
+        2=>array('between'=>array(15, 26)),
16
+        4=>array('between'=>array(10, 23)),
17 17
         5=>array('more'=>13),
18 18
         6=>array('less'=>13),
19 19
         7=>array('more'=>20),
20 20
         8=>array('all'=>1),
21 21
         9=>array('less'=>14, 'more'=>14),
22
-        10=>array('less'=>4, 'between'=>array(4,8, 8,15)),
22
+        10=>array('less'=>4, 'between'=>array(4, 8, 8, 15)),
23 23
         12=>array('more'=>19) ),
24 24
     2002 => array(
25 25
         1=>array('less'=>8),
26
-        2=>array('between'=>array(14,25)),
26
+        2=>array('between'=>array(14, 25)),
27 27
         3=>array('more'=>26),
28
-        4=>array('less'=>3, 'between'=>array(3,10)),
28
+        4=>array('less'=>3, 'between'=>array(3, 10)),
29 29
         5=>array('more'=>24),
30 30
         6=>array('less'=>10),
31 31
         7=>array('more'=>24),
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
         12=>array('more'=>19) ),
36 36
     2003 => array(
37 37
         1=>array('less'=>7),
38
-        2=>array('between'=>array(13,24)),
39
-        4=>array('between'=>array(14,28)),
38
+        2=>array('between'=>array(13, 24)),
39
+        4=>array('between'=>array(14, 28)),
40 40
         5=>array('more'=>22),
41 41
         6=>array('less'=>3),
42 42
         7=>array('more'=>17),
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
         12=>array('more'=>18)),
47 47
     2004 => array(
48 48
         1=>array('less'=>5),
49
-        2=>array('between'=>array(12,23)),
50
-        4=>array('between'=>array(1,19)),
49
+        2=>array('between'=>array(12, 23)),
50
+        4=>array('between'=>array(1, 19)),
51 51
         5=>array('more'=>27),
52 52
         6=>array('less'=>7),
53 53
         7=>array('more'=>22),
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         12=>array('more'=>21) ),
58 58
     2005 => array(
59 59
         1=>array('less'=>10),
60
-        2=>array('between'=>array(10,21)),
60
+        2=>array('between'=>array(10, 21)),
61 61
         3=>array('more'=>24),
62 62
         4=>array('less'=>4, 'more'=>10),
63 63
         5=>array('less'=>11, 'more'=>26),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         12=>array('more'=>20) ),
70 70
     2006 => array(
71 71
         1=>array('less'=>9),
72
-        2=>array('between'=>array(16,27)),
72
+        2=>array('between'=>array(16, 27)),
73 73
         3=>array('more'=>30),
74 74
         4=>array('less'=>18),
75 75
         5=>array('more'=>25),
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     ),
83 83
     2007 => array(
84 84
         1=>array('less'=>8),
85
-        2=>array('between'=>array(8,19)),
85
+        2=>array('between'=>array(8, 19)),
86 86
         3=>array('more'=>29),
87 87
         4=>array('less'=>16),
88 88
         5=>array('more'=>24),
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     ),
96 96
     2008 => array(
97 97
         1=>array('less'=>7),
98
-        2=>array('between'=>array(7,18)),
99
-        4=>array('between'=>array(3,21)),
98
+        2=>array('between'=>array(7, 18)),
99
+        4=>array('between'=>array(3, 21)),
100 100
         5=>array('more'=>22),
101 101
         6=>array('less'=>2),
102 102
         7=>array('more'=>22),
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
     ),
108 108
     2009 => array(
109 109
         1=>array('less'=>12),
110
-        2=>array('between'=>array(12,23)),
111
-        4=>array('between'=>array(2,20)),
110
+        2=>array('between'=>array(12, 23)),
111
+        4=>array('between'=>array(2, 20)),
112 112
         5=>array('more'=>21),
113 113
         6=>array('less'=>1),
114 114
         7=>array('more'=>21),
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     ),
120 120
     2010 => array(
121 121
         1=>array('less'=>5),
122
-        2=>array('between'=>array(10,22)),
122
+        2=>array('between'=>array(10, 22)),
123 123
         3=>array('more'=>30),
124 124
         4=>array('less'=>6, 'more'=>8),
125 125
         5=>array('less'=>18, 'more'=>27),
@@ -132,62 +132,62 @@  discard block
 block discarded – undo
132 132
     ),
133 133
     2011 => array(
134 134
         1=>array('less'=>10),
135
-        2=>array('between'=>array(17,28)),
136
-        4=>array('between'=>array(5,26)),
135
+        2=>array('between'=>array(17, 28)),
136
+        4=>array('between'=>array(5, 26)),
137 137
         5=>array('more'=>24),
138 138
         6=>array('less'=>7),
139 139
         7=>array('more'=>19),
140 140
         8=>array('all'=>1),
141 141
         9=>array('less'=>5, 'more'=>15),
142 142
         10=>array('less'=>10),
143
-        11=>array('between'=>array(15,21)),
143
+        11=>array('between'=>array(15, 21)),
144 144
         12=>array('more'=>20),
145 145
     ),
146 146
     2012 => array(
147 147
         1=>array('less'=>10),
148
-        2=>array('between'=>array(9,20)),
148
+        2=>array('between'=>array(9, 20)),
149 149
         3=>array('more'=>27),
150 150
         4=>array('less'=>16),
151 151
         5=>array('more'=>24),
152 152
         6=>array('less'=>11),
153 153
         7=>array('more'=>17),
154 154
         8=>array('all'=>1),
155
-        9=>array('less'=>3,'more'=>18),
155
+        9=>array('less'=>3, 'more'=>18),
156 156
         10=>array('less'=>15),
157
-        11=>array('between'=>array(13,19)),
157
+        11=>array('between'=>array(13, 19)),
158 158
         12=>array('more'=>20)
159 159
     ),
160 160
     2013 => array(
161 161
         1=>array('less'=>7),
162
-        2=>array('between'=>array(14,25)),
162
+        2=>array('between'=>array(14, 25)),
163 163
         3=>array('more'=>26),
164 164
         4=>array('less'=>15),
165 165
         5=>array('more'=>21),
166 166
         6=>array('less'=>3),
167 167
         7=>array('more'=>18),
168 168
         8=>array('all'=>1),
169
-        9=>array('less'=>2,'more'=>13),
169
+        9=>array('less'=>2, 'more'=>13),
170 170
         10=>array('less'=>8),
171
-        11=>array('between'=>array(12,18)),
171
+        11=>array('between'=>array(12, 18)),
172 172
         12=>array('more'=>19)
173 173
     ),
174 174
     2014 => array(
175 175
         1=>array('less'=>6),
176
-        2=>array('between'=>array(13,24)),
177
-        4=>array('between'=>array(10,28)),
178
-        5=>array('between'=>array(1,6))
176
+        2=>array('between'=>array(13, 24)),
177
+        4=>array('between'=>array(10, 28)),
178
+        5=>array('between'=>array(1, 6))
179 179
     ),
180 180
     2015 => array(
181 181
         7=>array('more'=>21),
182 182
         8=>array('all'=>1),
183 183
         9=>array('less'=>7, 'more'=>17),
184 184
         10=>array('less'=>12),
185
-        11=>array('between'=>array(10,16)),
185
+        11=>array('between'=>array(10, 16)),
186 186
         12=>array('more'=>17)
187 187
     ),
188 188
     2016 => array(
189 189
         1=>array('less'=>5),
190
-        2=>array('between'=>array(11,22))
190
+        2=>array('between'=>array(11, 22))
191 191
     )
192 192
 );
193 193
 # Lords differences
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
 $GLOBALS['recessdates'][101][2010][12]['more'] = 22;
200 200
 $GLOBALS['recessdates'][101][2011] = array(
201 201
     1 => array('less'=>10),
202
-    2 => array('between'=>array(16,28)),
203
-    4 => array('between'=>array(6,26)),
202
+    2 => array('between'=>array(16, 28)),
203
+    4 => array('between'=>array(6, 26)),
204 204
     5 => array('more'=>25),
205 205
     6 => array('less'=>6),
206 206
     7 => array('more'=>20),
207 207
     8 => array('all'=>1),
208 208
     9 => array('less'=>5, 'more'=>15),
209 209
     10 => array('less'=>3),
210
-    11=>array('between'=>array(16,21)),
210
+    11=>array('between'=>array(16, 21)),
211 211
     12 => array('more'=>21),
212 212
 );
213 213
 
@@ -216,74 +216,74 @@  discard block
 block discarded – undo
216 216
     1999 => array(
217 217
         7 => array('more' => 2),
218 218
         8 => array('less' => 31),
219
-        10 => array('between' => array(8,25)),
219
+        10 => array('between' => array(8, 25)),
220 220
         12 => array('more' => 17)
221 221
     ),
222 222
     2000 => array(
223 223
         1 => array('less' => 10),
224
-        4 => array('between' => array(7,25)),
224
+        4 => array('between' => array(7, 25)),
225 225
         7 => array('more' => 7),
226 226
         8 => array('all' => 1),
227 227
         9 => array('less' => 4),
228
-        10 => array('between' => array(6,23)),
228
+        10 => array('between' => array(6, 23)),
229 229
         12 => array('more' => 20)
230 230
     ),
231 231
     2001 => array(
232 232
         1=>array('less'=>8),
233
-        2=>array('between'=>array(16,26)),
234
-        4=>array('between'=>array(6,23)),
233
+        2=>array('between'=>array(16, 26)),
234
+        4=>array('between'=>array(6, 23)),
235 235
         6=>array('more'=>29),
236 236
         7=>array('all'=>1),
237 237
         8=>array('all'=>1),
238 238
         9=>array('less'=>3),
239
-        10=>array('between'=>array(5,22)),
239
+        10=>array('between'=>array(5, 22)),
240 240
         12=>array('more'=>21) ),
241 241
     2002 => array(
242 242
         1=>array('less'=>7),
243
-        2=>array('between'=>array(15,25)),
243
+        2=>array('between'=>array(15, 25)),
244 244
         3=>array('more'=>28),
245 245
         4=>array('less'=>15),
246 246
         7=>array('more'=>10),
247 247
         8=>array('all'=>1),
248 248
         9=>array('less'=>2),
249
-        10=>array('between'=>array(11,28)),
249
+        10=>array('between'=>array(11, 28)),
250 250
         12=>array('more'=>20) ),
251 251
     2003 => array(
252 252
         1=>array('less'=>6),
253
-        4=>array('between'=>array(0,31)),
253
+        4=>array('between'=>array(0, 31)),
254 254
         5=>array('less'=>2),
255 255
         6=>array('more'=>27),
256 256
         7=>array('all'=>1),
257 257
         8=>array('all'=>1),
258
-        10=>array('between'=>array(10,27)),
258
+        10=>array('between'=>array(10, 27)),
259 259
         12=>array('more'=>19)),
260 260
     2004 => array(
261 261
         1=>array('less'=>5),
262
-        2=>array('between'=>array(13,23)),
263
-        4=>array('between'=>array(2,19)),
262
+        2=>array('between'=>array(13, 23)),
263
+        4=>array('between'=>array(2, 19)),
264 264
         6=>array('more'=>25),
265 265
         7=>array('all'=>1),
266 266
         8=>array('less'=>30),
267
-        10=>array('between'=>array(10,23)),
267
+        10=>array('between'=>array(10, 23)),
268 268
         12=>array('more'=>26) ),
269 269
     2005 => array(
270 270
         1=>array('less'=>8),
271
-        2=>array('between'=>array(11,21)),
271
+        2=>array('between'=>array(11, 21)),
272 272
         3=>array('more'=>24),
273 273
         4=>array('less'=>11),
274 274
         7=>array('more'=>1),
275 275
         8=>array('all'=>1),
276 276
         9=>array('less'=>5),
277
-        10=>array('between'=>array(7,24)),
277
+        10=>array('between'=>array(7, 24)),
278 278
         12=>array('more'=>23) ),
279 279
     2006 => array(
280 280
         1=>array('less'=>9),
281
-        2=>array('between'=>array(10,20)),
281
+        2=>array('between'=>array(10, 20)),
282 282
         4=>array('less'=>18),
283 283
         7=>array('more'=>0),
284 284
         8=>array('all'=>1),
285 285
         9=>array('less'=>4),
286
-        10=>array('between'=>array(6,23)),
286
+        10=>array('between'=>array(6, 23)),
287 287
         12=>array('more'=>22),
288 288
     ),
289 289
     2007 => array(
@@ -293,18 +293,18 @@  discard block
 block discarded – undo
293 293
         7=>array('all'=>1),
294 294
         8=>array('all'=>1),
295 295
         9=>array('less'=>3),
296
-        10=>array('between'=>array(5,22)),
296
+        10=>array('between'=>array(5, 22)),
297 297
         12=>array('more'=>21),
298 298
     ),
299 299
     2008 => array(
300 300
         1=>array('less'=>5),
301
-        2=>array('between'=>array(8,18)),
301
+        2=>array('between'=>array(8, 18)),
302 302
         3=>array('more'=>28),
303 303
         4=>array('less'=>14),
304 304
         6=>array('more'=>27),
305 305
         7=>array('all'=>1),
306 306
         8=>array('all'=>1),
307
-        10=>array('between'=>array(10,27)),
307
+        10=>array('between'=>array(10, 27)),
308 308
     ),
309 309
 );
310 310
 
@@ -369,39 +369,39 @@  discard block
 block discarded – undo
369 369
         else
370 370
             $to = "$year-9-" . $dates[$year][9]['less'];
371 371
     }
372
-    if ( (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])
372
+    if ((isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])
373 373
     || (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more'])
374 374
     || (isset($dates[$year][$month]['between']) && $day > $dates[$year][$month]['between'][0] && $day < $dates[$year][$month]['between'][1])
375
-    || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) ) {
375
+    || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3])) {
376 376
         switch ($month) {
377 377
             case 1: case 12: $recess = 'Christmas Recess'; break;
378
-            case 2: if ($body==1 || $body==101) $recess = 'Half Term Week';
379
-                elseif ($body==4) $recess = 'February Recess';
378
+            case 2: if ($body == 1 || $body == 101) $recess = 'Half Term Week';
379
+                elseif ($body == 4) $recess = 'February Recess';
380 380
                 break;
381
-            case 3: if ($body==1 || $body==101) $recess = 'Easter Recess';
382
-                elseif ($body==4) $recess = 'Spring Recess';
381
+            case 3: if ($body == 1 || $body == 101) $recess = 'Easter Recess';
382
+                elseif ($body == 4) $recess = 'Spring Recess';
383 383
                 break;
384 384
             case 4: if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) {
385 385
                     $recess = 'Election Recess';
386
-                } elseif ($body==4 && $year==2003) {
386
+                } elseif ($body == 4 && $year == 2003) {
387 387
                     $recess = 'Election Recess';
388
-                } elseif ($body==1 || $body==101) {
388
+                } elseif ($body == 1 || $body == 101) {
389 389
                     $recess = 'Easter Recess';
390
-                } elseif ($body==4) {
390
+                } elseif ($body == 4) {
391 391
                     $recess = 'Spring Recess';
392 392
                 }
393 393
                 break;
394
-            case 5: if ($year==2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) {
394
+            case 5: if ($year == 2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) {
395 395
                     $recess = 'Election Recess';
396 396
                 } else {
397 397
                     $recess = 'Whit Recess';
398 398
                 }
399 399
                 break;
400
-            case 6: if ($year==2001) {
400
+            case 6: if ($year == 2001) {
401 401
                     $recess = 'Election Recess';
402
-                } elseif ($body==1 || $body==101) {
402
+                } elseif ($body == 1 || $body == 101) {
403 403
                     $recess = 'Whit Recess';
404
-                } elseif ($body==4) {
404
+                } elseif ($body == 4) {
405 405
                     $recess = 'Summer Recess';
406 406
                 } else {
407 407
                     trigger_error("Argh6");
@@ -411,15 +411,15 @@  discard block
 block discarded – undo
411 411
                 break;
412 412
             case 9: if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) {
413 413
                     $recess = 'Summer Recess';
414
-                } elseif ($body==1 || $body==101) {
414
+                } elseif ($body == 1 || $body == 101) {
415 415
                     $recess = 'Conference Recess';
416 416
                 } else {
417 417
                     trigger_error("Argh9");
418 418
                 }
419 419
                 break;
420
-            case 10: if ($body==1 || $body==101) $recess = 'Conference Recess';
421
-                elseif ($body==4) $recess = 'Autumn Recess';
422
-                elseif ($body==5) $recess = 'Halloween Recess';
420
+            case 10: if ($body == 1 || $body == 101) $recess = 'Conference Recess';
421
+                elseif ($body == 4) $recess = 'Autumn Recess';
422
+                elseif ($body == 5) $recess = 'Halloween Recess';
423 423
                 break;
424 424
             case 11: $recess = 'Autumn Recess';
425 425
                 break;
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
         }
428 428
         if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) {
429 429
             $to = "$year-$month-" . $dates[$year][$month]['less'];
430
-            if ($month==1)
431
-                $from = ($year-1)."-12-" . $dates[$year-1][12]['more'];
430
+            if ($month == 1)
431
+                $from = ($year - 1) . "-12-" . $dates[$year - 1][12]['more'];
432 432
             else {
433
-                for ($newmonth = $month-1; $newmonth>=1; $newmonth--) {
433
+                for ($newmonth = $month - 1; $newmonth >= 1; $newmonth--) {
434 434
                     if (isset($dates[$year][$newmonth]['more'])) {
435
-                        $from = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['more'];
435
+                        $from = "$year-" . ($newmonth) . "-" . $dates[$year][$newmonth]['more'];
436 436
                         break;
437 437
                     }
438 438
                 }
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
         }
441 441
         if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) {
442 442
             $from = "$year-$month-" . $dates[$year][$month]['more'];
443
-            if ($month==12)
444
-                $to = ($year+1)."-01-" . $dates[$year+1][1]['less'];
443
+            if ($month == 12)
444
+                $to = ($year + 1) . "-01-" . $dates[$year + 1][1]['less'];
445 445
             else {
446
-                for ($newmonth = $month+1; $newmonth<=12; $newmonth++) {
446
+                for ($newmonth = $month + 1; $newmonth <= 12; $newmonth++) {
447 447
                     if (isset($dates[$year][$newmonth]['less'])) {
448
-                        $to = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['less'];
448
+                        $to = "$year-" . ($newmonth) . "-" . $dates[$year][$newmonth]['less'];
449 449
                         break;
450 450
                     }
451 451
                 }
Please login to merge, or discard this patch.
www/includes/easyparliament/alert.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 // FUNCTION: fetch_between
53 53
 
54 54
     public function fetch_between($confirmed, $deleted, $start_date, $end_date) {
55
-      // Return summary data on all the alerts that were created between $start_date
56
-      // and $end_date (inclusive) and whose confirmed and deleted values match the booleans
57
-      // passed in $confirmed and $deleted
55
+        // Return summary data on all the alerts that were created between $start_date
56
+        // and $end_date (inclusive) and whose confirmed and deleted values match the booleans
57
+        // passed in $confirmed and $deleted
58 58
         $q = $this->db->query("SELECT   criteria, count(*) as cnt
59 59
             FROM     alerts
60 60
             WHERE    confirmed = :confirmed
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
             ));
70 70
         $data = array();
71 71
     for ($row=0; $row<$q->rows(); $row++) {
72
-      $contents = array('criteria' => $q->field($row, 'criteria'), 'count' => $q->field($row, 'cnt'));
73
-          $data[] = $contents;
72
+        $contents = array('criteria' => $q->field($row, 'criteria'), 'count' => $q->field($row, 'cnt'));
73
+            $data[] = $contents;
74 74
     }
75 75
     $data = array ('alerts' => $data);
76 76
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 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
 
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
             ':end_date' => $end_date
69 69
             ));
70 70
         $data = array();
71
-    for ($row=0; $row<$q->rows(); $row++) {
71
+    for ($row = 0; $row < $q->rows(); $row++) {
72 72
       $contents = array('criteria' => $q->field($row, 'criteria'), 'count' => $q->field($row, 'cnt'));
73 73
           $data[] = $contents;
74 74
     }
75
-    $data = array ('alerts' => $data);
75
+    $data = array('alerts' => $data);
76 76
 
77 77
     return $data;
78 78
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $data = array();
102 102
 
103
-            for ($row=0; $row<$q->rows(); $row++) {
103
+            for ($row = 0; $row < $q->rows(); $row++) {
104 104
                 $contents = array(
105 105
                 'alert_id' 	=> $q->field($row, 'alert_id'),
106 106
                 'email' 	=> $q->field($row, 'email'),
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
                 $data[] = $contents;
113 113
             }
114 114
             $info = "Alert";
115
-            $data = array ('info' => $info, 'data' => $data);
115
+            $data = array('info' => $info, 'data' => $data);
116 116
 
117 117
 
118 118
             return $data;
119 119
     }
120 120
 
121
-    public function add($details, $confirmation_email=false, $instantly_confirm=true) {
121
+    public function add($details, $confirmation_email = false, $instantly_confirm = true) {
122 122
 
123 123
         // Adds a new alert's info into the database.
124 124
         // Then calls another function to send them a confirmation email.
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             // This gives a code for their email address which is then joined
183 183
             // to the timestamp so as to provide a unique ID for each alert.
184 184
 
185
-            $token = substr( password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16 );
185
+            $token = substr(password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16);
186 186
 
187 187
             // Full stops don't work well at the end of URLs in emails,
188 188
             // so replace them. We won't be doing anything clever with the hash
@@ -255,19 +255,19 @@  discard block
 block discarded – undo
255 255
 
256 256
         $urltoken = $this->alert_id . '-' . $this->registrationtoken;
257 257
 
258
-        if ( isset($details['confirm_base']) && $details['confirm_base'] !== '' ) {
258
+        if (isset($details['confirm_base']) && $details['confirm_base'] !== '') {
259 259
             $confirmurl = $details['confirm_base'] . $urltoken;
260 260
         } else {
261 261
             $confirmurl = 'https://' . DOMAIN . '/A/' . $urltoken;
262 262
         }
263 263
 
264 264
         // Arrays we need to send a templated email.
265
-        $data = array (
265
+        $data = array(
266 266
             'to' 		=> $details['email'],
267 267
             'template' 	=> 'alert_confirmation'
268 268
         );
269 269
 
270
-        $merge = array (
270
+        $merge = array(
271 271
             'FIRSTNAME' 	=> 'THEY WORK FOR YOU',
272 272
             'LASTNAME' 		=> ' ALERT CONFIRMATION',
273 273
             'CONFIRMURL'	=> $confirmurl,
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     }
284 284
 
285 285
     public function send_already_signedup_email($details) {
286
-        $data = array (
286
+        $data = array(
287 287
             'to' 		=> $details['email'],
288 288
             'template' 	=> 'alert_already_signedup'
289 289
         );
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details);
292 292
         $this->criteria = $criteria;
293 293
 
294
-        $merge = array (
294
+        $merge = array(
295 295
             'FIRSTNAME' 	=> 'THEY WORK FOR YOU',
296 296
             'LASTNAME' 		=> ' ALERT ALREADY SIGNED UP',
297 297
             'CRITERIA'	=> $this->criteria_pretty()
@@ -442,17 +442,17 @@  discard block
 block discarded – undo
442 442
     public function email() { return $this->email; }
443 443
     public function criteria() { return $this->criteria; }
444 444
     public function criteria_pretty($html = false) {
445
-        $criteria = explode(' ',$this->criteria);
445
+        $criteria = explode(' ', $this->criteria);
446 446
         $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($this->criteria));
447 447
         $words = array();
448 448
         foreach ($criteria as $c) {
449
-            if (!preg_match('#^speaker:(\d+)#',$c,$m)) {
449
+            if (!preg_match('#^speaker:(\d+)#', $c, $m)) {
450 450
                 $words[] = $c;
451 451
             }
452 452
         }
453 453
         $criteria = '';
454
-        if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
455
-        if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
454
+        if (count($words)) $criteria .= ($html ? '<li>' : '* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html ? '</li>' : '') . "\n";
455
+        if ($spokenby) $criteria .= ($html ? '<li>' : '* ') . "Things by " . implode(' or ', $spokenby) . ($html ? '</li>' : '') . "\n";
456 456
         return $criteria;
457 457
     }
458 458
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -340,17 +340,20 @@  discard block
 block discarded – undo
340 340
     }
341 341
 
342 342
     public function check_token($token) {
343
-        if (!is_null($this->token_checked))
344
-            return $this->token_checked;
343
+        if (!is_null($this->token_checked)) {
344
+                    return $this->token_checked;
345
+        }
345 346
 
346 347
         $arg = strstr($token, '::') ? '::' : '-';
347 348
         $token_parts = explode($arg, $token);
348
-        if (count($token_parts) != 2)
349
-            return false;
349
+        if (count($token_parts) != 2) {
350
+                    return false;
351
+        }
350 352
 
351 353
         list($alert_id, $registrationtoken) = $token_parts;
352
-        if (!is_numeric($alert_id) || !$registrationtoken)
353
-            return false;
354
+        if (!is_numeric($alert_id) || !$registrationtoken) {
355
+                    return false;
356
+        }
354 357
 
355 358
         $q = $this->db->query("SELECT alert_id, email, criteria
356 359
                         FROM alerts
@@ -398,7 +401,9 @@  discard block
 block discarded – undo
398 401
     // If all goes well the alert will be confirmed.
399 402
     // The alert will be active when scripts run each day to send the actual emails.
400 403
     public function confirm($token) {
401
-        if (!($alert = $this->check_token($token))) return false;
404
+        if (!($alert = $this->check_token($token))) {
405
+            return false;
406
+        }
402 407
         $this->criteria = $alert['criteria'];
403 408
         $this->email = $alert['email'];
404 409
         $r = $this->db->query("UPDATE alerts SET confirmed = 1, deleted = 0 WHERE alert_id = :alert_id", array(
@@ -412,7 +417,9 @@  discard block
 block discarded – undo
412 417
     // and the deletion page has passed the token from the URL to here.
413 418
     // If all goes well the alert will be deleted.
414 419
     public function delete($token) {
415
-        if (!($alert = $this->check_token($token))) return false;
420
+        if (!($alert = $this->check_token($token))) {
421
+            return false;
422
+        }
416 423
         $r = $this->db->query("DELETE FROM alerts WHERE alert_id = :alert_id", array(
417 424
             ':alert_id' => $alert['id']
418 425
             ));
@@ -421,7 +428,9 @@  discard block
 block discarded – undo
421 428
     }
422 429
 
423 430
     public function delete_all($token) {
424
-        if (!($alert = $this->check_token($token))) return false;
431
+        if (!($alert = $this->check_token($token))) {
432
+            return false;
433
+        }
425 434
         $r = $this->db->query("DELETE FROM alerts WHERE email = :email", array(
426 435
             ':email' => $alert['email']
427 436
             ));
@@ -430,7 +439,9 @@  discard block
 block discarded – undo
430 439
     }
431 440
 
432 441
     public function suspend($token) {
433
-        if (!($alert = $this->check_token($token))) return false;
442
+        if (!($alert = $this->check_token($token))) {
443
+            return false;
444
+        }
434 445
         $r = $this->db->query("UPDATE alerts SET deleted = 2 WHERE alert_id = :alert_id", array(
435 446
             ':alert_id' => $alert['id']
436 447
             ));
@@ -439,7 +450,9 @@  discard block
 block discarded – undo
439 450
     }
440 451
 
441 452
     public function resume($token) {
442
-        if (!($alert = $this->check_token($token))) return false;
453
+        if (!($alert = $this->check_token($token))) {
454
+            return false;
455
+        }
443 456
         $r = $this->db->query("UPDATE alerts SET deleted = 0 WHERE alert_id = :alert_id", array(
444 457
             ':alert_id' => $alert['id']
445 458
             ));
@@ -460,8 +473,12 @@  discard block
 block discarded – undo
460 473
             }
461 474
         }
462 475
         $criteria = '';
463
-        if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
464
-        if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
476
+        if (count($words)) {
477
+            $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
478
+        }
479
+        if ($spokenby) {
480
+            $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
481
+        }
465 482
         return $criteria;
466 483
     }
467 484
 
Please login to merge, or discard this patch.
www/includes/utility.php 4 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
     # Ignore errors we've asked to ignore
68 68
     if (error_reporting()==0) return;
69 69
 
70
-   // define an assoc array of error string
71
-   // in reality the only entries we should
72
-   // consider are E_WARNING, E_NOTICE, E_USER_ERROR,
73
-   // E_USER_WARNING and E_USER_NOTICE
74
-   # Commented out are ones that a user function cannot handle.
70
+    // define an assoc array of error string
71
+    // in reality the only entries we should
72
+    // consider are E_WARNING, E_NOTICE, E_USER_ERROR,
73
+    // E_USER_WARNING and E_USER_NOTICE
74
+    # Commented out are ones that a user function cannot handle.
75 75
     $errortype = array (
76 76
         #E_ERROR            => "Error",
77 77
         E_WARNING           => "Warning",
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 // pretty prints the backtrace, copied from http://uk.php.net/manual/en/function.debug-backtrace.php
201 201
 function adodb_backtrace($print=true)
202 202
 {
203
-  $s = '';
204
-  if (PHPVERSION() >= 4.3) {
203
+    $s = '';
204
+    if (PHPVERSION() >= 4.3) {
205 205
 
206 206
     $MAXSTRLEN = 64;
207 207
 
@@ -209,33 +209,33 @@  discard block
 block discarded – undo
209 209
     array_shift($traceArr);
210 210
     $tabs = sizeof($traceArr)-1;
211 211
     foreach ($traceArr as $arr) {
212
-      for ($i=0; $i < $tabs; $i++) $s .= ' &nbsp; ';
213
-      $tabs -= 1;
214
-      if (isset($arr['class'])) $s .= $arr['class'].'.';
215
-      $args = array();
216
-      if (isset($arr['args'])) foreach ($arr['args'] as $v) {
212
+        for ($i=0; $i < $tabs; $i++) $s .= ' &nbsp; ';
213
+        $tabs -= 1;
214
+        if (isset($arr['class'])) $s .= $arr['class'].'.';
215
+        $args = array();
216
+        if (isset($arr['args'])) foreach ($arr['args'] as $v) {
217 217
     if (is_null($v)) $args[] = 'null';
218 218
     elseif (is_array($v)) $args[] = 'Array['.sizeof($v).']';
219 219
     elseif (is_object($v)) $args[] = 'Object:'.get_class($v);
220 220
     elseif (is_bool($v)) $args[] = $v ? 'true' : 'false';
221 221
     else {
222
-      $v = (string) @$v;
223
-      $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN));
224
-      if (strlen($v) > $MAXSTRLEN) $str .= '...';
225
-      $args[] = $str;
222
+        $v = (string) @$v;
223
+        $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN));
224
+        if (strlen($v) > $MAXSTRLEN) $str .= '...';
225
+        $args[] = $str;
226 226
     }
227
-      }
227
+        }
228 228
 
229
-      $s .= $arr['function'].'('.implode(', ',$args).')';
230
-      //      $s .= sprintf("</font><font color=#808080 size=-1> # line %4d,".
231
-      //            " file: <a href=\"file:/%s\">%s</a></font>",
232
-      //        $arr['line'],$arr['file'],$arr['file']);
233
-      $s .= "\n";
229
+        $s .= $arr['function'].'('.implode(', ',$args).')';
230
+        //      $s .= sprintf("</font><font color=#808080 size=-1> # line %4d,".
231
+        //            " file: <a href=\"file:/%s\">%s</a></font>",
232
+        //        $arr['line'],$arr['file'],$arr['file']);
233
+        $s .= "\n";
234 234
     }
235 235
     if ($print) print $s;
236
-  }
236
+    }
237 237
 
238
-  return $s;
238
+    return $s;
239 239
 }
240 240
 
241 241
 // Far from foolproof, but better than nothing.
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
     //$tbl["»"] = "&raquo;";
568 568
     //$tbl["«"] = "&laquo;";
569 569
 
570
-  // lib_filter will replace unmatched < and > with entities so
571
-  // we abuse strtr's only replace once behaviour to not double
572
-  // encode them. May not be robust.
573
-  // This does mean if anyone actually wants to put &gt; or &lt;
574
-  // in a comment they can't but that's a lot less likely than
575
-  // < or > for less than and greater than.
576
-  $tbl['&lt;'] = "&lt;";
577
-  $tbl['&gt;'] = "&gt;";
570
+    // lib_filter will replace unmatched < and > with entities so
571
+    // we abuse strtr's only replace once behaviour to not double
572
+    // encode them. May not be robust.
573
+    // This does mean if anyone actually wants to put &gt; or &lt;
574
+    // in a comment they can't but that's a lot less likely than
575
+    // < or > for less than and greater than.
576
+    $tbl['&lt;'] = "&lt;";
577
+    $tbl['&gt;'] = "&gt;";
578 578
 
579 579
     // Don't want to encode these things
580 580
     unset ($tbl["<"]);
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
     if (!$from) $from = CONTACTEMAIL;
765 765
 
766 766
     $headers =
767
-     "From: TheyWorkForYou <$from>\r\n" .
768
-     "Content-Type: text/plain; charset=utf-8\r\n" .
769
-     "MIME-Version: 1.0\r\n" .
770
-     "Content-Transfer-Encoding: 8bit\r\n" .
771
-     ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "" ).
772
-     "X-Mailer: PHP/" . phpversion();
767
+        "From: TheyWorkForYou <$from>\r\n" .
768
+        "Content-Type: text/plain; charset=utf-8\r\n" .
769
+        "MIME-Version: 1.0\r\n" .
770
+        "Content-Transfer-Encoding: 8bit\r\n" .
771
+        ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "" ).
772
+        "X-Mailer: PHP/" . phpversion();
773 773
     twfy_debug('EMAIL', "Sending email to $to with subject of '$subject'");
774 774
 
775 775
     if ($want_bounces) {
776
-      $envelope_sender = twfy_verp_envelope_sender($to);
776
+        $envelope_sender = twfy_verp_envelope_sender($to);
777 777
         $success = mail ($to, $subject, $message, $headers, '-f ' . $envelope_sender);
778 778
     } else {
779 779
         $success = mail ($to, $subject, $message, $headers);
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 
1064 1064
     $return = '<h4>';
1065 1065
     if (isset($daytext[$major])) {
1066
-     $return .= $daytext[$major] . ' ';
1066
+        $return .= $daytext[$major] . ' ';
1067 1067
     }
1068 1068
 
1069 1069
     $return .= '<a href="';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
     return $string;
888 888
 }
889 889
 
890
-function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = NULL) {
890
+function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = null) {
891 891
 
892 892
     // Case for Elizabeth II
893 893
     if ($house == HOUSE_TYPE_ROYAL)
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
     $out = '';
904 904
 
905 905
     // Insert the Person ID if known.
906
-    if ($pid !== NULL)
906
+    if ($pid !== null)
907 907
     {
908 908
         $out .= $pid . '/';
909 909
     }
Please login to merge, or discard this patch.
Braces   +115 added lines, -69 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
         // If we can show this header, then, er, show it.
51 51
         if ( in_array($header, $allowed_headers) || $debug_level >= 4) {
52
-            if (is_array($text)) $text = call_user_func($text);
52
+            if (is_array($text)) {
53
+                $text = call_user_func($text);
54
+            }
53 55
             print "<p><span style=\"color:#039;\"><strong>$header</strong></span> $text</p>\n";
54 56
         }
55 57
     }
@@ -65,7 +67,9 @@  discard block
 block discarded – undo
65 67
     global $PAGE;
66 68
 
67 69
     # Ignore errors we've asked to ignore
68
-    if (error_reporting()==0) return;
70
+    if (error_reporting()==0) {
71
+        return;
72
+    }
69 73
 
70 74
    // define an assoc array of error string
71 75
    // in reality the only entries we should
@@ -209,19 +213,29 @@  discard block
 block discarded – undo
209 213
     array_shift($traceArr);
210 214
     $tabs = sizeof($traceArr)-1;
211 215
     foreach ($traceArr as $arr) {
212
-      for ($i=0; $i < $tabs; $i++) $s .= ' &nbsp; ';
216
+      for ($i=0; $i < $tabs; $i++) {
217
+          $s .= ' &nbsp; ';
218
+      }
213 219
       $tabs -= 1;
214
-      if (isset($arr['class'])) $s .= $arr['class'].'.';
220
+      if (isset($arr['class'])) {
221
+          $s .= $arr['class'].'.';
222
+      }
215 223
       $args = array();
216
-      if (isset($arr['args'])) foreach ($arr['args'] as $v) {
224
+      if (isset($arr['args'])) {
225
+          foreach ($arr['args'] as $v) {
217 226
     if (is_null($v)) $args[] = 'null';
218
-    elseif (is_array($v)) $args[] = 'Array['.sizeof($v).']';
219
-    elseif (is_object($v)) $args[] = 'Object:'.get_class($v);
220
-    elseif (is_bool($v)) $args[] = $v ? 'true' : 'false';
221
-    else {
227
+      } elseif (is_array($v)) {
228
+        $args[] = 'Array['.sizeof($v).']';
229
+    } elseif (is_object($v)) {
230
+        $args[] = 'Object:'.get_class($v);
231
+    } elseif (is_bool($v)) {
232
+        $args[] = $v ? 'true' : 'false';
233
+    } else {
222 234
       $v = (string) @$v;
223 235
       $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN));
224
-      if (strlen($v) > $MAXSTRLEN) $str .= '...';
236
+      if (strlen($v) > $MAXSTRLEN) {
237
+          $str .= '...';
238
+      }
225 239
       $args[] = $str;
226 240
     }
227 241
       }
@@ -232,7 +246,9 @@  discard block
 block discarded – undo
232 246
       //        $arr['line'],$arr['file'],$arr['file']);
233 247
       $s .= "\n";
234 248
     }
235
-    if ($print) print $s;
249
+    if ($print) {
250
+        print $s;
251
+    }
236 252
   }
237 253
 
238 254
   return $s;
@@ -326,7 +342,8 @@  discard block
 block discarded – undo
326 342
 
327 343
     if (preg_match("/^(\d\d\d\d)-(\d\d?)-(\d\d?)$/", $date, $matches)) {
328 344
         list($string, $year, $month, $day) = $matches;
329
-        if ($year < 1902) { # gmdate fns only go back to Dec. 1901
345
+        if ($year < 1902) {
346
+# gmdate fns only go back to Dec. 1901
330 347
             if ($format == SHORTDATEFORMAT) {
331 348
                 return ($day+0) . ' ' . $format_date_months_short[$month+0] . " $year";
332 349
             } else {
@@ -761,7 +778,9 @@  discard block
 block discarded – undo
761 778
     // easily to all the emails we send out from the site.
762 779
     // eg, we might want to add a .sig to everything here...
763 780
 
764
-    if (!$from) $from = CONTACTEMAIL;
781
+    if (!$from) {
782
+        $from = CONTACTEMAIL;
783
+    }
765 784
 
766 785
     $headers =
767 786
      "From: TheyWorkForYou <$from>\r\n" .
@@ -853,17 +872,21 @@  discard block
 block discarded – undo
853 872
     $rank = $rank + 0;
854 873
 
855 874
     # 11th, 12th, 13th use "th" not "st", "nd", "rd"
856
-    if (floor(($rank % 100) / 10) == 1)
857
-        return $rank . "th";
875
+    if (floor(($rank % 100) / 10) == 1) {
876
+            return $rank . "th";
877
+    }
858 878
     # 1st
859
-    if ($rank % 10 == 1)
860
-        return $rank . "st";
879
+    if ($rank % 10 == 1) {
880
+            return $rank . "st";
881
+    }
861 882
     # 2nd
862
-    if ($rank % 10 == 2)
863
-        return $rank . "nd";
883
+    if ($rank % 10 == 2) {
884
+            return $rank . "nd";
885
+    }
864 886
     # 3rd
865
-    if ($rank % 10 == 3)
866
-        return $rank . "rd";
887
+    if ($rank % 10 == 3) {
888
+            return $rank . "rd";
889
+    }
867 890
     # Everything else use th
868 891
 
869 892
     return $rank . "th";
@@ -871,8 +894,9 @@  discard block
 block discarded – undo
871 894
 
872 895
 function make_plural($word, $number)
873 896
 {
874
-    if ($number == 1)
875
-        return $word;
897
+    if ($number == 1) {
898
+            return $word;
899
+    }
876 900
     return $word . "s";
877 901
 }
878 902
 
@@ -890,8 +914,7 @@  discard block
 block discarded – undo
890 914
 function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = NULL) {
891 915
 
892 916
     // Case for Elizabeth II
893
-    if ($house == HOUSE_TYPE_ROYAL)
894
-    {
917
+    if ($house == HOUSE_TYPE_ROYAL) {
895 918
         return 'elizabeth_the_second';
896 919
     }
897 920
 
@@ -903,8 +926,7 @@  discard block
 block discarded – undo
903 926
     $out = '';
904 927
 
905 928
     // Insert the Person ID if known.
906
-    if ($pid !== NULL)
907
-    {
929
+    if ($pid !== NULL) {
908 930
         $out .= $pid . '/';
909 931
     }
910 932
 
@@ -912,8 +934,7 @@  discard block
 block discarded – undo
912 934
     $out .= urlencode(str_replace($s2, $r, str_replace($s, $r, $name)));
913 935
 
914 936
     // If there is a constituency, inject that too
915
-    if ($const && $house == HOUSE_TYPE_COMMONS)
916
-    {
937
+    if ($const && $house == HOUSE_TYPE_COMMONS) {
917 938
         $out .= '/' . urlencode(str_replace($s2, $r, str_replace($s, $r, strtolower($const))));
918 939
     }
919 940
 
@@ -929,11 +950,18 @@  discard block
 block discarded – undo
929 950
         }
930 951
     } elseif ($house == HOUSE_TYPE_LORDS) {
931 952
         $s = '';
932
-        if (!$family_name) $s = 'the ';
953
+        if (!$family_name) {
954
+            $s = 'the ';
955
+        }
933 956
         $s .= $title;
934
-        if ($family_name) $s .= ' ' . $family_name;
935
-        if ($lordofname) $s .= ' of ' . $lordofname;
936
-    } elseif ($house == HOUSE_TYPE_ROYAL) { # Queen
957
+        if ($family_name) {
958
+            $s .= ' ' . $family_name;
959
+        }
960
+        if ($lordofname) {
961
+            $s .= ' of ' . $lordofname;
962
+        }
963
+    } elseif ($house == HOUSE_TYPE_ROYAL) {
964
+# Queen
937 965
         $s = "$given_name $family_name";
938 966
     }
939 967
     return $s;
@@ -962,12 +990,17 @@  discard block
 block discarded – undo
962 990
         'Lords in Waiting (HM Household)' => 'Government Whip',
963 991
         'Baronesses in Waiting, HM Household' => 'Government Whip',
964 992
     );
965
-    if ($pos) { # Government post, or Chairman of Select Committee
993
+    if ($pos) {
994
+# Government post, or Chairman of Select Committee
966 995
         $pretty = $pos;
967
-        if ($dept && $dept != 'No Department') $pretty .= ", $dept";
968
-        if (array_key_exists($pretty, $lookup))
969
-            $pretty = $lookup[$pretty];
970
-    } else { # Member of Select Committee
996
+        if ($dept && $dept != 'No Department') {
997
+            $pretty .= ", $dept";
998
+        }
999
+        if (array_key_exists($pretty, $lookup)) {
1000
+                    $pretty = $lookup[$pretty];
1001
+        }
1002
+    } else {
1003
+# Member of Select Committee
971 1004
         $pretty = "Member, $dept";
972 1005
     }
973 1006
     return $pretty;
@@ -985,13 +1018,16 @@  discard block
 block discarded – undo
985 1018
     }
986 1019
 
987 1020
     // single date?
988
-    if (isset($data['date'])) $one_date = true;
1021
+    if (isset($data['date'])) {
1022
+        $one_date = true;
1023
+    }
989 1024
 
990 1025
     // remove empty entries, so they don't produce errors
991 1026
     foreach (array_keys($hansardmajors) as $major) {
992 1027
         if (array_key_exists($major, $data)) {
993
-            if (count($data[$major]) == 0)
994
-                unset($data[$major]);
1028
+            if (count($data[$major]) == 0) {
1029
+                            unset($data[$major]);
1030
+            }
995 1031
         }
996 1032
     }
997 1033
 
@@ -1000,22 +1036,29 @@  discard block
 block discarded – undo
1000 1036
     if (!$one_date) {
1001 1037
         $todaystime = gmmktime(0, 0, 0, date('m'), date('d'), date('Y'));
1002 1038
         foreach ($data as $major => $array) {
1003
-            if (!in_array('timestamp', $array)) $daytext[$major] = "The most recent ";
1004
-            elseif ($todaystime - $array['timestamp'] == 86400) $daytext[$major] = "Yesterday&rsquo;s";
1005
-            elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) $daytext[$major] = gmdate('l', $array['timestamp']) . "&rsquo;s";
1006
-            else $daytext[$major] = "The most recent ";
1039
+            if (!in_array('timestamp', $array)) {
1040
+                $daytext[$major] = "The most recent ";
1041
+            } elseif ($todaystime - $array['timestamp'] == 86400) {
1042
+                $daytext[$major] = "Yesterday&rsquo;s";
1043
+            } elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) {
1044
+                $daytext[$major] = gmdate('l', $array['timestamp']) . "&rsquo;s";
1045
+            } else {
1046
+                $daytext[$major] = "The most recent ";
1047
+            }
1007 1048
         }
1008 1049
     }
1009 1050
 
1010 1051
     //build html
1011 1052
     foreach ($printed_majors as $p_major) {
1012
-        if (!array_key_exists($p_major, $data))
1013
-            continue;
1053
+        if (!array_key_exists($p_major, $data)) {
1054
+                    continue;
1055
+        }
1014 1056
 
1015
-        if ($one_date)
1016
-            $date = $data['date'];
1017
-        else
1018
-            $date = $data[$p_major]['hdate'];
1057
+        if ($one_date) {
1058
+                    $date = $data['date'];
1059
+        } else {
1060
+                    $date = $data[$p_major]['hdate'];
1061
+        }
1019 1062
         $q = $db->query('SELECT section_id, body, gid
1020 1063
                 FROM hansard, epobject
1021 1064
                 WHERE hansard.epobject_id = epobject.epobject_id '
@@ -1067,14 +1110,16 @@  discard block
 block discarded – undo
1067 1110
     }
1068 1111
 
1069 1112
     $return .= '<a href="';
1070
-    if (isset($data[$major]['listurl']))
1071
-        $return .= $data[$major]['listurl'];
1072
-    else {
1113
+    if (isset($data[$major]['listurl'])) {
1114
+            $return .= $data[$major]['listurl'];
1115
+    } else {
1073 1116
         $LISTURL->reset();
1074 1117
         $return .= $LISTURL->generate();
1075 1118
     }
1076 1119
     $return .= '">' . $hansardmajors[$major]['title'] . '</a>';
1077
-    if (isset($daytext[$major])) $return;
1120
+    if (isset($daytext[$major])) {
1121
+        $return;
1122
+    }
1078 1123
     $return .= '</h4>';
1079 1124
 
1080 1125
     return $return;
@@ -1082,20 +1127,21 @@  discard block
 block discarded – undo
1082 1127
 
1083 1128
 function score_to_strongly($dmpscore) {
1084 1129
     $dmpdesc = "unknown about";
1085
-    if ($dmpscore > 0.95 && $dmpscore <= 1.0)
1086
-        $dmpdesc = "consistently voted against";
1087
-    elseif ($dmpscore > 0.85)
1088
-        $dmpdesc = "almost always voted against";
1089
-    elseif ($dmpscore > 0.6)
1090
-        $dmpdesc = "generally voted against";
1091
-    elseif ($dmpscore > 0.4)
1092
-        $dmpdesc = "voted a mixture of for and against";
1093
-    elseif ($dmpscore > 0.15)
1094
-        $dmpdesc = "generally voted for";
1095
-    elseif ($dmpscore > 0.05)
1096
-        $dmpdesc = "almost always voted for";
1097
-    elseif ($dmpscore >= 0.0)
1098
-        $dmpdesc = "consistently voted for";
1130
+    if ($dmpscore > 0.95 && $dmpscore <= 1.0) {
1131
+            $dmpdesc = "consistently voted against";
1132
+    } elseif ($dmpscore > 0.85) {
1133
+            $dmpdesc = "almost always voted against";
1134
+    } elseif ($dmpscore > 0.6) {
1135
+            $dmpdesc = "generally voted against";
1136
+    } elseif ($dmpscore > 0.4) {
1137
+            $dmpdesc = "voted a mixture of for and against";
1138
+    } elseif ($dmpscore > 0.15) {
1139
+            $dmpdesc = "generally voted for";
1140
+    } elseif ($dmpscore > 0.05) {
1141
+            $dmpdesc = "almost always voted for";
1142
+    } elseif ($dmpscore >= 0.0) {
1143
+            $dmpdesc = "consistently voted for";
1144
+    }
1099 1145
     return $dmpdesc;
1100 1146
 }
1101 1147
 
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 # Pass it a brief header word and some debug text and it'll be output.
12 12
 # If TEXT is an array, call the user function, assuming it's a class.
13
-function twfy_debug($header, $text="") {
13
+function twfy_debug($header, $text = "") {
14 14
 
15 15
     // We set ?DEBUGTAG=n in the URL.
16 16
     // (DEBUGTAG is set in config.php).
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
     if ($debug_level != '') {
28 28
 
29 29
         // Set which level shows which types of debug info.
30
-        $levels = array (
31
-            1 => array ('THEUSER', 'TIME', 'SQLERROR', 'PAGE', 'TEMPLATE', 'SEARCH', 'ALERTS', 'MP'),
32
-            2 => array ('SQL', 'EMAIL', 'WIKIPEDIA', 'hansardlist', 'debatelist', 'wranslist', 'whalllist'),
33
-            3 => array ('SQLRESULT')
30
+        $levels = array(
31
+            1 => array('THEUSER', 'TIME', 'SQLERROR', 'PAGE', 'TEMPLATE', 'SEARCH', 'ALERTS', 'MP'),
32
+            2 => array('SQL', 'EMAIL', 'WIKIPEDIA', 'hansardlist', 'debatelist', 'wranslist', 'whalllist'),
33
+            3 => array('SQLRESULT')
34 34
             // Higher than this: 'DATA', etc.
35 35
         );
36 36
 
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
         }
45 45
 
46 46
         for ($n = 1; $n <= $max_level_to_show; $n++) {
47
-            $allowed_headers = array_merge ($allowed_headers, $levels[$n] );
47
+            $allowed_headers = array_merge($allowed_headers, $levels[$n]);
48 48
         }
49 49
 
50 50
         // If we can show this header, then, er, show it.
51
-        if ( in_array($header, $allowed_headers) || $debug_level >= 4) {
51
+        if (in_array($header, $allowed_headers) || $debug_level >= 4) {
52 52
             if (is_array($text)) $text = call_user_func($text);
53 53
             print "<p><span style=\"color:#039;\"><strong>$header</strong></span> $text</p>\n";
54 54
         }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
     global $PAGE;
66 66
 
67 67
     # Ignore errors we've asked to ignore
68
-    if (error_reporting()==0) return;
68
+    if (error_reporting() == 0) return;
69 69
 
70 70
    // define an assoc array of error string
71 71
    // in reality the only entries we should
72 72
    // consider are E_WARNING, E_NOTICE, E_USER_ERROR,
73 73
    // E_USER_WARNING and E_USER_NOTICE
74 74
    # Commented out are ones that a user function cannot handle.
75
-    $errortype = array (
75
+    $errortype = array(
76 76
         #E_ERROR            => "Error",
77 77
         E_WARNING           => "Warning",
78 78
         #E_PARSE            => "Parsing Error",
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
         $source = file($filename);
132 132
         $err .= "\nSource:\n\n";
133 133
         // Show the line, plus prev and next, with line numbers.
134
-        $err .= $linenum-2 . " " . $source[$linenum-3];
135
-        $err .= $linenum-1 . " " . $source[$linenum-2];
136
-        $err .= $linenum . " " . $source[$linenum-1];
137
-        $err .= $linenum+1 . " " . $source[$linenum];
138
-        $err .= $linenum+2 . " " . $source[$linenum+1];
134
+        $err .= $linenum - 2 . " " . $source[$linenum - 3];
135
+        $err .= $linenum - 1 . " " . $source[$linenum - 2];
136
+        $err .= $linenum . " " . $source[$linenum - 1];
137
+        $err .= $linenum + 1 . " " . $source[$linenum];
138
+        $err .= $linenum + 2 . " " . $source[$linenum + 1];
139 139
     }
140 140
 
141 141
 
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
             header('HTTP/1.0 500 Internal Server Error');
180 180
             print "<p>Oops, sorry, an error has occurred!</p>\n";
181 181
         }
182
-        if (!($errno & E_USER_NOTICE) && strpos($errmsg, 'pg_connect')===false && strpos($errmsg, 'mysql_connect')===false) {
183
-            mail(BUGSLIST, "[TWFYBUG]: $errmsg", $err, "From: Bug <" . CONTACTEMAIL . ">\n".  "X-Mailer: PHP/" . phpversion() );
182
+        if (!($errno & E_USER_NOTICE) && strpos($errmsg, 'pg_connect') === false && strpos($errmsg, 'mysql_connect') === false) {
183
+            mail(BUGSLIST, "[TWFYBUG]: $errmsg", $err, "From: Bug <" . CONTACTEMAIL . ">\n" . "X-Mailer: PHP/" . phpversion());
184 184
         }
185 185
     }
186 186
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 }
199 199
 
200 200
 // pretty prints the backtrace, copied from http://uk.php.net/manual/en/function.debug-backtrace.php
201
-function adodb_backtrace($print=true)
201
+function adodb_backtrace($print = true)
202 202
 {
203 203
   $s = '';
204 204
   if (PHPVERSION() >= 4.3) {
@@ -207,26 +207,26 @@  discard block
 block discarded – undo
207 207
 
208 208
     $traceArr = debug_backtrace();
209 209
     array_shift($traceArr);
210
-    $tabs = sizeof($traceArr)-1;
210
+    $tabs = sizeof($traceArr) - 1;
211 211
     foreach ($traceArr as $arr) {
212
-      for ($i=0; $i < $tabs; $i++) $s .= ' &nbsp; ';
212
+      for ($i = 0; $i < $tabs; $i++) $s .= ' &nbsp; ';
213 213
       $tabs -= 1;
214
-      if (isset($arr['class'])) $s .= $arr['class'].'.';
214
+      if (isset($arr['class'])) $s .= $arr['class'] . '.';
215 215
       $args = array();
216 216
       if (isset($arr['args'])) foreach ($arr['args'] as $v) {
217 217
     if (is_null($v)) $args[] = 'null';
218
-    elseif (is_array($v)) $args[] = 'Array['.sizeof($v).']';
219
-    elseif (is_object($v)) $args[] = 'Object:'.get_class($v);
218
+    elseif (is_array($v)) $args[] = 'Array[' . sizeof($v) . ']';
219
+    elseif (is_object($v)) $args[] = 'Object:' . get_class($v);
220 220
     elseif (is_bool($v)) $args[] = $v ? 'true' : 'false';
221 221
     else {
222 222
       $v = (string) @$v;
223
-      $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN));
223
+      $str = _htmlspecialchars(substr($v, 0, $MAXSTRLEN));
224 224
       if (strlen($v) > $MAXSTRLEN) $str .= '...';
225 225
       $args[] = $str;
226 226
     }
227 227
       }
228 228
 
229
-      $s .= $arr['function'].'('.implode(', ',$args).')';
229
+      $s .= $arr['function'] . '(' . implode(', ', $args) . ')';
230 230
       //      $s .= sprintf("</font><font color=#808080 size=-1> # line %4d,".
231 231
       //            " file: <a href=\"file:/%s\">%s</a></font>",
232 232
       //        $arr['line'],$arr['file'],$arr['file']);
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 
241 241
 // Far from foolproof, but better than nothing.
242 242
 function validate_email($string) {
243
-    if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+'.
244
-        '@'.
245
-        '[-!#$%&\'*.\\+\/0-9=?A-Z^_`a-z{|}~]+\.'.
243
+    if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+' .
244
+        '@' .
245
+        '[-!#$%&\'*.\\+\/0-9=?A-Z^_`a-z{|}~]+\.' .
246 246
         '[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+$/', $string)) {
247 247
         return false;
248 248
     } else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     $nom = '0123456789';
265 265
     $gap = '\s\.';
266 266
 
267
-    if (    preg_match("/^[$fst][$num][$gap]*[$nom][$in][$in]$/i", $postcode) ||
267
+    if (preg_match("/^[$fst][$num][$gap]*[$nom][$in][$in]$/i", $postcode) ||
268 268
             preg_match("/^[$fst][$num][$num][$gap]*[$nom][$in][$in]$/i", $postcode) ||
269 269
             preg_match("/^[$fst][$sec][$num][$gap]*[$nom][$in][$in]$/i", $postcode) ||
270 270
             preg_match("/^[$fst][$sec][$num][$num][$gap]*[$nom][$in][$in]$/i", $postcode) ||
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 // Returns the unixtime in microseconds.
281 281
 function getmicrotime() {
282 282
     $mtime = microtime();
283
-    $mtime = explode(" ",$mtime);
283
+    $mtime = explode(" ", $mtime);
284 284
     $mtime = $mtime[1] + $mtime[0];
285 285
 
286 286
     return $mtime;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     global $timestamp_last, $timestamp_start;
294 294
     $t = getmicrotime();
295 295
     twfy_debug("TIME", sprintf("%f msecs since start; %f msecs since last; %s",
296
-            ($t - $timestamp_start)*1000.0, ($t - $timestamp_last)*1000.0, $label));
296
+            ($t - $timestamp_start) * 1000.0, ($t - $timestamp_last) * 1000.0, $label));
297 297
     $timestamp_last = $t;
298 298
 }
299 299
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     if (preg_match("/^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/", $timestamp, $matches)) {
308 308
         list($string, $year, $month, $day, $hour, $min, $sec) = $matches;
309 309
 
310
-        return gmdate ($format, gmmktime($hour, $min, $sec, $month, $day, $year));
310
+        return gmdate($format, gmmktime($hour, $min, $sec, $month, $day, $year));
311 311
     } else {
312 312
         return "";
313 313
     }
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         list($string, $year, $month, $day) = $matches;
329 329
         if ($year < 1902) { # gmdate fns only go back to Dec. 1901
330 330
             if ($format == SHORTDATEFORMAT) {
331
-                return ($day+0) . ' ' . $format_date_months_short[$month+0] . " $year";
331
+                return ($day + 0) . ' ' . $format_date_months_short[$month + 0] . " $year";
332 332
             } else {
333
-                return ($day+0) . ' ' . $format_date_months[$month+0] . " $year";
333
+                return ($day + 0) . ' ' . $format_date_months[$month + 0] . " $year";
334 334
             }
335 335
         }
336 336
 
337
-        return gmdate ($format, gmmktime(0, 0, 0, $month, $day, $year));
337
+        return gmdate($format, gmmktime(0, 0, 0, $month, $day, $year));
338 338
     } else {
339 339
         return "";
340 340
     }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     if (preg_match("/^(\d\d):(\d\d):(\d\d)$/", $time, $matches)) {
351 351
         list($string, $hour, $min, $sec) = $matches;
352 352
 
353
-        return gmdate ($format, gmmktime($hour, $min, $sec));
353
+        return gmdate($format, gmmktime($hour, $min, $sec));
354 354
     } else {
355 355
         return "";
356 356
     }
@@ -371,16 +371,16 @@  discard block
 block discarded – undo
371 371
     $in_seconds = strtotime($datetime);
372 372
     $now = time();
373 373
 
374
-    $diff   =  $now - $in_seconds;
375
-    $months =  floor($diff/2419200);
374
+    $diff   = $now - $in_seconds;
375
+    $months = floor($diff / 2419200);
376 376
     $diff   -= $months * 2419200;
377
-    $weeks  =  floor($diff/604800);
378
-    $diff   -= $weeks*604800;
379
-    $days   =  floor($diff/86400);
377
+    $weeks  = floor($diff / 604800);
378
+    $diff   -= $weeks * 604800;
379
+    $days   = floor($diff / 86400);
380 380
     $diff   -= $days * 86400;
381
-    $hours  =  floor($diff/3600);
381
+    $hours  = floor($diff / 3600);
382 382
     $diff   -= $hours * 3600;
383
-    $minutes = floor($diff/60);
383
+    $minutes = floor($diff / 60);
384 384
     $diff   -= $minutes * 60;
385 385
     $seconds = $diff;
386 386
 
@@ -394,27 +394,27 @@  discard block
 block discarded – undo
394 394
         $relative_date = '';
395 395
         if ($weeks > 0) {
396 396
             // Weeks and days
397
-            $relative_date .= ($relative_date?', ':'').$weeks.' week'.($weeks>1?'s':'');
398
-            $relative_date .= $days>0?($relative_date?', ':'').$days.' day'.($days>1?'s':''):'';
397
+            $relative_date .= ($relative_date ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '');
398
+            $relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
399 399
         } elseif ($days > 0) {
400 400
             // days and hours
401
-            $relative_date .= ($relative_date?', ':'').$days.' day'.($days>1?'s':'');
402
-            $relative_date .= $hours>0?($relative_date?', ':'').$hours.' hour'.($hours>1?'s':''):'';
401
+            $relative_date .= ($relative_date ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '');
402
+            $relative_date .= $hours > 0 ? ($relative_date ? ', ' : '') . $hours . ' hour' . ($hours > 1 ? 's' : '') : '';
403 403
         } elseif ($hours > 0) {
404 404
             // hours and minutes
405
-            $relative_date .= ($relative_date?', ':'').$hours.' hour'.($hours>1?'s':'');
406
-            $relative_date .= $minutes>0?($relative_date?', ':'').$minutes.' minute'.($minutes>1?'s':''):'';
405
+            $relative_date .= ($relative_date ? ', ' : '') . $hours . ' hour' . ($hours > 1 ? 's' : '');
406
+            $relative_date .= $minutes > 0 ? ($relative_date ? ', ' : '') . $minutes . ' minute' . ($minutes > 1 ? 's' : '') : '';
407 407
         } elseif ($minutes > 0) {
408 408
             // minutes only
409
-            $relative_date .= ($relative_date?', ':'').$minutes.' minute'.($minutes>1?'s':'');
409
+            $relative_date .= ($relative_date ? ', ' : '') . $minutes . ' minute' . ($minutes > 1 ? 's' : '');
410 410
         } else {
411 411
             // seconds only
412
-            $relative_date .= ($relative_date?', ':'').$seconds.' second'.($seconds>1?'s':'');
412
+            $relative_date .= ($relative_date ? ', ' : '') . $seconds . ' second' . ($seconds > 1 ? 's' : '');
413 413
         }
414 414
     }
415 415
 
416 416
     // Return relative date and add proper verbiage
417
-    return $relative_date.' ago';
417
+    return $relative_date . ' ago';
418 418
 
419 419
 }
420 420
 
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
         $text = substr($text, $start);
456 456
 
457 457
         // Word boundary.
458
-        if (preg_match ("/.+?\b(.*)/", $text, $matches)) {
458
+        if (preg_match("/.+?\b(.*)/", $text, $matches)) {
459 459
             $text = $matches[1];
460 460
             // Strip spare space at the start.
461
-            $text = preg_replace ("/^\s/", '', $text);
461
+            $text = preg_replace("/^\s/", '', $text);
462 462
         }
463 463
         $text = '...' . $text;
464 464
     }
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
         $text = substr($text, 0, $length - 3);
471 471
 
472 472
         // Word boundary.
473
-        if (preg_match ("/(.*)\s.+/", $text, $matches)) {
473
+        if (preg_match("/(.*)\s.+/", $text, $matches)) {
474 474
             $text = $matches[1];
475 475
             // Strip spare space at the end.
476
-            $text = preg_replace ("/\s$/", '', $text);
476
+            $text = preg_replace("/\s$/", '', $text);
477 477
         }
478 478
         // We don't want to use the HTML entity for an ellipsis (&#8230;), because then
479 479
         // it screws up when we subsequently use htmlentities() to print the returned
@@ -505,11 +505,11 @@  discard block
 block discarded – undo
505 505
 
506 506
     if ($filter_type == 'strict') {
507 507
         // No tags allowed at all!
508
-        $filter->allowed = array ();
508
+        $filter->allowed = array();
509 509
     } else {
510 510
         // Comment.
511 511
         // Only allowing <a href>, <b>, <strong>, <i> and <em>
512
-        $filter->allowed = array (
512
+        $filter->allowed = array(
513 513
             'a' => array('href'),
514 514
             'strong' => array(),
515 515
             'em' => array(),
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
     // $gid will be like 'uk.org.publicwhip/debate/2003-02-28.475.3'.
624 624
 
625
-    $newgid = substr($gid, strrpos($gid, '/')+1 );
625
+    $newgid = substr($gid, strrpos($gid, '/') + 1);
626 626
     return $newgid;
627 627
 }
628 628
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
     // will be like 2003-11-20.966.0
634 634
     // This function returns 966.0
635 635
 
636
-    return substr( $gid, (strpos($gid, '.') + 1) );
636
+    return substr($gid, (strpos($gid, '.') + 1));
637 637
 }
638 638
 
639 639
 function preg_replacement_quote($s) {
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
     global $PAGE;
678 678
 
679 679
     if (!isset($data['to']) || $data['to'] == '') {
680
-        $PAGE->error_message ("We need an email address to send to.");
680
+        $PAGE->error_message("We need an email address to send to.");
681 681
         return false;
682 682
     }
683 683
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
         if (isset($data['subject'])) {
702 702
             $subject = trim($data['subject']);
703 703
         } else {
704
-            $subject = trim( substr($firstline, 8) );
704
+            $subject = trim(substr($firstline, 8));
705 705
         }
706 706
 
707 707
         // Either way, remove this subject line from the template.
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     } elseif (isset($data['subject'])) {
711 711
         $subject = $data['subject'];
712 712
     } else {
713
-        $PAGE->error_message ("We don't have a subject line for the email, so it wasn't sent.");
713
+        $PAGE->error_message("We don't have a subject line for the email, so it wasn't sent.");
714 714
         return false;
715 715
     }
716 716
 
@@ -720,14 +720,14 @@  discard block
 block discarded – undo
720 720
     $replace = array();
721 721
 
722 722
     foreach ($merge as $key => $val) {
723
-        $search[] = '/{'.$key.'}/';
723
+        $search[] = '/{' . $key . '}/';
724 724
         $replace[] = preg_replacement_quote($val);
725 725
     }
726 726
 
727 727
     $emailtext = preg_replace($search, $replace, $emailtext);
728 728
 
729 729
     // Send it!
730
-    $success = send_email ($data['to'], $subject, $emailtext, $bulk, 'twfy-DO-NOT-REPLY@' . EMAILDOMAIN, $want_bounces);
730
+    $success = send_email($data['to'], $subject, $emailtext, $bulk, 'twfy-DO-NOT-REPLY@' . EMAILDOMAIN, $want_bounces);
731 731
 
732 732
     return $success;
733 733
 
@@ -754,15 +754,15 @@  discard block
 block discarded – undo
754 754
      "Content-Type: text/plain; charset=utf-8\r\n" .
755 755
      "MIME-Version: 1.0\r\n" .
756 756
      "Content-Transfer-Encoding: 8bit\r\n" .
757
-     ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "" ).
757
+     ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "") .
758 758
      "X-Mailer: PHP/" . phpversion();
759 759
     twfy_debug('EMAIL', "Sending email to $to with subject of '$subject'");
760 760
 
761 761
     if ($want_bounces) {
762 762
       $envelope_sender = twfy_verp_envelope_sender($to);
763
-        $success = mail ($to, $subject, $message, $headers, '-f ' . $envelope_sender);
763
+        $success = mail($to, $subject, $message, $headers, '-f ' . $envelope_sender);
764 764
     } else {
765
-        $success = mail ($to, $subject, $message, $headers);
765
+        $success = mail($to, $subject, $message, $headers);
766 766
     }
767 767
 
768 768
     return $success;
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 // http://www.iamcal.com/publish/article.php?id=13
775 775
 
776 776
 // Call this with a key name to get a GET or POST variable.
777
-function get_http_var($name, $default='') {
777
+function get_http_var($name, $default = '') {
778 778
     if (array_key_exists($name, $_GET)) {
779 779
         return clean_var($_GET[$name]);
780 780
     }
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 }
801 801
 
802 802
 // Call this with a key name to get a COOKIE variable.
803
-function get_cookie_var($name, $default='') {
803
+function get_cookie_var($name, $default = '') {
804 804
     if (array_key_exists($name, $_COOKIE)) {
805 805
         return clean_var($_COOKIE[$name]);
806 806
     }
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 // Pass it an array of key names that should not be generated as
812 812
 // hidden form variables. It then outputs hidden form variables
813 813
 // based on the session_vars for this page.
814
-function hidden_form_vars ($omit = array()) {
814
+function hidden_form_vars($omit = array()) {
815 815
     global $DATA, $this_page;
816 816
 
817 817
     $session_vars = $DATA->page_metadata($this_page, "session_vars");
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 }
825 825
 
826 826
 // Deprecated. Use hidden_form_vars, above, instead.
827
-function hidden_vars ($omit = array()) {
827
+function hidden_vars($omit = array()) {
828 828
     global $DATA;
829 829
 
830 830
     foreach ($args as $key => $val) {
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 function entities_to_numbers($string) {
868 868
     $string = str_replace(
869 869
         array('&Ouml;', '&acirc;', '&uacute;', '&aacute;', '&iacute;', '&ocirc;', '&eacute;'),
870
-        array('&#214;', '&#226;',  '&#250;',   '&#225;',   '&#237;',   '&#244;',  '&#233;'  ),
870
+        array('&#214;', '&#226;', '&#250;', '&#225;', '&#237;', '&#244;', '&#233;'),
871 871
         $string
872 872
     );
873 873
     return $string;
@@ -881,9 +881,9 @@  discard block
 block discarded – undo
881 881
         return 'elizabeth_the_second';
882 882
     }
883 883
 
884
-    $s   = array(' ', '&amp;', '&ocirc;',  '&Ouml;',  '&ouml;',   '&acirc;',  '&iacute;', '&aacute;', '&uacute;', '&eacute;', '&oacute;', '&Oacute;');
885
-    $s2  = array(" ", "&",     "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93");
886
-    $r   = array('_', 'and',   'o',        'o',       'o',        'a',        'i',        'a',        'u',        'e',        'o',        'o');
884
+    $s   = array(' ', '&amp;', '&ocirc;', '&Ouml;', '&ouml;', '&acirc;', '&iacute;', '&aacute;', '&uacute;', '&eacute;', '&oacute;', '&Oacute;');
885
+    $s2  = array(" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93");
886
+    $r   = array('_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o');
887 887
     $name = preg_replace('#^the #', '', strtolower($name));
888 888
 
889 889
     $out = '';
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
                 }
1024 1024
                 $out .= '<li>' . $body . '<ul>';
1025 1025
             } else {
1026
-                $LISTURL->insert( array( 'id' => $gid ) );
1027
-                $out .= '<li><a href="'.$LISTURL->generate().'">';
1026
+                $LISTURL->insert(array('id' => $gid));
1027
+                $out .= '<li><a href="' . $LISTURL->generate() . '">';
1028 1028
                 $out .= $body . '</a>';
1029 1029
             }
1030 1030
         }
Please login to merge, or discard this patch.
www/docs/mp/index.php 5 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 // Finally, if this is a Votes page, replace the page description with
256 256
 // something more descriptive of the actual data on the page.
257 257
 if ($pagetype == 'votes') {
258
-  $title = "Voting record - " . $title;
259
-  $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
258
+    $title = "Voting record - " . $title;
259
+    $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
260 260
 }
261 261
 
262 262
 // Set page metadata
@@ -359,19 +359,19 @@  discard block
 block discarded – undo
359 359
         // Generate voting segments
360 360
         $set_descriptions = $policiesList->getSetDescriptions();
361 361
         if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) {
362
-          $data['key_votes_segments'] = array(
363
-              array(
364
-                  'key' => $policy_set,
365
-                  'title' => $set_descriptions[$policy_set],
366
-                  'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
367
-                      $policiesList->limitToSet($policy_set), $MEMBER, $policyOptions
368
-                  )
369
-              )
370
-          );
371
-          $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set;
372
-          $data['page_title'] = $policiesList->getSetDescriptions()[$policy_set] . ' ' . $title . ' - TheyWorkForYou';
373
-          $data['meta_description'] = 'See how ' . $data['full_name'] . ' voted on ' . $policiesList->getSetDescriptions()[$policy_set];
374
-          $data['single_policy_page'] = true;
362
+            $data['key_votes_segments'] = array(
363
+                array(
364
+                    'key' => $policy_set,
365
+                    'title' => $set_descriptions[$policy_set],
366
+                    'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
367
+                        $policiesList->limitToSet($policy_set), $MEMBER, $policyOptions
368
+                    )
369
+                )
370
+            );
371
+            $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set;
372
+            $data['page_title'] = $policiesList->getSetDescriptions()[$policy_set] . ' ' . $title . ' - TheyWorkForYou';
373
+            $data['meta_description'] = 'See how ' . $data['full_name'] . ' voted on ' . $policiesList->getSetDescriptions()[$policy_set];
374
+            $data['single_policy_page'] = true;
375 375
         } else {
376 376
             $data['single_policy_page'] = false;
377 377
             $data['key_votes_segments'] = array(
@@ -519,11 +519,11 @@  discard block
 block discarded – undo
519 519
 
520 520
         // Generate voting segments
521 521
         $data['segment'] = array(
522
-          'key'   => $policy_set,
523
-          'title' => $policiesList->getSetDescriptions()[$policy_set],
524
-          'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
525
-              $policiesList->limitToSet($policy_set), $MEMBER
526
-          )
522
+            'key'   => $policy_set,
523
+            'title' => $policiesList->getSetDescriptions()[$policy_set],
524
+            'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
525
+                $policiesList->limitToSet($policy_set), $MEMBER
526
+            )
527 527
         );
528 528
 
529 529
         MySociety\TheyWorkForYou\Renderer::output('mp/votes_svg', $data, true);
Please login to merge, or discard this patch.
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -731,26 +731,26 @@
 block discarded – undo
731 731
 function person_error_page($message) {
732 732
     global $this_page;
733 733
     switch($this_page) {
734
-    case 'mla':
735
-        $rep = 'MLA';
736
-        $SEARCHURL = '/postcode/';
737
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('mlas');
738
-        break;
739
-    case 'msp':
740
-        $rep = 'MSP';
741
-        $SEARCHURL = '/postcode/';
742
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('msps');
743
-        break;
744
-    case 'peer':
745
-        $rep = 'Lord';
746
-        $SEARCHURL = '';
747
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('peers');
748
-        break;
749
-    default:
750
-        $rep = 'MP';
751
-        $SEARCHURL = new \MySociety\TheyWorkForYou\Url('mp');
752
-        $SEARCHURL = $SEARCHURL->generate();
753
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('mps');
734
+        case 'mla':
735
+            $rep = 'MLA';
736
+            $SEARCHURL = '/postcode/';
737
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('mlas');
738
+            break;
739
+        case 'msp':
740
+            $rep = 'MSP';
741
+            $SEARCHURL = '/postcode/';
742
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('msps');
743
+            break;
744
+        case 'peer':
745
+            $rep = 'Lord';
746
+            $SEARCHURL = '';
747
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('peers');
748
+            break;
749
+        default:
750
+            $rep = 'MP';
751
+            $SEARCHURL = new \MySociety\TheyWorkForYou\Url('mp');
752
+            $SEARCHURL = $SEARCHURL->generate();
753
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('mps');
754 754
     }
755 755
 
756 756
     $data = array(
Please login to merge, or discard this patch.
Braces   +139 added lines, -62 removed lines patch added patch discarded remove patch
@@ -62,16 +62,36 @@  discard block
 block discarded – undo
62 62
 $constituency = strtolower(str_replace('_', ' ', get_http_var('c')));
63 63
 
64 64
 // Fix for names with non-ASCII characters
65
-if ($name == 'sion simon') $name = 'si\xf4n simon';
66
-if ($name == 'sian james') $name = 'si\xe2n james';
67
-if ($name == 'lembit opik') $name = 'lembit \xf6pik';
68
-if ($name == 'bairbre de brun') $name = 'bairbre de br\xfan';
69
-if ($name == 'daithi mckay') $name = 'daith\xed mckay';
70
-if ($name == 'caral ni chuilin') $name = 'car\xe1l n\xed chuil\xedn';
71
-if ($name == 'caledon du pre') $name = 'caledon du pr\xe9';
72
-if ($name == 'sean etchingham') $name = 'se\xe1n etchingham';
73
-if ($name == 'john tinne') $name = 'john tinn\xe9';
74
-if ($name == 'renee short') $name = 'ren\xe9e short';
65
+if ($name == 'sion simon') {
66
+    $name = 'si\xf4n simon';
67
+}
68
+if ($name == 'sian james') {
69
+    $name = 'si\xe2n james';
70
+}
71
+if ($name == 'lembit opik') {
72
+    $name = 'lembit \xf6pik';
73
+}
74
+if ($name == 'bairbre de brun') {
75
+    $name = 'bairbre de br\xfan';
76
+}
77
+if ($name == 'daithi mckay') {
78
+    $name = 'daith\xed mckay';
79
+}
80
+if ($name == 'caral ni chuilin') {
81
+    $name = 'car\xe1l n\xed chuil\xedn';
82
+}
83
+if ($name == 'caledon du pre') {
84
+    $name = 'caledon du pr\xe9';
85
+}
86
+if ($name == 'sean etchingham') {
87
+    $name = 'se\xe1n etchingham';
88
+}
89
+if ($name == 'john tinne') {
90
+    $name = 'john tinn\xe9';
91
+}
92
+if ($name == 'renee short') {
93
+    $name = 'ren\xe9e short';
94
+}
75 95
 
76 96
 // Fix for common misspellings, name changes etc
77 97
 $name_fix = array(
@@ -103,7 +123,9 @@  discard block
 block discarded – undo
103 123
 }
104 124
 
105 125
 // Fixes for Ynys Mon, and a Unicode URL
106
-if ($constituency == 'ynys mon') $constituency = "ynys m\xf4n";
126
+if ($constituency == 'ynys mon') {
127
+    $constituency = "ynys m\xf4n";
128
+}
107 129
 if (preg_match("#^ynys m\xc3\xb4n#i", $constituency)) {
108 130
     $constituency = "ynys m\xf4n";
109 131
 }
@@ -126,11 +148,17 @@  discard block
 block discarded – undo
126 148
 
127 149
 /////////////////////////////////////////////////////////
128 150
 // DETERMINE TYPE OF REPRESENTITIVE
129
-if (get_http_var('peer')) $this_page = 'peer';
130
-elseif (get_http_var('royal')) $this_page = 'royal';
131
-elseif (get_http_var('mla')) $this_page = 'mla';
132
-elseif (get_http_var('msp')) $this_page = 'msp';
133
-else $this_page = 'mp';
151
+if (get_http_var('peer')) {
152
+    $this_page = 'peer';
153
+} elseif (get_http_var('royal')) {
154
+    $this_page = 'royal';
155
+} elseif (get_http_var('mla')) {
156
+    $this_page = 'mla';
157
+} elseif (get_http_var('msp')) {
158
+    $this_page = 'msp';
159
+} else {
160
+    $this_page = 'mp';
161
+}
134 162
 
135 163
 try {
136 164
     if (is_numeric($pid)) {
@@ -179,8 +207,9 @@  discard block
 block discarded – undo
179 207
 $desc = "Read $member_name's contributions to Parliament, including speeches and questions";
180 208
 
181 209
 // Enhance description if this is a current member
182
-if ($MEMBER->current_member_anywhere())
210
+if ($MEMBER->current_member_anywhere()) {
183 211
     $desc .= ', investigate their voting record, and get email alerts on their activity';
212
+}
184 213
 
185 214
 // Enhance title if this is a member of the Commons
186 215
 if ($MEMBER->house(HOUSE_TYPE_COMMONS)) {
@@ -188,8 +217,10 @@  discard block
 block discarded – undo
188 217
         $title .= ', former';
189 218
     }
190 219
     $title .= ' MP';
191
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
192
-}
220
+    if ($MEMBER->constituency()) {
221
+        $title .= ', ' . $MEMBER->constituency();
222
+    }
223
+    }
193 224
 
194 225
 // Enhance title if this is a member of NIA
195 226
 if ($MEMBER->house(HOUSE_TYPE_NI)) {
@@ -202,8 +233,10 @@  discard block
 block discarded – undo
202 233
         $title .= ', former';
203 234
     }
204 235
     $title .= ' MLA';
205
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
206
-}
236
+    if ($MEMBER->constituency()) {
237
+        $title .= ', ' . $MEMBER->constituency();
238
+    }
239
+    }
207 240
 
208 241
 // Enhance title if this is a member of Scottish Parliament
209 242
 if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) {
@@ -256,8 +289,9 @@  discard block
 block discarded – undo
256 289
 
257 290
 // Build the RSS link and add it to page data.
258 291
 $feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf';
259
-if (file_exists(BASEDIR . '/' . $feedurl))
292
+if (file_exists(BASEDIR . '/' . $feedurl)) {
260 293
     $DATA->set_page_metadata($this_page, 'rss', $feedurl);
294
+}
261 295
 
262 296
 // Prepare data for the template
263 297
 $data['full_name'] = $MEMBER->full_name();
@@ -684,11 +718,13 @@  discard block
 block discarded – undo
684 718
         $url = $MEMBER->url();
685 719
         $params = array();
686 720
         foreach ($_GET as $key => $value) {
687
-            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid')
688
-                $params[] = "$key=$value";
721
+            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') {
722
+                            $params[] = "$key=$value";
723
+            }
724
+        }
725
+        if (count($params)) {
726
+                    $url .= '?' . join('&', $params);
689 727
         }
690
-        if (count($params))
691
-            $url .= '?' . join('&', $params);
692 728
         if ($pagetype) {
693 729
             $pagetype = '/' . $pagetype;
694 730
         } else {
@@ -765,16 +801,21 @@  discard block
 block discarded – undo
765 801
     $current_member = $MEMBER->current_member();
766 802
     $left_house = $MEMBER->left_house();
767 803
 
768
-    if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) { # Royal short-circuit
804
+    if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) {
805
+# Royal short-circuit
769 806
         return '<strong>Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
770 807
             . '<br>Coronated on 2 June 1953</strong></li>';
771 808
     }
772 809
     $desc = '';
773 810
     foreach ($MEMBER->houses() as $house) {
774
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
775
-            continue; # Same info is printed further down
811
+        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) {
812
+                    continue;
813
+        }
814
+        # Same info is printed further down
776 815
 
777
-        if (!$current_member[$house]) $desc .= 'Former ';
816
+        if (!$current_member[$house]) {
817
+            $desc .= 'Former ';
818
+        }
778 819
 
779 820
         $party = $left_house[$house]['party'];
780 821
         $party_br = '';
@@ -782,8 +823,9 @@  discard block
 block discarded – undo
782 823
             $party_br = $m[2];
783 824
             $party = $m[1];
784 825
         }
785
-        if ($party != 'unknown')
786
-            $desc .= _htmlentities($party);
826
+        if ($party != 'unknown') {
827
+                    $desc .= _htmlentities($party);
828
+        }
787 829
         if ($party == 'Speaker' || $party == 'Deputy Speaker') {
788 830
             $desc .= ', and ';
789 831
             # XXX: Might go horribly wrong if something odd happens
@@ -794,15 +836,23 @@  discard block
 block discarded – undo
794 836
         }
795 837
         if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
796 838
             $desc .= ' ';
797
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
798
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
799
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
839
+            if ($house==HOUSE_TYPE_COMMONS) {
840
+                $desc .= '<abbr title="Member of Parliament">MP</abbr>';
841
+            }
842
+            if ($house==HOUSE_TYPE_NI) {
843
+                $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
844
+            }
845
+            if ($house==HOUSE_TYPE_SCOTLAND) {
846
+                $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
847
+            }
800 848
             if ($party_br) {
801 849
                 $desc .= " ($party_br)";
802 850
             }
803 851
             $desc .= ' for ' . $left_house[$house]['constituency'];
804 852
         }
805
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
853
+        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') {
854
+            $desc .= ' Peer';
855
+        }
806 856
         $desc .= ', ';
807 857
     }
808 858
     $desc = preg_replace('#, $#', '', $desc);
@@ -1065,10 +1115,13 @@  discard block
 block discarded – undo
1065 1115
     # Find latest entered house
1066 1116
     $entered_house = null;
1067 1117
     foreach ($member->entered_house() as $h => $eh) {
1068
-        if (!$entered_house || $eh['date'] > $entered_house) $entered_house = $eh['date'];
1118
+        if (!$entered_house || $eh['date'] > $entered_house) {
1119
+            $entered_house = $eh['date'];
1120
+        }
1121
+    }
1122
+    if ($entered_house > $year_ago) {
1123
+            $since_text = 'since joining Parliament';
1069 1124
     }
1070
-    if ($entered_house > $year_ago)
1071
-        $since_text = 'since joining Parliament';
1072 1125
 
1073 1126
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
1074 1127
     $section = 'section:debates section:whall section:lords section:ni';
@@ -1081,10 +1134,12 @@  discard block
 block discarded – undo
1081 1134
         $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1));
1082 1135
         // We assume that if they've answered a question, they're a minister
1083 1136
         $minister = 0; $Lminister = false;
1084
-        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0)
1085
-            $minister = 1;
1086
-        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0)
1087
-            $Lminister = true;
1137
+        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
1138
+                    $minister = 1;
1139
+        }
1140
+        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
1141
+                    $Lminister = true;
1142
+        }
1088 1143
         if ($member->party() == 'SPK' || $member->party() == 'CWM' || $member->party() == 'DCWM') {
1089 1144
             $minister = 2;
1090 1145
         }
@@ -1133,11 +1188,17 @@  discard block
 block discarded – undo
1133 1188
 
1134 1189
     if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1135 1190
         $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1136
-        if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1137
-        elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1138
-        elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1139
-        elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1140
-        elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1191
+        if ($member->house_disp == HOUSE_TYPE_COMMONS) {
1192
+            $line .= 'this MP';
1193
+        } elseif ($member->house_disp == HOUSE_TYPE_LORDS) {
1194
+            $line .= 'this peer';
1195
+        } elseif ($member->house_disp == HOUSE_TYPE_NI) {
1196
+            $line .= 'this MLA';
1197
+        } elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) {
1198
+            $line .= 'this MSP';
1199
+        } elseif ($member->house_disp == HOUSE_TYPE_ROYAL) {
1200
+            $line .= $member->full_name();
1201
+        }
1141 1202
         if ($has_email_alerts) {
1142 1203
             $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1143 1204
         }
@@ -1161,10 +1222,12 @@  discard block
 block discarded – undo
1161 1222
 
1162 1223
 function display_stats_line($category, $blurb, $type, $inwhat, $afterstuff, $extra_info, $minister = false, $Lminister = false) {
1163 1224
     $return = false;
1164
-    if (isset($extra_info[$category]))
1165
-        $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1166
-    if (isset($extra_info["L$category"]))
1167
-        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1225
+    if (isset($extra_info[$category])) {
1226
+            $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1227
+    }
1228
+    if (isset($extra_info["L$category"])) {
1229
+            $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1230
+    }
1168 1231
     return $return;
1169 1232
 }
1170 1233
 
@@ -1176,17 +1239,21 @@  discard block
 block discarded – undo
1176 1239
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1177 1240
         }
1178 1241
     }
1179
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1242
+    if ($house==HOUSE_TYPE_LORDS) {
1243
+        $inwhat = str_replace('MP', 'Lord', $inwhat);
1244
+    }
1180 1245
     $line = $blurb;
1181 1246
     $line .= '<strong>' . $extra_info[$category];
1182
-    if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1247
+    if ($type) {
1248
+        $line .= ' ' . make_plural($type, $extra_info[$category]);
1249
+    }
1183 1250
     $line .= '</strong>';
1184 1251
     $line .= $inwhat;
1185 1252
     if ($minister===2) {
1186 1253
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1187
-    } elseif ($minister)
1188
-        $line .= ' &#8212; Ministers do not ask written questions';
1189
-    else {
1254
+    } elseif ($minister) {
1255
+            $line .= ' &#8212; Ministers do not ask written questions';
1256
+    } else {
1190 1257
         $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1191 1258
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1192 1259
             $line .= ' &#8212; ';
@@ -1225,11 +1292,21 @@  discard block
 block discarded – undo
1225 1292
         $mean = $extra_info["writetothem_responsiveness_mean_$year"];
1226 1293
 
1227 1294
         $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
1228
-        if ($a == 'very low') $a = 'a very low';
1229
-        if ($a == 'low') $a = 'a low';
1230
-        if ($a == 'medium') $a = 'a medium';
1231
-        if ($a == 'high') $a = 'a high';
1232
-        if ($a == 'very high') $a = 'a very high';
1295
+        if ($a == 'very low') {
1296
+            $a = 'a very low';
1297
+        }
1298
+        if ($a == 'low') {
1299
+            $a = 'a low';
1300
+        }
1301
+        if ($a == 'medium') {
1302
+            $a = 'a medium';
1303
+        }
1304
+        if ($a == 'high') {
1305
+            $a = 'a high';
1306
+        }
1307
+        if ($a == 'very high') {
1308
+            $a = 'a very high';
1309
+        }
1233 1310
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1234 1311
 
1235 1312
         return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 
31 31
 // Disable the old PAGE class.
32
-$new_style_template = TRUE;
32
+$new_style_template = true;
33 33
 
34 34
 // Include all the things this page needs.
35 35
 include_once '../../includes/easyparliament/init.php';
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 // Basic name, title and description
177 177
 $member_name = ucfirst($MEMBER->full_name());
178 178
 $title = $member_name;
179
-$desc = "Read $member_name's contributions to Parliament, including speeches and questions";
179
+$desc = "read $member_name's contributions to Parliament, including speeches and questions";
180 180
 
181 181
 // Enhance description if this is a current member
182 182
 if ($MEMBER->current_member_anywhere())
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 }
221 221
 
222 222
 $known_for = '';
223
-$current_offices_ignoring_committees = $MEMBER->offices('current', TRUE);
223
+$current_offices_ignoring_committees = $MEMBER->offices('current', true);
224 224
 if (count($current_offices_ignoring_committees) > 0) {
225 225
     $known_for = $current_offices_ignoring_committees[0];
226 226
 }
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 $data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'Sinn Féin' && !$MEMBER->current_member(HOUSE_TYPE_NI)));
308 308
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
309 309
 
310
-$data['pre_2010_expenses'] = False;
310
+$data['pre_2010_expenses'] = false;
311 311
 $data['post_2010_expenses'] = $data['leave_date'] > '2010-05-05';
312 312
 
313 313
 if ($data['entry_date'] < '2010-05-05') {
314
-    $data['pre_2010_expenses'] = True;
314
+    $data['pre_2010_expenses'] = true;
315 315
     // Set the expenses URL if we know it
316 316
     if (isset($MEMBER->extra_info['expenses_url'])) {
317 317
         $data['expenses_url_2004'] = $MEMBER->extra_info['expenses_url'];
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
  * Redirect to the canonical page for a member.
678 678
  */
679 679
 
680
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
680
+function member_redirect (&$MEMBER, $code = 301, $pagetype = null) {
681 681
     // We come here after creating a MEMBER object by various methods.
682 682
     // Now we redirect to the canonical MP page, with a person_id.
683 683
     if ($MEMBER->person_id()) {
@@ -1163,8 +1163,8 @@  discard block
 block discarded – undo
1163 1163
     $return = false;
1164 1164
     if (isset($extra_info[$category]))
1165 1165
         $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1166
-    if (isset($extra_info["L$category"]))
1167
-        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1166
+    if (isset($extra_info["l$category"]))
1167
+        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "l$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1168 1168
     return $return;
1169 1169
 }
1170 1170
 
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     }
119 119
     if ($pid) {
120 120
         $URL = new \MySociety\TheyWorkForYou\Url('search');
121
-        $URL->insert( array('pid'=>$pid, 'pop'=>1) );
121
+        $URL->insert(array('pid'=>$pid, 'pop'=>1));
122 122
         header('Location: ' . $URL->generate('none'));
123 123
         exit;
124 124
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     } elseif ($THEUSER->postcode_is_set()) {
150 150
         get_mp_by_user_postcode($THEUSER->postcode());
151 151
     } else {
152
-        twfy_debug ('MP', "We don't have any way of telling what MP to display");
152
+        twfy_debug('MP', "We don't have any way of telling what MP to display");
153 153
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, but we can&rsquo;t tell which representative to display.');
154 154
     }
155 155
     if (!isset($MEMBER) || !$MEMBER->valid) {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     if (!$MEMBER->current_member(HOUSE_TYPE_SCOTLAND)) {
217 217
         $title .= ', former';
218 218
     }
219
-    $title .= ' MSP, '.$MEMBER->constituency();
219
+    $title .= ' MSP, ' . $MEMBER->constituency();
220 220
 }
221 221
 
222 222
 $known_for = '';
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 $data['eu_stance'] = $MEMBER->getEUStance();
285 285
 
286 286
 # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs
287
-$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) );
287
+$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS));
288 288
 # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs
289 289
 $data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'Sinn Féin' && !$MEMBER->current_member(HOUSE_TYPE_NI)));
290 290
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 
311 311
 $data['this_page'] = $this_page;
312 312
 $data['current_assembly'] = 'westminster';
313
-if ( $this_page == 'msp' || $this_page == 'yourmsp' ) {
313
+if ($this_page == 'msp' || $this_page == 'yourmsp') {
314 314
     $data['current_assembly'] = 'scotland';
315
-} else if ( $this_page == 'mla' || $this_page == 'yourmla' ) {
315
+} else if ($this_page == 'mla' || $this_page == 'yourmla') {
316 316
     $data['current_assembly'] = 'ni';
317 317
 }
318 318
 
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
329 329
         $policySummaries = $divisions->getMemberDivisionDetails();
330 330
 
331
-        $policyOptions = array( 'summaries' => $policySummaries);
331
+        $policyOptions = array('summaries' => $policySummaries);
332 332
 
333 333
         // Generate voting segments
334 334
         $set_descriptions = $policiesList->getSetDescriptions();
335
-        if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) {
335
+        if ($policy_set && array_key_exists($policy_set, $set_descriptions)) {
336 336
           $data['key_votes_segments'] = array(
337 337
               array(
338 338
                   'key' => $policy_set,
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
     case 'recent':
452 452
         $policiesList = new MySociety\TheyWorkForYou\Policies;
453
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
453
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
454 454
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList);
455 455
 
456 456
         $data['divisions'] = $divisions->getRecentMemberDivisions();
@@ -461,15 +461,15 @@  discard block
 block discarded – undo
461 461
 
462 462
     case 'divisions':
463 463
         $policyID = get_http_var('policy');
464
-        if ( $policyID ) {
465
-            $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID );
464
+        if ($policyID) {
465
+            $policiesList = new MySociety\TheyWorkForYou\Policies($policyID);
466 466
         } else {
467 467
             $policiesList = new MySociety\TheyWorkForYou\Policies;
468 468
         }
469
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
469
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
470 470
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList);
471 471
 
472
-        if ( $policyID ) {
472
+        if ($policyID) {
473 473
             $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID);
474 474
         } else {
475 475
             $data['policydivisions'] = $divisions->getAllMemberDivisionsByPolicy();
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
         // generate party policy diffs
548 548
         $party = new MySociety\TheyWorkForYou\Party($MEMBER->party());
549
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
549
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
550 550
         $party_positions = $party->getAllPolicyPositions($policiesList);
551 551
         $policy_diffs = $MEMBER->getPartyPolicyDiffs($party, $policiesList, $positions, true);
552 552
 
@@ -600,16 +600,16 @@  discard block
 block discarded – undo
600 600
     global $THEUSER;
601 601
     $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
602 602
     if (!validate_postcode($pc)) {
603
-        twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
604
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn&rsquo;t a valid postcode');
603
+        twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
604
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a valid postcode');
605 605
     }
606
-    twfy_debug ('MP', "MP lookup by postcode");
606
+    twfy_debug('MP', "MP lookup by postcode");
607 607
     $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
608 608
     if ($constituency == "connection_timed_out") {
609 609
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, we couldn&rsquo;t check your postcode right now, as our postcode lookup server is under quite a lot of load.');
610 610
     } elseif ($constituency == "") {
611
-        twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
612
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn&rsquo;t a known postcode');
611
+        twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
612
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a known postcode');
613 613
     } else {
614 614
         // Redirect to the canonical MP page, with a person id.
615 615
         $MEMBER = new MySociety\TheyWorkForYou\Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS));
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
     }
622 622
 }
623 623
 
624
-function get_person_by_name($name, $const='') {
624
+function get_person_by_name($name, $const = '') {
625 625
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const));
626 626
     // Edge case, only attempt further detection if this isn't the Queen.
627 627
     if ($name !== 'elizabeth the second' || $const) {
628
-        twfy_debug ('MP', 'Redirecting for MP found by name/constituency');
628
+        twfy_debug('MP', 'Redirecting for MP found by name/constituency');
629 629
         member_redirect($MEMBER);
630 630
     }
631 631
     return $MEMBER;
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
  * Redirect to the canonical page for a member.
660 660
  */
661 661
 
662
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
662
+function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) {
663 663
     // We come here after creating a MEMBER object by various methods.
664 664
     // Now we redirect to the canonical MP page, with a person_id.
665 665
     if ($MEMBER->person_id()) {
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         } else {
677 677
             $pagetype = '';
678 678
         }
679
-        header('Location: ' . $url . $pagetype, true, $code );
679
+        header('Location: ' . $url . $pagetype, true, $code);
680 680
         exit;
681 681
     }
682 682
 }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 
705 705
 function person_error_page($message) {
706 706
     global $this_page;
707
-    switch($this_page) {
707
+    switch ($this_page) {
708 708
     case 'mla':
709 709
         $rep = 'MLA';
710 710
         $SEARCHURL = '/postcode/';
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  * Generate the summary of this person's held positions.
743 743
  */
744 744
 
745
-function person_summary_description ($MEMBER) {
745
+function person_summary_description($MEMBER) {
746 746
     $entered_house = $MEMBER->entered_house();
747 747
     $current_member = $MEMBER->current_member();
748 748
     $left_house = $MEMBER->left_house();
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
     }
754 754
     $desc = '';
755 755
     foreach ($MEMBER->houses() as $house) {
756
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
756
+        if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
757 757
             continue; # Same info is printed further down
758 758
 
759 759
         if (!$current_member[$house]) $desc .= 'Former ';
@@ -774,17 +774,17 @@  discard block
 block discarded – undo
774 774
                 $desc .= $last['from'] . ' ';
775 775
             }
776 776
         }
777
-        if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
777
+        if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) {
778 778
             $desc .= ' ';
779
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
780
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
781
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
779
+            if ($house == HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
780
+            if ($house == HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
781
+            if ($house == HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
782 782
             if ($party_br) {
783 783
                 $desc .= " ($party_br)";
784 784
             }
785 785
             $desc .= ' for ' . $left_house[$house]['constituency'];
786 786
         }
787
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
787
+        if ($house == HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
788 788
         $desc .= ', ';
789 789
     }
790 790
     $desc = preg_replace('#, $#', '', $desc);
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
  * @return string A HTML summary of this person's rebellion rate.
802 802
  */
803 803
 
804
-function person_rebellion_rate ($member) {
804
+function person_rebellion_rate($member) {
805 805
 
806 806
     // Rebellion string may be empty.
807 807
     $rebellion_string = '';
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
     // benefit unfortunately.
840 840
     twfy_debug_timestamp();
841 841
 
842
-    $person_id= $member->person_id();
842
+    $person_id = $member->person_id();
843 843
 
844 844
     $memcache = new MySociety\TheyWorkForYou\Memcache;
845 845
     $recent = $memcache->get('recent_appear:' . $person_id);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
         $SEARCHENGINE = new \SEARCHENGINE($searchstring);
851 851
 
852 852
         $hansard = new MySociety\TheyWorkForYou\Hansard();
853
-        $args = array (
853
+        $args = array(
854 854
             's' => $searchstring,
855 855
             'p' => 1,
856 856
             'num' => 3,
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
     twfy_debug_timestamp();
866 866
 
867 867
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
868
-    $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) );
868
+    $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1));
869 869
 
870 870
     $out['more_href'] = $MOREURL->generate() . '#n4';
871 871
     $out['more_text'] = 'More of ' . ucfirst($member->full_name()) . '&rsquo;s recent appearances';
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
         }
1077 1077
     }
1078 1078
 
1079
-    foreach ( $wtt_stats_years as $year ) {
1079
+    foreach ($wtt_stats_years as $year) {
1080 1080
         $wtt_displayed = display_writetothem_numbers($year, $extra_info);
1081 1081
         if ($wtt_displayed) {
1082 1082
             $out[] = $wtt_displayed;
@@ -1112,15 +1112,15 @@  discard block
 block discarded – undo
1112 1112
         }
1113 1113
     }
1114 1114
 
1115
-    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1116
-        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1115
+    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts'] > 0 || $has_email_alerts)) {
1116
+        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are') . ' tracking ';
1117 1117
         if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1118 1118
         elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1119 1119
         elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1120 1120
         elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1121 1121
         elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1122 1122
         if ($has_email_alerts) {
1123
-            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1123
+            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid=' . $member->person_id() . '">email me updates on ' . $member->full_name() . '&rsquo;s activity</a>';
1124 1124
         }
1125 1125
 
1126 1126
         $out[] = $line;
@@ -1150,25 +1150,25 @@  discard block
 block discarded – undo
1150 1150
 }
1151 1151
 
1152 1152
 function display_stats_line_house($house, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff) {
1153
-    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category =='comments_on_speeches' ||
1154
-        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category =='Lcomments_on_speeches') {
1155
-        if ($extra_info[$category]==0) {
1153
+    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category == 'comments_on_speeches' ||
1154
+        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category == 'Lcomments_on_speeches') {
1155
+        if ($extra_info[$category] == 0) {
1156 1156
             $blurb = preg_replace('#<a.*?>#', '', $blurb);
1157 1157
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1158 1158
         }
1159 1159
     }
1160
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1160
+    if ($house == HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1161 1161
     $line = $blurb;
1162 1162
     $line .= '<strong>' . $extra_info[$category];
1163 1163
     if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1164 1164
     $line .= '</strong>';
1165 1165
     $line .= $inwhat;
1166
-    if ($minister===2) {
1166
+    if ($minister === 2) {
1167 1167
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1168 1168
     } elseif ($minister)
1169 1169
         $line .= ' &#8212; Ministers do not ask written questions';
1170 1170
     else {
1171
-        $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1171
+        $type = ($house == HOUSE_TYPE_COMMONS ? 'MP' : ($house == HOUSE_TYPE_LORDS ? 'Lord' : 'MLA'));
1172 1172
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1173 1173
             $line .= ' &#8212; ';
1174 1174
             $q = $extra_info[$category . '_quintile'];
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
         if ($a == 'very high') $a = 'a very high';
1214 1214
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1215 1215
 
1216
-        return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info);
1216
+        return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/' . $year . '/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during " . $year . ", according to constituents", "", $extra_info);
1217 1217
     }
1218 1218
 
1219 1219
 }
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 function get_all_writetothem_strings($member, $wtt_stats_years) {
1222 1222
     $extra_info = $member->extra_info();
1223 1223
     $strings = array();
1224
-    foreach ( $wtt_stats_years as $year ) {
1224
+    foreach ($wtt_stats_years as $year) {
1225 1225
 
1226 1226
         if (isset($extra_info["writetothem_responsiveness_mean_$year"])) {
1227 1227
             $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         return;
1238 1238
     }
1239 1239
 
1240
-    $reg = array( 'date' => '', 'data' => '<p>Nil</p>' );
1240
+    $reg = array('date' => '', 'data' => '<p>Nil</p>');
1241 1241
     if (isset($extra_info['register_member_interests_date'])) {
1242 1242
         $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
1243 1243
     }
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
             $dissolution['params']);
1273 1273
     }
1274 1274
     $mcon = array(); $mreg = array();
1275
-    for ($i=0; $i<$q->rows(); $i++) {
1275
+    for ($i = 0; $i < $q->rows(); $i++) {
1276 1276
         $house = $q->field($i, 'house');
1277 1277
         $cons = $q->field($i, 'constituency');
1278 1278
         if ($house == HOUSE_TYPE_COMMONS) {
@@ -1309,8 +1309,8 @@  discard block
 block discarded – undo
1309 1309
         }
1310 1310
     }
1311 1311
 
1312
-    foreach($mreg as $reg) {
1313
-        $data['members'][] = array (
1312
+    foreach ($mreg as $reg) {
1313
+        $data['members'][] = array(
1314 1314
             'url' => '/' . $rep_type . '/?p=' . $reg['person_id'],
1315 1315
             'name' => $reg['given_name'] . ' ' . $reg['family_name']
1316 1316
         );
Please login to merge, or discard this patch.