Passed
Pull Request — master (#1428)
by Nick
06:09
created
www/includes/easyparliament/templates/html/calendar_date.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,13 @@
 block discarded – undo
18 18
 # Content goes here
19 19
 foreach ($data['dates'] as $date => $day_events) {
20 20
     foreach ($order as $i => $chamber) {
21
-        if (!array_key_exists($chamber, $day_events))
22
-            continue;
21
+        if (!array_key_exists($chamber, $day_events)) {
22
+                    continue;
23
+        }
23 24
         $events = $day_events[$chamber];
24
-        if ($plural[$i]) $chamber .= 's';
25
+        if ($plural[$i]) {
26
+            $chamber .= 's';
27
+        }
25 28
         print "<h2 class='calendar'>$chamber";
26 29
         if (in_array($major[$i], $data['majors'])) {
27 30
             $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         print "<h2 class='calendar'>$chamber";
26 26
         if (in_array($major[$i], $data['majors'])) {
27 27
             $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']);
28
-            $URL->insert( array( 'd' => $date ) );
28
+            $URL->insert(array('d' => $date));
29 29
             print ' &nbsp; <a href="' . $URL->generate() . '">See this day &rarr;</a>';
30 30
         }
31 31
         print "</h2>\n";
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/comments_recent.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
     }
19 19
     $PAGE->block_start(array('id'=>'recentcomments', 'title'=>$title));
20 20
 
21
-    if ($this_page != 'home') $PAGE->page_links($data);
21
+    if ($this_page != 'home') {
22
+        $PAGE->page_links($data);
23
+    }
22 24
     $USERURL = new \MySociety\TheyWorkForYou\Url('userview');
23 25
     ?>
24 26
                         <ul>
@@ -50,7 +52,9 @@  discard block
 block discarded – undo
50 52
                         <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
51 53
 <?php
52 54
     }
53
-    if ($this_page != 'home') $PAGE->page_links($data);
55
+    if ($this_page != 'home') {
56
+        $PAGE->page_links($data);
57
+    }
54 58
     $PAGE->block_end();
55 59
 }
56 60
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $date = format_date($date, SHORTDATEFORMAT);
34 34
         $time = format_time($time, TIMEFORMAT);
35 35
 
36
-        $count = $n+1;
36
+        $count = $n + 1;
37 37
 
38 38
         $USERURL->insert(array('u'=>$comment['user_id']));
39 39
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     if ($this_page == 'home') {
48 48
         $MOREURL = new \MySociety\TheyWorkForYou\Url('comments_recent');
49 49
         ?>
50
-                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
50
+                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments']) + 1; ?>">See more annotations posted recently</a></p>
51 51
 <?php
52 52
     }
53 53
     if ($this_page != 'home') $PAGE->page_links($data);
Please login to merge, or discard this patch.
classes/Url.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,8 +156,9 @@
 block discarded – undo
156 156
                 foreach ($var as $v) {
157 157
                     $url_args[] = "$key=" . urlencode(stripslashes($v));
158 158
                 }
159
-            } elseif ($var != null)
160
-                $url_args[] = "$key=" . urlencode(stripslashes($var));
159
+            } elseif ($var != null) {
160
+                            $url_args[] = "$key=" . urlencode(stripslashes($var));
161
+            }
161 162
         }
162 163
 
163 164
         $page_url = WEBPATH . $DATA->page_metadata($this->destinationpage, "url");
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         // These stores an associative array of key/value pairs that
44 44
         // we'll want passed on to other pages.
45
-        $this->session_vars = array ();
45
+        $this->session_vars = array();
46 46
 
47 47
         // Prevent things using $DATA running if it hasn't been set, ie in testing
48 48
         if (isset($DATA)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function reset() {
95 95
         // Call this to remove all the session_vars.
96
-        $this->session_vars = array ();
96
+        $this->session_vars = array();
97 97
     }
98 98
 
99 99
     /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
      *                            override just one or two of them.
163 163
      */
164 164
 
165
-    public function generate($encode = "html", $overrideVars=array()) {
165
+    public function generate($encode = "html", $overrideVars = array()) {
166 166
 
167 167
         global $DATA;
168 168
 
169
-        $url_args = array ();
169
+        $url_args = array();
170 170
 
171 171
         foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) {
172 172
             if (is_array($var)) {
Please login to merge, or discard this patch.
www/docs/mp/index.php 5 patches
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.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 // Finally, if this is a Votes page, replace the page description with
228 228
 // something more descriptive of the actual data on the page.
229 229
 if ($pagetype == 'votes') {
230
-  $title = "Voting record - " . $title;
231
-  $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
230
+    $title = "Voting record - " . $title;
231
+    $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
232 232
 }
233 233
 
234 234
 // Set page metadata
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
 
403 403
         // Generate voting segments
404 404
         $data['segment'] = array(
405
-          'key'   => $policy_set,
406
-          'title' => $policiesList->getSetDescriptions()[$policy_set],
407
-          'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
408
-              $policiesList->limitToSet($policy_set), $MEMBER
409
-          )
405
+            'key'   => $policy_set,
406
+            'title' => $policiesList->getSetDescriptions()[$policy_set],
407
+            'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
408
+                $policiesList->limitToSet($policy_set), $MEMBER
409
+            )
410 410
         );
411 411
 
412 412
         MySociety\TheyWorkForYou\Renderer::output('mp/votes_svg', $data, true);
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
     if ($pid) {
119 119
         $URL = new \MySociety\TheyWorkForYou\Url('search');
120
-        $URL->insert( array('pid'=>$pid, 'pop'=>1) );
120
+        $URL->insert(array('pid'=>$pid, 'pop'=>1));
121 121
         header('Location: ' . $URL->generate('none'));
122 122
         exit;
123 123
     }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     } elseif ($THEUSER->postcode_is_set()) {
149 149
         get_mp_by_user_postcode($THEUSER->postcode());
150 150
     } else {
151
-        twfy_debug ('MP', "We don't have any way of telling what MP to display");
151
+        twfy_debug('MP', "We don't have any way of telling what MP to display");
152 152
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, but we can&rsquo;t tell which representative to display.');
153 153
     }
154 154
     if (!isset($MEMBER) || !$MEMBER->valid) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     if (!$MEMBER->current_member(HOUSE_TYPE_SCOTLAND)) {
216 216
         $title .= ', former';
217 217
     }
218
-    $title .= ' MSP, '.$MEMBER->constituency();
218
+    $title .= ' MSP, ' . $MEMBER->constituency();
219 219
 }
220 220
 
221 221
 $known_for = '';
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 $data['eu_stance'] = $MEMBER->getEUStance();
284 284
 
285 285
 # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs
286
-$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) );
286
+$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS));
287 287
 # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs
288 288
 $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)));
289 289
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 
310 310
 $data['this_page'] = $this_page;
311 311
 $data['current_assembly'] = 'westminster';
312
-if ( $this_page == 'msp' || $this_page == 'yourmsp' ) {
312
+if ($this_page == 'msp' || $this_page == 'yourmsp') {
313 313
     $data['current_assembly'] = 'scotland';
314
-} else if ( $this_page == 'mla' || $this_page == 'yourmla' ) {
314
+} else if ($this_page == 'mla' || $this_page == 'yourmla') {
315 315
     $data['current_assembly'] = 'ni';
316 316
 }
317 317
 
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
328 328
         $policySummaries = $divisions->getMemberDivisionDetails();
329 329
 
330
-        $policyOptions = array( 'summaries' => $policySummaries);
330
+        $policyOptions = array('summaries' => $policySummaries);
331 331
 
332 332
         // Generate voting segments
333 333
         $set_descriptions = $policiesList->getSetDescriptions();
334
-        if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) {
334
+        if ($policy_set && array_key_exists($policy_set, $set_descriptions)) {
335 335
             $sets = array($policy_set);
336 336
             $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set;
337 337
             $data['page_title'] = $policiesList->getSetDescriptions()[$policy_set] . ' ' . $title . ' - TheyWorkForYou';
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 
371 371
     case 'divisions':
372 372
         $policyID = get_http_var('policy');
373
-        if ( $policyID ) {
374
-            $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID );
373
+        if ($policyID) {
374
+            $policiesList = new MySociety\TheyWorkForYou\Policies($policyID);
375 375
         } else {
376 376
             $policiesList = new MySociety\TheyWorkForYou\Policies;
377 377
         }
378
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
378
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
379 379
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList);
380 380
 
381
-        if ( $policyID ) {
381
+        if ($policyID) {
382 382
             $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID);
383 383
         } else {
384 384
             $data['policydivisions'] = $divisions->getAllMemberDivisionsByPolicy();
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
         // generate party policy diffs
457 457
         $party = new MySociety\TheyWorkForYou\Party($MEMBER->party());
458
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
458
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
459 459
         $party_positions = $party->getAllPolicyPositions($policiesList);
460 460
         $policy_diffs = $MEMBER->getPartyPolicyDiffs($party, $policiesList, $positions, true);
461 461
 
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
     global $THEUSER;
510 510
     $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
511 511
     if (!validate_postcode($pc)) {
512
-        twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
513
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn&rsquo;t a valid postcode');
512
+        twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
513
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a valid postcode');
514 514
     }
515
-    twfy_debug ('MP', "MP lookup by postcode");
515
+    twfy_debug('MP', "MP lookup by postcode");
516 516
     $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
517 517
     if ($constituency == "connection_timed_out") {
518 518
         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.');
519 519
     } elseif ($constituency == "") {
520
-        twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
521
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn&rsquo;t a known postcode');
520
+        twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
521
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a known postcode');
522 522
     } else {
523 523
         // Redirect to the canonical MP page, with a person id.
524 524
         $MEMBER = new MySociety\TheyWorkForYou\Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS));
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
     }
531 531
 }
532 532
 
533
-function get_person_by_name($name, $const='') {
533
+function get_person_by_name($name, $const = '') {
534 534
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const));
535 535
     // Edge case, only attempt further detection if this isn't the Queen.
536 536
     if ($name !== 'elizabeth the second' || $const) {
537
-        twfy_debug ('MP', 'Redirecting for MP found by name/constituency');
537
+        twfy_debug('MP', 'Redirecting for MP found by name/constituency');
538 538
         member_redirect($MEMBER);
539 539
     }
540 540
     return $MEMBER;
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
  * Redirect to the canonical page for a member.
569 569
  */
570 570
 
571
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
571
+function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) {
572 572
     // We come here after creating a MEMBER object by various methods.
573 573
     // Now we redirect to the canonical MP page, with a person_id.
574 574
     if ($MEMBER->person_id()) {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         } else {
586 586
             $pagetype = '';
587 587
         }
588
-        header('Location: ' . $url . $pagetype, true, $code );
588
+        header('Location: ' . $url . $pagetype, true, $code);
589 589
         exit;
590 590
     }
591 591
 }
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 function person_error_page($message) {
615 615
     global $this_page;
616
-    switch($this_page) {
616
+    switch ($this_page) {
617 617
     case 'mla':
618 618
         $rep = 'MLA';
619 619
         $SEARCHURL = '/postcode/';
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
  * Generate the summary of this person's held positions.
652 652
  */
653 653
 
654
-function person_summary_description ($MEMBER) {
654
+function person_summary_description($MEMBER) {
655 655
     $entered_house = $MEMBER->entered_house();
656 656
     $current_member = $MEMBER->current_member();
657 657
     $left_house = $MEMBER->left_house();
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     }
663 663
     $desc = '';
664 664
     foreach ($MEMBER->houses() as $house) {
665
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
665
+        if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
666 666
             continue; # Same info is printed further down
667 667
 
668 668
         if (!$current_member[$house]) $desc .= 'Former ';
@@ -683,17 +683,17 @@  discard block
 block discarded – undo
683 683
                 $desc .= $last['from'] . ' ';
684 684
             }
685 685
         }
686
-        if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
686
+        if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) {
687 687
             $desc .= ' ';
688
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
689
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
690
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
688
+            if ($house == HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
689
+            if ($house == HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
690
+            if ($house == HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
691 691
             if ($party_br) {
692 692
                 $desc .= " ($party_br)";
693 693
             }
694 694
             $desc .= ' for ' . $left_house[$house]['constituency'];
695 695
         }
696
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
696
+        if ($house == HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
697 697
         $desc .= ', ';
698 698
     }
699 699
     $desc = preg_replace('#, $#', '', $desc);
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
  * @return string A HTML summary of this person's rebellion rate.
711 711
  */
712 712
 
713
-function person_rebellion_rate ($member) {
713
+function person_rebellion_rate($member) {
714 714
 
715 715
     // Rebellion string may be empty.
716 716
     $rebellion_string = '';
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     // benefit unfortunately.
749 749
     twfy_debug_timestamp();
750 750
 
751
-    $person_id= $member->person_id();
751
+    $person_id = $member->person_id();
752 752
 
753 753
     $memcache = new MySociety\TheyWorkForYou\Memcache;
754 754
     $recent = $memcache->get('recent_appear:' . $person_id);
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
         $SEARCHENGINE = new \SEARCHENGINE($searchstring);
760 760
 
761 761
         $hansard = new MySociety\TheyWorkForYou\Hansard();
762
-        $args = array (
762
+        $args = array(
763 763
             's' => $searchstring,
764 764
             'p' => 1,
765 765
             'num' => 3,
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
     twfy_debug_timestamp();
775 775
 
776 776
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
777
-    $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) );
777
+    $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1));
778 778
 
779 779
     $out['more_href'] = $MOREURL->generate() . '#n4';
780 780
     $out['more_text'] = 'More of ' . ucfirst($member->full_name()) . '&rsquo;s recent appearances';
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         }
986 986
     }
987 987
 
988
-    foreach ( $wtt_stats_years as $year ) {
988
+    foreach ($wtt_stats_years as $year) {
989 989
         $wtt_displayed = display_writetothem_numbers($year, $extra_info);
990 990
         if ($wtt_displayed) {
991 991
             $out[] = $wtt_displayed;
@@ -1021,15 +1021,15 @@  discard block
 block discarded – undo
1021 1021
         }
1022 1022
     }
1023 1023
 
1024
-    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1025
-        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1024
+    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts'] > 0 || $has_email_alerts)) {
1025
+        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are') . ' tracking ';
1026 1026
         if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1027 1027
         elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1028 1028
         elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1029 1029
         elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1030 1030
         elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1031 1031
         if ($has_email_alerts) {
1032
-            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1032
+            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid=' . $member->person_id() . '">email me updates on ' . $member->full_name() . '&rsquo;s activity</a>';
1033 1033
         }
1034 1034
 
1035 1035
         $out[] = $line;
@@ -1059,25 +1059,25 @@  discard block
 block discarded – undo
1059 1059
 }
1060 1060
 
1061 1061
 function display_stats_line_house($house, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff) {
1062
-    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category =='comments_on_speeches' ||
1063
-        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category =='Lcomments_on_speeches') {
1064
-        if ($extra_info[$category]==0) {
1062
+    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category == 'comments_on_speeches' ||
1063
+        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category == 'Lcomments_on_speeches') {
1064
+        if ($extra_info[$category] == 0) {
1065 1065
             $blurb = preg_replace('#<a.*?>#', '', $blurb);
1066 1066
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1067 1067
         }
1068 1068
     }
1069
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1069
+    if ($house == HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1070 1070
     $line = $blurb;
1071 1071
     $line .= '<strong>' . $extra_info[$category];
1072 1072
     if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1073 1073
     $line .= '</strong>';
1074 1074
     $line .= $inwhat;
1075
-    if ($minister===2) {
1075
+    if ($minister === 2) {
1076 1076
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1077 1077
     } elseif ($minister)
1078 1078
         $line .= ' &#8212; Ministers do not ask written questions';
1079 1079
     else {
1080
-        $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1080
+        $type = ($house == HOUSE_TYPE_COMMONS ? 'MP' : ($house == HOUSE_TYPE_LORDS ? 'Lord' : 'MLA'));
1081 1081
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1082 1082
             $line .= ' &#8212; ';
1083 1083
             $q = $extra_info[$category . '_quintile'];
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
         if ($a == 'very high') $a = 'a very high';
1123 1123
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1124 1124
 
1125
-        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);
1125
+        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);
1126 1126
     }
1127 1127
 
1128 1128
 }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 function get_all_writetothem_strings($member, $wtt_stats_years) {
1131 1131
     $extra_info = $member->extra_info();
1132 1132
     $strings = array();
1133
-    foreach ( $wtt_stats_years as $year ) {
1133
+    foreach ($wtt_stats_years as $year) {
1134 1134
 
1135 1135
         if (isset($extra_info["writetothem_responsiveness_mean_$year"])) {
1136 1136
             $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         return;
1147 1147
     }
1148 1148
 
1149
-    $reg = array( 'date' => '', 'data' => '<p>Nil</p>' );
1149
+    $reg = array('date' => '', 'data' => '<p>Nil</p>');
1150 1150
     if (isset($extra_info['register_member_interests_date'])) {
1151 1151
         $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
1152 1152
     }
@@ -1218,8 +1218,8 @@  discard block
 block discarded – undo
1218 1218
         }
1219 1219
     }
1220 1220
 
1221
-    foreach($mreg as $reg) {
1222
-        $data['members'][] = array (
1221
+    foreach ($mreg as $reg) {
1222
+        $data['members'][] = array(
1223 1223
             'url' => '/' . $rep_type . '/?p=' . $reg['person_id'],
1224 1224
             'name' => $reg['given_name'] . ' ' . $reg['family_name']
1225 1225
         );
Please login to merge, or discard this patch.
classes/SectionView/NiView.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     protected function getSearchSections() {
34 34
         return array(
35
-            array( 'section' => 'ni' )
35
+            array('section' => 'ni')
36 36
         );
37 37
     }
38 38
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
         $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none');
54 54
         $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront');
55
-        $MOREURL->insert( array( 'more' => 1 ) );
55
+        $MOREURL->insert(array('more' => 1));
56 56
 
57 57
         // this makes sure that we don't repeat this debate in the list below
58 58
         $random_debate = NULL;
59
-        if ( isset($debates['data']) && count($debates['data']) ) {
59
+        if (isset($debates['data']) && count($debates['data'])) {
60 60
             $random_debate = $debates['data'][0];
61 61
         }
62 62
 
63 63
         $recent = array();
64
-        if ( isset($debates['data']) && count($debates['data']) ) {
64
+        if (isset($debates['data']) && count($debates['data'])) {
65 65
             // at the start of a session there may be less than 6
66 66
             // debates
67 67
             $max = 6;
68
-            if ( count($debates['data']) < 6 ) {
68
+            if (count($debates['data']) < 6) {
69 69
                 $max = count($debates['data']);
70 70
             }
71
-            for ( $i = 1; $i < $max; $i++ ) {
71
+            for ($i = 1; $i < $max; $i++) {
72 72
                 $debate = $debates['data'][$i];
73 73
                 $debate['desc'] = "Northern Ireland Assembly debates";
74 74
                 $debate['more_url'] = $MOREURL->generate();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         $featured = array();
80
-        if ( $random_debate ) {
80
+        if ($random_debate) {
81 81
             $featured = $random_debate;
82 82
             $featured['more_url'] = $MOREURL->generate();
83 83
             $featured['desc'] = 'Northern Ireland Assembly debate';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         $data['featured'] = $featured;
89
-        $data['debates'] = array( 'recent' => $recent);
89
+        $data['debates'] = array('recent' => $recent);
90 90
 
91 91
         $data['regional'] = $this->getMLAList();
92 92
         $data['template'] = 'ni/index';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         $data = array();
44 44
 
45
-        $data['popular_searches'] = NULL;
45
+        $data['popular_searches'] = null;
46 46
 
47 47
 
48 48
         $data['urls'] = $this->getURLs($data);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $MOREURL->insert( array( 'more' => 1 ) );
55 55
 
56 56
         // this makes sure that we don't repeat this debate in the list below
57
-        $random_debate = NULL;
57
+        $random_debate = null;
58 58
         if ( isset($debates['data']) && count($debates['data']) ) {
59 59
             $random_debate = $debates['data'][0];
60 60
         }
Please login to merge, or discard this patch.
classes/GlossaryEditQueue.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
                             WHERE edit_id=" . $approval_id . ";");
69 69
             if (!$q->success()) {
70 70
                 break;
71
-            }
72
-            else {
71
+            } else {
73 72
                 // Scrub that one from the list of pending items
74 73
                 unset ($this->pending[$approval_id]);
75 74
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
             // the new epobject id and approval details.
62 62
             $q = $this->db->query("UPDATE editqueue
63 63
                             SET
64
-                            glossary_id='" .  $this->current_epobject_id. "',
64
+                            glossary_id='" .  $this->current_epobject_id . "',
65 65
                             editor_id='" . addslashes($THEUSER->user_id()) . "',
66 66
                             approved='1',
67 67
                             decided='" . $timestamp . "'
Please login to merge, or discard this patch.
classes/Memcache.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function set($key, $value, $timeout = 3600) {
28 28
         if (class_exists('\Memcached')) {
29
-            self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, $timeout);
29
+            self::$memcache->set(OPTION_TWFY_DB_NAME . ':' . $key, $value, $timeout);
30 30
         } else {
31
-            self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, MEMCACHE_COMPRESSED, $timeout);
31
+            self::$memcache->set(OPTION_TWFY_DB_NAME . ':' . $key, $value, MEMCACHE_COMPRESSED, $timeout);
32 32
         }
33 33
     }
34 34
 
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
         // see http://php.net/manual/en/memcache.get.php#112056 for explanation of this
37 37
         $was_found = false;
38 38
         if (class_exists('\Memcached')) {
39
-            $value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, null, $was_found);
39
+            $value = self::$memcache->get(OPTION_TWFY_DB_NAME . ':' . $key, null, $was_found);
40 40
         } else {
41
-            $value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, $was_found);
41
+            $value = self::$memcache->get(OPTION_TWFY_DB_NAME . ':' . $key, $was_found);
42 42
         }
43 43
         if ($was_found === false) {
44 44
             return false; // mmmmm
Please login to merge, or discard this patch.
classes/SectionView/DebatesView.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $DEBATELIST = new \DEBATELIST;
17 17
         $debates = array();
18 18
         $debates['data'] = $DEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
19
-        $args = array( 'months' => 1 );
19
+        $args = array('months' => 1);
20 20
         $debates['calendar'] = $DEBATELIST->display('calendar', $args, 'none');
21 21
         $debates['rssurl'] = $DATA->page_metadata($this_page, 'rss');
22 22
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         $WHALLLIST = new \WHALLLIST;
28 28
         $whall['data'] = $WHALLLIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
29
-        $args = array( 'months' => 1 );
29
+        $args = array('months' => 1);
30 30
         $whall['calendar'] = $WHALLLIST->display('calendar', $args, 'none');
31 31
         $whall['rssurl'] = $DATA->page_metadata($this_page, 'rss');
32 32
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         $LORDSDEBATELIST = new \LORDSDEBATELIST;
38 38
         $lords['data'] = $LORDSDEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
39
-        $args = array( 'months' => 1 );
39
+        $args = array('months' => 1);
40 40
         $lords['calendar'] = $LORDSDEBATELIST->display('calendar', $args, 'none');
41 41
 
42 42
         $lords['rssurl'] = $DATA->page_metadata($this_page, 'rss');
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
     protected function getSearchSections() {
57 57
         return array(
58
-            array( 'section' => 'debates', 'title' => 'House of Commons' ),
59
-            array( 'section' => 'lords', 'title' => 'House of Lords' ),
60
-            array( 'section' => 'whall', 'title' => 'Westminster Hall' )
58
+            array('section' => 'debates', 'title' => 'House of Commons'),
59
+            array('section' => 'lords', 'title' => 'House of Lords'),
60
+            array('section' => 'whall', 'title' => 'Westminster Hall')
61 61
         );
62 62
     }
63 63
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         if (!$this->first_gid) $this->first_gid = $row['gid'];
70 70
 
71 71
         $video_content = '';
72
-        if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) {
72
+        if (!$this->first_video_displayed && $row['video_status'] & 4 && !($row['video_status'] & 8)) {
73 73
             $video_content = $this->video_sidebar($row, $heading_hpos, $speeches);
74 74
             $this->first_video_displayed = true;
75 75
         }
76
-        if (!$video_content && !$this->first_speech_displayed && $row['video_status']&1 && !($row['video_status']&12)) {
76
+        if (!$video_content && !$this->first_speech_displayed && $row['video_status'] & 1 && !($row['video_status'] & 12)) {
77 77
             $video_content = $this->video_advert($row);
78 78
             $this->first_speech_displayed = true;
79 79
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if ($count > 1) {
105 105
             $out .= '<div class="debate__video" id="video_wrap"><div>';
106 106
             if ($row['gid'] != $this->first_gid) {
107
-                $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos']-$heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>';
107
+                $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos'] - $heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>';
108 108
             }
109 109
         }
110 110
         $out .= \MySociety\TheyWorkForYou\Utility\Video::object($video['id'], $start, "$gid_type/$row[gid]");
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
     private $first_gid = '';
67 67
 
68 68
     protected function get_video_html($row, $heading_hpos, $speeches) {
69
-        if (!$this->first_gid) $this->first_gid = $row['gid'];
69
+        if (!$this->first_gid) {
70
+            $this->first_gid = $row['gid'];
71
+        }
70 72
 
71 73
         $video_content = '';
72 74
         if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) {
@@ -97,7 +99,9 @@  discard block
 block discarded – undo
97 99
         $adate = $vq['adate'];
98 100
         $time = $vq['atime'];
99 101
         $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect();
100
-        if (!$videodb) return '';
102
+        if (!$videodb) {
103
+            return '';
104
+        }
101 105
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $adate, $time);
102 106
         $start = $video['offset'];
103 107
         $out = '';
Please login to merge, or discard this patch.
classes/FacebookLogin.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 
37 37
       try {
38 38
         $accessToken = $helper->getAccessToken();
39
-      } catch(\Facebook\Exceptions\FacebookResponseException $e) {
39
+      } catch (\Facebook\Exceptions\FacebookResponseException $e) {
40 40
         $data['error'] = 'Graph returned an error: ' . $e->getMessage();
41 41
         return $data;
42
-      } catch(\Facebook\Exceptions\FacebookSDKException $e) {
42
+      } catch (\Facebook\Exceptions\FacebookSDKException $e) {
43 43
         $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage();
44 44
         return $data;
45 45
       }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
           return False;
61 61
       }
62 62
 
63
-      if (! $accessToken->isLongLived()) {
63
+      if (!$accessToken->isLongLived()) {
64 64
         $oAuth2Client = $this->getFacebookObject()->getOAuth2Client();
65 65
         try {
66 66
           $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function getFacebookObject() {
15 15
         if (!isset($this->fb)) {
16
-          $this->fb = new \Facebook\Facebook([
16
+            $this->fb = new \Facebook\Facebook([
17 17
             'app_id' => FACEBOOK_APP_ID,
18 18
             'app_secret' => FACEBOOK_APP_SECRET,
19 19
             'default_graph_version' => 'v2.2',
20
-          ]);
20
+            ]);
21 21
         }
22 22
 
23 23
         return $this->fb;
@@ -30,46 +30,46 @@  discard block
 block discarded – undo
30 30
     }
31 31
 
32 32
     public function handleFacebookRedirect() {
33
-      $helper = $this->getFacebookObject()->getRedirectLoginHelper();
33
+        $helper = $this->getFacebookObject()->getRedirectLoginHelper();
34 34
 
35
-      $data = array('login_url' => $this->getLoginURL());
35
+        $data = array('login_url' => $this->getLoginURL());
36 36
 
37
-      try {
37
+        try {
38 38
         $accessToken = $helper->getAccessToken();
39
-      } catch(\Facebook\Exceptions\FacebookResponseException $e) {
39
+        } catch(\Facebook\Exceptions\FacebookResponseException $e) {
40 40
         $data['error'] = 'Graph returned an error: ' . $e->getMessage();
41 41
         return $data;
42
-      } catch(\Facebook\Exceptions\FacebookSDKException $e) {
42
+        } catch(\Facebook\Exceptions\FacebookSDKException $e) {
43 43
         $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage();
44 44
         return $data;
45
-      }
45
+        }
46 46
 
47
-      $token = $this->checkAccessToken($accessToken);
47
+        $token = $this->checkAccessToken($accessToken);
48 48
 
49
-      if ($token) {
50
-          return array('token' => $token);
51
-      } else {
52
-          $data['error'] = 'Problem getting Facebook token';
53
-          return $data;
54
-      }
49
+        if ($token) {
50
+            return array('token' => $token);
51
+        } else {
52
+            $data['error'] = 'Problem getting Facebook token';
53
+            return $data;
54
+        }
55 55
     }
56 56
 
57 57
 
58 58
     private function checkAccessToken($accessToken) {
59
-      if (!isset($accessToken)) {
60
-          return False;
61
-      }
59
+        if (!isset($accessToken)) {
60
+            return False;
61
+        }
62 62
 
63
-      if (! $accessToken->isLongLived()) {
63
+        if (! $accessToken->isLongLived()) {
64 64
         $oAuth2Client = $this->getFacebookObject()->getOAuth2Client();
65 65
         try {
66
-          $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
66
+            $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
67 67
         } catch (\Facebook\Exceptions\FacebookSDKException $e) {
68
-          return False;
68
+            return False;
69
+        }
69 70
         }
70
-      }
71 71
 
72
-      return $accessToken;
72
+        return $accessToken;
73 73
     }
74 74
 
75 75
     public function loginUser($accessToken) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             'url' => $THEUSER->url(),
157 157
             'optin' => $THEUSER->optin(),
158 158
             'password' => '',
159
-         );
159
+            );
160 160
 
161 161
         $THEUSER->update_self_no_confirm($details);
162 162
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     private function checkAccessToken($accessToken) {
59 59
       if (!isset($accessToken)) {
60
-          return False;
60
+          return false;
61 61
       }
62 62
 
63 63
       if (! $accessToken->isLongLived()) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         try {
66 66
           $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
67 67
         } catch (\Facebook\Exceptions\FacebookSDKException $e) {
68
-          return False;
68
+          return false;
69 69
         }
70 70
       }
71 71
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $expires = intval($accessToken->getExpiresAt()->format('U'));
87 87
         twfy_debug("THEUSER", "Facebook access token expires at " . $expires);
88 88
 
89
-        $success = False;
89
+        $success = false;
90 90
         if ($user_id) {
91 91
             twfy_debug("THEUSER", "Faceook user exists in the database: " . $user_id);
92 92
             $success = $THEUSER->init($user_id);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             return $logged_in;
113 113
         }
114 114
 
115
-        return False;
115
+        return false;
116 116
     }
117 117
 
118 118
     public function createUser($accessToken, $user) {
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
             'url' => '',
129 129
             'status' => '',
130 130
             'password' => '',
131
-            'optin' => False,
132
-            'mp_alert' => False,
131
+            'optin' => false,
132
+            'mp_alert' => false,
133 133
             'facebook_id' => $user['id']
134 134
         );
135 135
         $added = $THEUSER->add($details, false);
Please login to merge, or discard this patch.