Completed
Pull Request — master (#1450)
by Nick
08:21 queued 03:29
created
www/includes/utility.php 1 patch
Braces   +125 added lines, -76 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 {
@@ -755,7 +772,9 @@  discard block
 block discarded – undo
755 772
     // easily to all the emails we send out from the site.
756 773
     // eg, we might want to add a .sig to everything here...
757 774
 
758
-    if (!$from) $from = CONTACTEMAIL;
775
+    if (!$from) {
776
+        $from = CONTACTEMAIL;
777
+    }
759 778
 
760 779
     $headers =
761 780
      "From: TheyWorkForYou <$from>\r\n" .
@@ -847,17 +866,21 @@  discard block
 block discarded – undo
847 866
     $rank = $rank + 0;
848 867
 
849 868
     # 11th, 12th, 13th use "th" not "st", "nd", "rd"
850
-    if (floor(($rank % 100) / 10) == 1)
851
-        return $rank . "th";
869
+    if (floor(($rank % 100) / 10) == 1) {
870
+            return $rank . "th";
871
+    }
852 872
     # 1st
853
-    if ($rank % 10 == 1)
854
-        return $rank . "st";
873
+    if ($rank % 10 == 1) {
874
+            return $rank . "st";
875
+    }
855 876
     # 2nd
856
-    if ($rank % 10 == 2)
857
-        return $rank . "nd";
877
+    if ($rank % 10 == 2) {
878
+            return $rank . "nd";
879
+    }
858 880
     # 3rd
859
-    if ($rank % 10 == 3)
860
-        return $rank . "rd";
881
+    if ($rank % 10 == 3) {
882
+            return $rank . "rd";
883
+    }
861 884
     # Everything else use th
862 885
 
863 886
     return $rank . "th";
@@ -865,8 +888,9 @@  discard block
 block discarded – undo
865 888
 
866 889
 function make_plural($word, $number)
867 890
 {
868
-    if ($number == 1)
869
-        return $word;
891
+    if ($number == 1) {
892
+            return $word;
893
+    }
870 894
     return $word . "s";
871 895
 }
872 896
 
@@ -884,8 +908,7 @@  discard block
 block discarded – undo
884 908
 function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = NULL) {
885 909
 
886 910
     // Case for Elizabeth II
887
-    if ($house == HOUSE_TYPE_ROYAL)
888
-    {
911
+    if ($house == HOUSE_TYPE_ROYAL) {
889 912
         return 'elizabeth_the_second';
890 913
     }
891 914
 
@@ -897,8 +920,7 @@  discard block
 block discarded – undo
897 920
     $out = '';
898 921
 
899 922
     // Insert the Person ID if known.
900
-    if ($pid !== NULL)
901
-    {
923
+    if ($pid !== NULL) {
902 924
         $out .= $pid . '/';
903 925
     }
904 926
 
@@ -906,8 +928,7 @@  discard block
 block discarded – undo
906 928
     $out .= urlencode(str_replace($s2, $r, str_replace($s, $r, $name)));
907 929
 
908 930
     // If there is a constituency, inject that too
909
-    if ($const && $house == HOUSE_TYPE_COMMONS)
910
-    {
931
+    if ($const && $house == HOUSE_TYPE_COMMONS) {
911 932
         $out .= '/' . urlencode(str_replace($s2, $r, str_replace($s, $r, strtolower($const))));
912 933
     }
913 934
 
@@ -919,10 +940,16 @@  discard block
 block discarded – undo
919 940
     switch ($house) {
920 941
         case HOUSE_TYPE_LORDS:
921 942
             $s = '';
922
-            if (!$family_name) $s = 'the ';
943
+            if (!$family_name) {
944
+                $s = 'the ';
945
+            }
923 946
             $s .= $title;
924
-            if ($family_name) $s .= ' ' . $family_name;
925
-            if ($lordofname) $s .= ' of ' . $lordofname;
947
+            if ($family_name) {
948
+                $s .= ' ' . $family_name;
949
+            }
950
+            if ($lordofname) {
951
+                $s .= ' of ' . $lordofname;
952
+            }
926 953
             return $s;
927 954
 
928 955
         case HOUSE_TYPE_ROYAL:
@@ -940,14 +967,18 @@  discard block
 block discarded – undo
940 967
 }
941 968
 
942 969
 function by_peer_name($a, $b) {
943
-    if (!$a['family_name'] && !$b['family_name'])
944
-        return strcmp($a['lordofname'], $b['lordofname']);
945
-    if (!$a['family_name'])
946
-        return strcmp($a['lordofname'], $b['family_name']);
947
-    if (!$b['family_name'])
948
-        return strcmp($a['family_name'], $b['lordofname']);
949
-    if (strcmp($a['family_name'], $b['family_name']))
950
-        return strcmp($a['family_name'], $b['family_name']);
970
+    if (!$a['family_name'] && !$b['family_name']) {
971
+            return strcmp($a['lordofname'], $b['lordofname']);
972
+    }
973
+    if (!$a['family_name']) {
974
+            return strcmp($a['lordofname'], $b['family_name']);
975
+    }
976
+    if (!$b['family_name']) {
977
+            return strcmp($a['family_name'], $b['lordofname']);
978
+    }
979
+    if (strcmp($a['family_name'], $b['family_name'])) {
980
+            return strcmp($a['family_name'], $b['family_name']);
981
+    }
951 982
     return strcmp($a['lordofname'], $b['lordofname']);
952 983
 }
953 984
 
@@ -974,12 +1005,17 @@  discard block
 block discarded – undo
974 1005
         'Lords in Waiting (HM Household)' => 'Government Whip',
975 1006
         'Baronesses in Waiting, HM Household' => 'Government Whip',
976 1007
     );
977
-    if ($pos) { # Government post, or Chairman of Select Committee
1008
+    if ($pos) {
1009
+# Government post, or Chairman of Select Committee
978 1010
         $pretty = $pos;
979
-        if ($dept && $dept != 'No Department') $pretty .= ", $dept";
980
-        if (array_key_exists($pretty, $lookup))
981
-            $pretty = $lookup[$pretty];
982
-    } else { # Member of Select Committee
1011
+        if ($dept && $dept != 'No Department') {
1012
+            $pretty .= ", $dept";
1013
+        }
1014
+        if (array_key_exists($pretty, $lookup)) {
1015
+                    $pretty = $lookup[$pretty];
1016
+        }
1017
+    } else {
1018
+# Member of Select Committee
983 1019
         $pretty = "Member, $dept";
984 1020
     }
985 1021
     return $pretty;
@@ -997,13 +1033,16 @@  discard block
 block discarded – undo
997 1033
     }
998 1034
 
999 1035
     // single date?
1000
-    if (isset($data['date'])) $one_date = true;
1036
+    if (isset($data['date'])) {
1037
+        $one_date = true;
1038
+    }
1001 1039
 
1002 1040
     // remove empty entries, so they don't produce errors
1003 1041
     foreach (array_keys($hansardmajors) as $major) {
1004 1042
         if (array_key_exists($major, $data)) {
1005
-            if (count($data[$major]) == 0)
1006
-                unset($data[$major]);
1043
+            if (count($data[$major]) == 0) {
1044
+                            unset($data[$major]);
1045
+            }
1007 1046
         }
1008 1047
     }
1009 1048
 
@@ -1012,22 +1051,29 @@  discard block
 block discarded – undo
1012 1051
     if (!$one_date) {
1013 1052
         $todaystime = gmmktime(0, 0, 0, date('m'), date('d'), date('Y'));
1014 1053
         foreach ($data as $major => $array) {
1015
-            if (!in_array('timestamp', $array)) $daytext[$major] = "The most recent ";
1016
-            elseif ($todaystime - $array['timestamp'] == 86400) $daytext[$major] = "Yesterday&rsquo;s";
1017
-            elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) $daytext[$major] = gmdate('l', $array['timestamp']) . "&rsquo;s";
1018
-            else $daytext[$major] = "The most recent ";
1054
+            if (!in_array('timestamp', $array)) {
1055
+                $daytext[$major] = "The most recent ";
1056
+            } elseif ($todaystime - $array['timestamp'] == 86400) {
1057
+                $daytext[$major] = "Yesterday&rsquo;s";
1058
+            } elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) {
1059
+                $daytext[$major] = gmdate('l', $array['timestamp']) . "&rsquo;s";
1060
+            } else {
1061
+                $daytext[$major] = "The most recent ";
1062
+            }
1019 1063
         }
1020 1064
     }
1021 1065
 
1022 1066
     //build html
1023 1067
     foreach ($printed_majors as $p_major) {
1024
-        if (!array_key_exists($p_major, $data))
1025
-            continue;
1068
+        if (!array_key_exists($p_major, $data)) {
1069
+                    continue;
1070
+        }
1026 1071
 
1027
-        if ($one_date)
1028
-            $date = $data['date'];
1029
-        else
1030
-            $date = $data[$p_major]['hdate'];
1072
+        if ($one_date) {
1073
+                    $date = $data['date'];
1074
+        } else {
1075
+                    $date = $data[$p_major]['hdate'];
1076
+        }
1031 1077
         $q = $db->query('SELECT section_id, body, gid
1032 1078
                 FROM hansard, epobject
1033 1079
                 WHERE hansard.epobject_id = epobject.epobject_id '
@@ -1079,14 +1125,16 @@  discard block
 block discarded – undo
1079 1125
     }
1080 1126
 
1081 1127
     $return .= '<a href="';
1082
-    if (isset($data[$major]['listurl']))
1083
-        $return .= $data[$major]['listurl'];
1084
-    else {
1128
+    if (isset($data[$major]['listurl'])) {
1129
+            $return .= $data[$major]['listurl'];
1130
+    } else {
1085 1131
         $LISTURL->reset();
1086 1132
         $return .= $LISTURL->generate();
1087 1133
     }
1088 1134
     $return .= '">' . $hansardmajors[$major]['title'] . '</a>';
1089
-    if (isset($daytext[$major])) $return;
1135
+    if (isset($daytext[$major])) {
1136
+        $return;
1137
+    }
1090 1138
     $return .= '</h4>';
1091 1139
 
1092 1140
     return $return;
@@ -1094,20 +1142,21 @@  discard block
 block discarded – undo
1094 1142
 
1095 1143
 function score_to_strongly($dmpscore) {
1096 1144
     $dmpdesc = "unknown about";
1097
-    if ($dmpscore > 0.95 && $dmpscore <= 1.0)
1098
-        $dmpdesc = "consistently voted against";
1099
-    elseif ($dmpscore > 0.85)
1100
-        $dmpdesc = "almost always voted against";
1101
-    elseif ($dmpscore > 0.6)
1102
-        $dmpdesc = "generally voted against";
1103
-    elseif ($dmpscore > 0.4)
1104
-        $dmpdesc = "voted a mixture of for and against";
1105
-    elseif ($dmpscore > 0.15)
1106
-        $dmpdesc = "generally voted for";
1107
-    elseif ($dmpscore > 0.05)
1108
-        $dmpdesc = "almost always voted for";
1109
-    elseif ($dmpscore >= 0.0)
1110
-        $dmpdesc = "consistently voted for";
1145
+    if ($dmpscore > 0.95 && $dmpscore <= 1.0) {
1146
+            $dmpdesc = "consistently voted against";
1147
+    } elseif ($dmpscore > 0.85) {
1148
+            $dmpdesc = "almost always voted against";
1149
+    } elseif ($dmpscore > 0.6) {
1150
+            $dmpdesc = "generally voted against";
1151
+    } elseif ($dmpscore > 0.4) {
1152
+            $dmpdesc = "voted a mixture of for and against";
1153
+    } elseif ($dmpscore > 0.15) {
1154
+            $dmpdesc = "generally voted for";
1155
+    } elseif ($dmpscore > 0.05) {
1156
+            $dmpdesc = "almost always voted for";
1157
+    } elseif ($dmpscore >= 0.0) {
1158
+            $dmpdesc = "consistently voted for";
1159
+    }
1111 1160
     return $dmpdesc;
1112 1161
 }
1113 1162
 
Please login to merge, or discard this patch.
www/includes/easyparliament/member.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@
 block discarded – undo
364 364
         $this->extra_info = array();
365 365
 
366 366
         $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id',
367
-                              array(':person_id' => $this->person_id));
367
+                                array(':person_id' => $this->person_id));
368 368
         $this->extra_info['office'] = $q->fetchAll();
369 369
 
370 370
         // Info specific to member id (e.g. attendance during that period of office)
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         # All the following only happen if the house to display isn't yet set.
82 82
         # TODO: This relies on interpreting the default value of 0 as a false, which may be error-prone.
83
-        if (! (bool) $this->house_disp) {
83
+        if (!(bool) $this->house_disp) {
84 84
             if ($house == HOUSE_TYPE_LONDON_ASSEMBLY # London Assembly
85 85
                 || $house == HOUSE_TYPE_SCOTLAND     # MSPs and
86 86
                 || $house == HOUSE_TYPE_NI           # MLAs have lowest priority
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
         }
240 240
     }
241 241
 
242
-    public function postcode_to_person_id($postcode, $house=null) {
243
-        twfy_debug ('MP', "postcode_to_person_id converting postcode to person");
242
+    public function postcode_to_person_id($postcode, $house = null) {
243
+        twfy_debug('MP', "postcode_to_person_id converting postcode to person");
244 244
         $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($postcode));
245 245
         return $this->constituency_to_person_id($constituency, $house);
246 246
     }
247 247
 
248
-    public function constituency_to_person_id($constituency, $house=null) {
248
+    public function constituency_to_person_id($constituency, $house = null) {
249 249
         if ($constituency == '') {
250 250
             throw new MySociety\TheyWorkForYou\MemberException('Sorry, no constituency was found.');
251 251
         }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         }
285 285
     }
286 286
 
287
-    public function name_to_person_id($name, $const='') {
287
+    public function name_to_person_id($name, $const = '') {
288 288
         global $this_page;
289 289
         if ($name == '') {
290 290
             throw new MySociety\TheyWorkForYou\MemberException('Sorry, no name was found.');
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         global $THEUSER;
385 385
         if (is_object($THEUSER) && $THEUSER->postcode_is_set() && $this->current_member(1)) {
386 386
             $pc = $THEUSER->postcode();
387
-            twfy_debug ('MP', "set_users_mp converting postcode to person");
387
+            twfy_debug('MP', "set_users_mp converting postcode to person");
388 388
             $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
389 389
             if ($constituency == strtolower($this->constituency())) {
390 390
                 $this->the_users_mp = true;
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 
459 459
         if (isset($this->extra_info['public_whip_attendrank'])) {
460 460
             $prefix = ($this->house(HOUSE_TYPE_LORDS) ? 'L' : '');
461
-            $this->extra_info[$prefix.'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank'];
462
-            $this->extra_info[$prefix.'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof'];
463
-            $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);
461
+            $this->extra_info[$prefix . 'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank'];
462
+            $this->extra_info[$prefix . 'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof'];
463
+            $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);
464 464
         }
465 465
         if ($this->house(HOUSE_TYPE_LORDS) && isset($this->extra_info['public_whip_division_attendance'])) {
466 466
             $this->extra_info['Lpublic_whip_division_attendance'] = $this->extra_info['public_whip_division_attendance'];
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
         }
469 469
 
470 470
         if ($display && array_key_exists('register_member_interests_html', $this->extra_info) && ($this->extra_info['register_member_interests_html'] != '')) {
471
-            $args = array (
471
+            $args = array(
472 472
                 "sort" => "regexp_replace"
473 473
             );
474 474
             $GLOSSARY = new GLOSSARY($args);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         $GLOSSARY->glossarise($this->extra_info['register_member_interests_html']);
477 477
         }
478 478
 
479
-        $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:'.$this->person_id.'%" and confirmed and not deleted')->first();
479
+        $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:' . $this->person_id . '%" and confirmed and not deleted')->first();
480 480
         $this->extra_info['number_of_alerts'] = $q['c'];
481 481
 
482 482
         if (isset($this->extra_info['reading_ease'])) {
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
         $this->extra_info['pbc'] = array();
501 501
         foreach ($q as $row) {
502 502
             $bill_id = $row['bill_id'];
503
-            $c = $this->db->query('select count(*) as c from hansard where major=6 and minor='.$bill_id.' and htype=10')->first();
503
+            $c = $this->db->query('select count(*) as c from hansard where major=6 and minor=' . $bill_id . ' and htype=10')->first();
504 504
             $c = $c['c'];
505 505
             $title = $row['title'];
506 506
             $attending = $row['a'];
507 507
             $chairman = $row['c'];
508 508
             $this->extra_info['pbc'][$bill_id] = array(
509 509
                 'title' => $title, 'session' => $row['session'],
510
-                'attending'=>$attending, 'chairman'=>($chairman>0), 'outof' => $c
510
+                'attending'=>$attending, 'chairman'=>($chairman > 0), 'outof' => $c
511 511
             );
512 512
         }
513 513
 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
     public function family_name() { return $this->family_name; }
523 523
     public function full_name($no_mp_title = false) {
524 524
         $title = $this->title;
525
-        if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND))
525
+        if ($no_mp_title && ($this->house_disp == HOUSE_TYPE_COMMONS || $this->house_disp == HOUSE_TYPE_NI || $this->house_disp == HOUSE_TYPE_SCOTLAND))
526 526
             $title = '';
527 527
         return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname);
528 528
     }
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
     }
550 550
 
551 551
     public function entered_house($house = null) {
552
-        if ( isset($house) ) {
553
-            if ( array_key_exists($house, $this->entered_house) ) {
552
+        if (isset($house)) {
553
+            if (array_key_exists($house, $this->entered_house)) {
554 554
                 return $this->entered_house[$house];
555 555
             } else {
556 556
                 return null;
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
     public function entered_house_text($entered_house) {
563 563
         if (!$entered_house) return '';
564 564
         list($year, $month, $day) = explode('-', $entered_house);
565
-        if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) {
565
+        if ($month == 1 && $day == 1 && $this->house(HOUSE_TYPE_LORDS)) {
566 566
             return $year;
567
-        } elseif ($month==0 && $day==0) {
567
+        } elseif ($month == 0 && $day == 0) {
568 568
             return $year;
569 569
         } elseif (checkdate($month, $day, $year) && $year != '9999') {
570 570
             return format_date($entered_house, LONGDATEFORMAT);
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
     }
575 575
 
576 576
     public function left_house($house = null) {
577
-        if ( isset($house) ) {
578
-            if ( array_key_exists($house, $this->left_house) ) {
577
+        if (isset($house)) {
578
+            if (array_key_exists($house, $this->left_house)) {
579 579
                 return $this->left_house[$house];
580 580
             } else {
581 581
                 return null;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         list($year, $month, $day) = explode('-', $left_house);
590 590
         if (checkdate($month, $day, $year) && $year != '9999') {
591 591
             return format_date($left_house, LONGDATEFORMAT);
592
-        } elseif ($month==0 && $day==0) {
592
+        } elseif ($month == 0 && $day == 0) {
593 593
             # Left house date is stored as 1942-00-00 to mean "at some point in 1941"
594 594
             return $year - 1;
595 595
         } else {
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
             $name = $row['given_name'] . ' ' . $row['family_name'];
708 708
             if ($last_pid != $pid) {
709 709
                 $mships[] = array(
710
-                    'href' => WEBPATH . 'mp/?pid='.$pid,
710
+                    'href' => WEBPATH . 'mp/?pid=' . $pid,
711 711
                     'text' => $name
712 712
                 );
713 713
                 $last_pid = $pid;
Please login to merge, or discard this patch.
tests/HousesTest.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * Test that the Royal edge-case house is correctly defined.
11 11
      */
12
-	public function testRoyalHouseDefined()
12
+    public function testRoyalHouseDefined()
13 13
     {
14 14
         $this->assertEquals(0, HOUSE_TYPE_ROYAL);
15 15
     }
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * Test that the House of Commons is correctly defined.
19 19
      */
20
-	public function testCommonsHouseDefined()
20
+    public function testCommonsHouseDefined()
21 21
     {
22 22
         $this->assertEquals(1, HOUSE_TYPE_COMMONS);
23 23
     }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * Test that the House of Lords is correctly defined.
27 27
      */
28
-	public function testLordsHouseDefined()
28
+    public function testLordsHouseDefined()
29 29
     {
30 30
         $this->assertEquals(2, HOUSE_TYPE_LORDS);
31 31
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * Test that the Northern Ireland Assembly is correctly defined.
35 35
      */
36
-	public function testNIHouseDefined()
36
+    public function testNIHouseDefined()
37 37
     {
38 38
         $this->assertEquals(3, HOUSE_TYPE_NI);
39 39
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * Test that the Scottish Parliament is correctly defined.
43 43
      */
44
-	public function testScotlandHouseDefined()
44
+    public function testScotlandHouseDefined()
45 45
     {
46 46
         $this->assertEquals(4, HOUSE_TYPE_SCOTLAND);
47 47
     }
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * Test that the Assembly for Wales is correctly defined.
51 51
      */
52
-	public function testWalesHouseDefined()
52
+    public function testWalesHouseDefined()
53 53
     {
54 54
         $this->assertEquals(5, HOUSE_TYPE_WALES);
55 55
     }
56 56
 
57
-	/**
57
+    /**
58 58
      * Test that the London Assembly is correctly defined.
59 59
      */
60
-	public function testLondonAssemblyHouseDefined()
60
+    public function testLondonAssemblyHouseDefined()
61 61
     {
62 62
         $this->assertEquals(6, HOUSE_TYPE_LONDON_ASSEMBLY);
63 63
     }
Please login to merge, or discard this patch.
classes/Utility/House.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@
 block discarded – undo
24 24
     public static function house_to_members($house) {
25 25
         $house_to_members = array(
26 26
             HOUSE_TYPE_COMMONS => array(
27
-              'singular' => 'MP',
28
-              'plural'   => 'MPs'
27
+                'singular' => 'MP',
28
+                'plural'   => 'MPs'
29 29
             ),
30 30
             HOUSE_TYPE_LORDS => array(
31
-              'singular' => 'Member of the House of Lords',
32
-              'plural'   => 'Members of the House of Lords'
31
+                'singular' => 'Member of the House of Lords',
32
+                'plural'   => 'Members of the House of Lords'
33 33
             ),
34 34
             HOUSE_TYPE_NI => array(
35
-              'singular' => 'MLA',
36
-              'plural'   => 'MLAs'
35
+                'singular' => 'MLA',
36
+                'plural'   => 'MLAs'
37 37
             ),
38 38
             HOUSE_TYPE_SCOTLAND => array(
39
-              'singular' => 'MSP',
40
-              'plural'   => 'MSPs'
41
-          ),
39
+                'singular' => 'MSP',
40
+                'plural'   => 'MSPs'
41
+            ),
42 42
             HOUSE_TYPE_LONDON_ASSEMBLY => array(
43
-              'singular' => 'Member of the London Assembly',
44
-              'plural'   => 'Members of the London Assembly'
43
+                'singular' => 'Member of the London Assembly',
44
+                'plural'   => 'Members of the London Assembly'
45 45
             )
46 46
         );
47 47
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,35 +50,35 @@
 block discarded – undo
50 50
 
51 51
     public static function getCountryDetails($house) {
52 52
         $details = array(
53
-            HOUSE_TYPE_COMMONS => array (
53
+            HOUSE_TYPE_COMMONS => array(
54 54
                 'country' => 'UK',
55 55
                 'assembly' => 'uk-commons',
56 56
                 'location' => '&ndash; in the House of Commons',
57 57
                 'cons_type' => 'WMC',
58 58
                 'assembly_name' => 'House of Commons',
59 59
             ),
60
-            HOUSE_TYPE_NI => array (
60
+            HOUSE_TYPE_NI => array(
61 61
                 'country' => 'NORTHERN IRELAND',
62 62
                 'assembly' => 'ni',
63 63
                 'location' => '&ndash; in the Northern Ireland Assembly',
64 64
                 'cons_type' => 'NIE',
65 65
                 'assembly_name' => 'Northern Ireland Assembly',
66 66
             ),
67
-            HOUSE_TYPE_SCOTLAND => array (
67
+            HOUSE_TYPE_SCOTLAND => array(
68 68
                 'country' => 'SCOTLAND',
69 69
                 'assembly' => 'scotland',
70 70
                 'location' => '&ndash; in the Scottish Parliament',
71 71
                 'cons_type' => 'SPC',
72 72
                 'assembly_name' => 'Scottish Parliament',
73 73
             ),
74
-            HOUSE_TYPE_LORDS => array (
74
+            HOUSE_TYPE_LORDS => array(
75 75
                 'country' => 'UK',
76 76
                 'assembly' => 'uk-lords',
77 77
                 'location' => '&ndash; in the House of Lords',
78 78
                 'cons_type' => '',
79 79
                 'assembly_name' => 'House of Lords',
80 80
             ),
81
-            HOUSE_TYPE_LORDS => array (
81
+            HOUSE_TYPE_LORDS => array(
82 82
                 'country' => 'UK',
83 83
                 'assembly' => 'london-assembly',
84 84
                 'location' => '&ndash; in the London Assembly',
Please login to merge, or discard this patch.
www/includes/easyparliament/metadata.php 1 patch
Spacing   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 
66 66
 */
67 67
 
68
-$this->page = array (
68
+$this->page = array(
69 69
 
70 70
 // Things used on EVERY page, unless overridden for a page:
71
-    'default' => array (
71
+    'default' => array(
72 72
         'parent'	=> '',
73 73
         'session_vars' => array('super_debug'),
74 74
         'sitetitle'		=> 'TheyWorkForYou',
@@ -78,122 +78,122 @@  discard block
 block discarded – undo
78 78
 
79 79
 // KEEP THE PAGES IN ALPHABETICAL ORDER! TA.
80 80
 
81
-    'about' => array (
81
+    'about' => array(
82 82
         'title'			=> 'About us',
83 83
         'url'			=> 'about/'
84 84
     ),
85
-    'parliaments' => array (
85
+    'parliaments' => array(
86 86
         'title' 	=> 'Parliaments and assemblies',
87 87
         'url'       => 'parliaments/'
88 88
     ),
89 89
 
90
-    'alert_stats' => array (
90
+    'alert_stats' => array(
91 91
         'title'			=> 'Email alerts statistics',
92 92
         'parent'		=> 'admin',
93 93
         'url'			=> 'admin/alert_stats.php',
94 94
     ),
95
-    'admin_badusers' => array (
95
+    'admin_badusers' => array(
96 96
         'title'			=> 'Bad users',
97 97
         'parent'		=> 'admin',
98 98
         'url'			=> 'admin/badusers.php'
99 99
     ),
100
-    'admin_home' => array (
100
+    'admin_home' => array(
101 101
         'title'			=> 'Home',
102 102
         'parent'		=> 'admin',
103 103
         'url'			=> 'admin/'
104 104
     ),
105
-    'admin_comments' => array (
105
+    'admin_comments' => array(
106 106
         'title'			=> 'Recent comments',
107 107
         'parent'		=> 'admin',
108 108
         'url'			=> 'admin/comments.php'
109 109
     ),
110
-    'admin_commentreport' => array (
110
+    'admin_commentreport' => array(
111 111
         'title'			=> 'Processing a comment report',
112 112
         'parent'		=> 'admin',
113 113
         'url'			=> 'admin/report.php',
114
-        'session_vars'	=> array ('rid', 'cid')
114
+        'session_vars'	=> array('rid', 'cid')
115 115
     ),
116
-    'admin_commentreports' => array (
116
+    'admin_commentreports' => array(
117 117
         'title'			=> 'Outstanding comment reports',
118 118
         'parent'		=> 'admin',
119 119
         'url'			=> 'admin/reports.php'
120 120
     ),
121
-    'admin_failedsearches' => array (
121
+    'admin_failedsearches' => array(
122 122
         'title'			=> 'Failed searches',
123 123
         'parent'		=> 'admin',
124 124
         'url'			=> 'admin/failedsearches.php'
125 125
     ),
126
-    'admin_glossary' => array (
126
+    'admin_glossary' => array(
127 127
         'title'			=> 'Manage glossary entries',
128 128
         'parent'		=> 'admin',
129 129
         'url'			=> 'admin/glossary.php'
130 130
     ),
131
-    'admin_glossary_pending' => array (
131
+    'admin_glossary_pending' => array(
132 132
         'title'			=> 'Review pending glossary entries',
133 133
         'parent'		=> 'admin',
134 134
         'url'			=> 'admin/glossary_pending.php'
135 135
     ),
136
-    'admin_searchlogs' => array (
136
+    'admin_searchlogs' => array(
137 137
         'title'			=> 'Recent searches',
138 138
         'parent'		=> 'admin',
139 139
         'url'			=> 'admin/searchlogs.php'
140 140
     ),
141
-    'admin_popularsearches' => array (
141
+    'admin_popularsearches' => array(
142 142
         'title'			=> 'Popular searches in last 30 days (first 1000)',
143 143
         'parent'		=> 'admin',
144 144
         'url'			=> 'admin/popularsearches.php'
145 145
     ),
146
-    'admin_statistics' => array (
146
+    'admin_statistics' => array(
147 147
         'title'			=> 'General statistics',
148 148
         'parent'		=> 'admin',
149 149
         'url'			=> 'admin/statistics.php'
150 150
     ),
151
-    'admin_reportstats' => array (
151
+    'admin_reportstats' => array(
152 152
         'title'			=> 'Reporting statistics',
153 153
         'parent'		=> 'admin',
154 154
         'url'			=> 'admin/reporting_stats.php'
155 155
     ),
156
-    'admin_photos' => array (
156
+    'admin_photos' => array(
157 157
         'title'			=> 'Photo upload/attribution',
158 158
         'parent'		=> 'admin',
159 159
         'url'			=> 'admin/photos.php',
160 160
     ),
161
-    'admin_profile_message' => array (
161
+    'admin_profile_message' => array(
162 162
         'title'			=> 'Profile message banner',
163 163
         'parent'		=> 'admin',
164 164
         'url'			=> 'admin/profile-message.php',
165 165
     ),
166
-    'admin_mpurls' => array (
166
+    'admin_mpurls' => array(
167 167
         'title'			=> 'MP Websites',
168 168
         'parent'		=> 'admin',
169 169
         'url'			=> 'admin/websites.php',
170 170
     ),
171
-    'admin_policies' => array (
171
+    'admin_policies' => array(
172 172
         'title'			=> 'MP Policy details',
173 173
         'parent'		=> 'admin',
174 174
         'url'			=> 'admin/policies.php',
175 175
     ),
176
-    'admin_banner' => array (
176
+    'admin_banner' => array(
177 177
         'title'			=> 'Edit Banner',
178 178
         'parent'		=> 'admin',
179 179
         'url'			=> 'admin/banner.php',
180 180
     ),
181
-    'admin_featured' => array (
181
+    'admin_featured' => array(
182 182
         'title'			=> 'Featured debates',
183 183
         'parent'		=> 'admin',
184 184
         'url'			=> 'admin/featured.php',
185 185
     ),
186
-    'admin_topics' => array (
186
+    'admin_topics' => array(
187 187
         'title'			=> 'Topics',
188 188
         'parent'		=> 'admin',
189 189
         'url'			=> 'admin/topics.php',
190 190
     ),
191
-    'admin_edittopics' => array (
191
+    'admin_edittopics' => array(
192 192
         'title'			=> 'Edit Topic',
193 193
         'parent'		=> 'admin_topics',
194 194
         'url'			=> 'admin/edittopic.php',
195 195
     ),
196
-    'admin_wikipedia' => array (
196
+    'admin_wikipedia' => array(
197 197
         'title' => 'Wikipedia links',
198 198
         'parent' => 'admin',
199 199
         'url' => 'admin/wikipedia.php',
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 
202 202
 // Added by Richard Allan for email alert functions
203 203
 
204
-    'alert' => array (
205
-        'menu'			=> array (
204
+    'alert' => array(
205
+        'menu'			=> array(
206 206
             'text'			=> 'Email Alerts',
207 207
             'title'			=> "Set up alerts for updates on an MP or Peer by email",
208 208
             'sidebar'		=> 'alert'
@@ -211,30 +211,30 @@  discard block
 block discarded – undo
211 211
         'title'			=> 'TheyWorkForYou Email Alerts',
212 212
         'url'			=> 'alert/',
213 213
     ),
214
-    'alertwelcome' => array (
214
+    'alertwelcome' => array(
215 215
         'title'			=> 'Email Alerts',
216 216
         'url'			=> 'alert/',
217 217
     ),
218 218
 
219 219
 // End of ALERTS additions
220 220
 
221
-    'api_front'		=> array (
222
-        'menu'			=> array (
221
+    'api_front'		=> array(
222
+        'menu'			=> array(
223 223
             'text'			=> 'API',
224 224
             'title'			=> 'Access our data'
225 225
         ),
226 226
         'title'			=> 'TheyWorkForYou API',
227 227
         'url'			=> 'api/'
228 228
     ),
229
-    'api_doc_front'		=> array (
230
-        'menu'			=> array (
229
+    'api_doc_front'		=> array(
230
+        'menu'			=> array(
231 231
             'text'			=> 'API',
232 232
             'title'			=> 'Access our data'
233 233
         ),
234 234
         'parent'		=> 'api_front',
235 235
         'url'			=> 'api/'
236 236
     ),
237
-    'api_key'		=> array (
237
+    'api_key'		=> array(
238 238
         'title'			=> 'Plan and keys',
239 239
         'parent'		=> 'api_front',
240 240
         'url'			=> 'api/key'
@@ -245,69 +245,69 @@  discard block
 block discarded – undo
245 245
         'url' => 'boundaries/',
246 246
     ),
247 247
 
248
-    'calendar_summary' => array (
249
-        'menu'			=> array (
248
+    'calendar_summary' => array(
249
+        'menu'			=> array(
250 250
             'text'			=> 'Upcoming',
251 251
             'title'			=> '',
252 252
         ),
253 253
         'parent'		=> 'hansard',
254 254
         'url'			=> 'calendar/'
255 255
     ),
256
-    'calendar_future_head' => array (
256
+    'calendar_future_head' => array(
257 257
         'parent'		=> 'calendar_summary',
258 258
         'title'			=> 'Upcoming business',
259 259
         'url'			=> 'calendar/'
260 260
     ),
261
-    'calendar_future' => array (
261
+    'calendar_future' => array(
262 262
         'parent'		=> 'calendar_future_head',
263 263
         'url'			=> 'calendar/'
264 264
     ),
265
-    'calendar_today_head' => array (
265
+    'calendar_today_head' => array(
266 266
         'parent'		=> 'calendar_summary',
267 267
         'title'			=> 'Today&rsquo;s business',
268 268
         'url'			=> 'calendar/'
269 269
     ),
270
-    'calendar_today' => array (
270
+    'calendar_today' => array(
271 271
         'parent'		=> 'calendar_today_head',
272 272
         'url'			=> 'calendar/'
273 273
     ),
274
-    'calendar_past_head' => array (
274
+    'calendar_past_head' => array(
275 275
         'parent'		=> 'calendar_summary',
276 276
         'title'			=> 'Previous business',
277 277
         'url'			=> 'calendar/'
278 278
     ),
279
-    'calendar_past' => array (
279
+    'calendar_past' => array(
280 280
         'parent'		=> 'calendar_past_head',
281 281
         'url'			=> 'calendar/'
282 282
     ),
283 283
 
284
-    'cards' => array (
284
+    'cards' => array(
285 285
         'title'			=> 'MP Stats Cards',
286 286
         'url'			=> 'cards/'
287 287
     ),
288 288
 
289
-    'campaign_foi' => array (
289
+    'campaign_foi' => array(
290 290
         'title'			=> 'Freedom of Information (Parliament) Order 2009',
291 291
         'url'			=> 'foiorder2009/'
292 292
     ),
293
-    'campaign' => array (
293
+    'campaign' => array(
294 294
         'title'			=> '', #Free Our Bills!',
295 295
         'url'			=> 'freeourbills/'
296 296
     ),
297
-    'campaign_edm' => array (
297
+    'campaign_edm' => array(
298 298
         'title'			=> 'Early Day Motion',
299 299
         'parent'		=> 'campaign',
300 300
         'url'			=> 'freeourbills/'
301 301
     ),
302 302
 
303
-    'commentreport' => array (
303
+    'commentreport' => array(
304 304
         'title'			=> 'Reporting a comment',
305 305
         'url'			=> 'report/',
306
-        'session_vars'	=> array ('id')
306
+        'session_vars'	=> array('id')
307 307
     ),
308 308
 
309
-    'comments_recent' => array (
310
-        'menu'			=> array (
309
+    'comments_recent' => array(
310
+        'menu'			=> array(
311 311
             'text'			=> 'Recent comments',
312 312
             'title'			=> "Recently posted comments"
313 313
         ),
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
         'url'			=> 'comments/recent/'
317 317
     ),
318 318
 
319
-    'contact' => array (
320
-        'menu'			=> array (
319
+    'contact' => array(
320
+        'menu'			=> array(
321 321
             'text'			=> 'Contact',
322 322
             'title'			=> '',
323 323
         ),
@@ -328,23 +328,23 @@  discard block
 block discarded – undo
328 328
         'title' => 'News',
329 329
         'url' => 'https://www.mysociety.org/category/projects/theyworkforyou/'
330 330
     ),
331
-    'debate'  => array (
331
+    'debate'  => array(
332 332
         'parent'		=> 'debatesfront',
333 333
         'url'			=> 'debates/',
334
-        'session_vars'	=> array ('id'),
334
+        'session_vars'	=> array('id'),
335 335
     ),
336
-    'debates'  => array (
336
+    'debates'  => array(
337 337
         'parent'		=> 'debatesfront',
338 338
         'url'			=> 'debates/',
339
-        'session_vars'	=> array ('id'),
339
+        'session_vars'	=> array('id'),
340 340
     ),
341
-    'debatesday' => array (
341
+    'debatesday' => array(
342 342
         'parent'		=> 'debatesfront',
343
-        'session_vars'	=> array ('d'),
343
+        'session_vars'	=> array('d'),
344 344
         'url'			=> 'debates/',
345 345
     ),
346
-    'alldebatesfront' => array (
347
-        'menu'			=> array (
346
+    'alldebatesfront' => array(
347
+        'menu'			=> array(
348 348
             'text'			=> 'Debates',
349 349
             'title'			=> "Debates in the House of Commons, Westminster Hall, and the House of Lords"
350 350
         ),
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
         'rss'			=> 'rss/debates.rss',
354 354
         'url'			=> 'debates/'
355 355
     ),
356
-    'debatesfront' => array (
357
-        'menu'			=> array (
356
+    'debatesfront' => array(
357
+        'menu'			=> array(
358 358
             'text'			=> 'Commons debates',
359 359
             'title'			=> "Debates in the House of Commons"
360 360
         ),
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
         'rss'			=> 'rss/debates.rss',
364 364
         'url'			=> 'debates/'
365 365
     ),
366
-    'debatesyear' => array (
366
+    'debatesyear' => array(
367 367
         'parent'		=> 'debatesfront',
368 368
         'url'			=> 'debates/'
369 369
     ),
370
-    'divisions_recent' => array (
371
-        'menu'			=> array (
370
+    'divisions_recent' => array(
371
+        'menu'			=> array(
372 372
             'text'			=> 'Recent Votes',
373 373
             'title'			=> ''
374 374
         ),
@@ -376,13 +376,13 @@  discard block
 block discarded – undo
376 376
         'title'			=> 'Recent Votes',
377 377
         'url'			=> 'divisions/'
378 378
     ),
379
-    'divisions_vote' => array (
379
+    'divisions_vote' => array(
380 380
         'parent'		=> 'divisions_recent',
381 381
         'title'			=> 'Vote',
382 382
         'url'			=> 'divisions/division.php',
383 383
         'session_vars'	=> array('vote'),
384 384
     ),
385
-    'epvote' => array (
385
+    'epvote' => array(
386 386
         'url'			=> 'vote/'
387 387
     ),
388 388
 
@@ -391,19 +391,19 @@  discard block
 block discarded – undo
391 391
         'title'			=> 'TheyWorkForYou Google gadget',
392 392
     ),
393 393
 
394
-    'glossary' => array (
394
+    'glossary' => array(
395 395
         'heading'		=> 'Glossary',
396 396
         'parent'		=> 'help_us_out',
397 397
         'url'			=> 'glossary/'
398 398
     ),
399
-    'glossary_item' => array (
399
+    'glossary_item' => array(
400 400
         'heading'		=> 'Glossary heading',
401 401
         'parent'		=> 'help_us_out',
402 402
         'url'			=> 'glossary/',
403
-        'session_vars'	=> array ('g')
403
+        'session_vars'	=> array('g')
404 404
     ),
405
-    'hansard' => array (
406
-        'menu'			=> array (
405
+    'hansard' => array(
406
+        'menu'			=> array(
407 407
             'text'			=> 'UK Parliament',
408 408
             'title'			=> "Houses of Parliament debates, Written Answers, Statements, Westminster Hall debates, and Bill Committees"
409 409
         ),
@@ -411,16 +411,16 @@  discard block
 block discarded – undo
411 411
         'url'			=> ''
412 412
     ),
413 413
         // Hansard landing page
414
-        'hansard_landing' => array (
414
+        'hansard_landing' => array(
415 415
                 'title'                 => 'Hansard',
416 416
                 'url'                   => 'search-hansard/',
417 417
         ),
418
-    'help' => array (
418
+    'help' => array(
419 419
         'title'			=> 'Help - Frequently Asked Questions',
420 420
         'url'			=> 'help/'
421 421
     ),
422
-    'help_us_out' => array (
423
-        'menu'			=> array (
422
+    'help_us_out' => array(
423
+        'menu'			=> array(
424 424
             'text'			=> 'Glossary',
425 425
             'title'			=> "Parliament's jargon explained"
426 426
         ),
@@ -429,88 +429,88 @@  discard block
 block discarded – undo
429 429
         'url'			=> 'addterm/',
430 430
         'sidebar'		=> 'glossary_add'
431 431
     ),
432
-    'home' => array (
432
+    'home' => array(
433 433
         'title'			=> "UK Parliament",
434 434
         'rss'			=> 'news/index.rdf',
435 435
         'url'			=> ''
436 436
     ),
437
-    'houserules' => array (
437
+    'houserules' => array(
438 438
         'title'			=> 'House rules',
439 439
         'url'			=> 'houserules/'
440 440
     ),
441 441
 
442
-    'linktous' => array (
442
+    'linktous' => array(
443 443
         'title'			=> 'Link to us',
444 444
         'heading'		=> 'How to link to us',
445 445
         'url'			=> 'help/linktous/'
446 446
     ),
447
-    'api' => array (
447
+    'api' => array(
448 448
         'title'			=> 'API',
449 449
         'heading'		=> 'API - Query the TheyWorkForYou database',
450 450
         'url'			=> 'api/'
451 451
     ),
452
-    'data' => array (
452
+    'data' => array(
453 453
         'title'			=> 'Raw Data',
454 454
         'heading'		=> 'Raw data (XML) - the data behind TheyWorkForYou and Public Whip',
455 455
         'url'			=> 'http://parser.theyworkforyou.com'
456 456
     ),
457
-    'pombola' => array (
457
+    'pombola' => array(
458 458
         'title'			=> 'Pombola',
459 459
         'heading'		=> 'mySociety\'s platform for running a Parliamentary monitoring site like this',
460 460
         'url'			=> 'https://www.mysociety.org/projects/parliamentarymonitoring/pombola'
461 461
     ),
462
-    'devmailinglist' => array (
462
+    'devmailinglist' => array(
463 463
         'title'			=> 'Developer mailing list',
464 464
         'heading'		=> 'Developer mailing list',
465 465
         'url'			=> 'https://groups.google.com/a/mysociety.org/forum/#!forum/theyworkforyou'
466 466
     ),
467
-    'code' => array (
467
+    'code' => array(
468 468
         'title'			=> 'Source code',
469 469
         'heading'		=> 'TheyWorkForYou Source code',
470 470
         'url'			=> 'https://github.com/mysociety/theyworkforyou'
471 471
     ),
472
-    'irc' => array (
472
+    'irc' => array(
473 473
         'title'			=> 'IRC chat channel',
474 474
         'heading'		=> 'IRC chat channel',
475 475
         'url'			=> 'http://www.irc.mysociety.org/'
476 476
     ),
477
-    'newzealand' => array (
477
+    'newzealand' => array(
478 478
         'title'			=> 'New Zealand',
479 479
         'heading'		=> 'They Work For You - New Zealand',
480 480
         'url'			=> 'http://www.theyworkforyou.co.nz/'
481 481
     ),
482
-    'australia' => array (
482
+    'australia' => array(
483 483
         'title'			=> 'Australia',
484 484
         'heading'		=> 'Open Australia',
485 485
         'url'			=> 'http://www.openaustralia.org/'
486 486
     ),
487
-    'ireland' => array (
487
+    'ireland' => array(
488 488
         'title'			=> 'Ireland',
489 489
         'heading'		=> 'TheyWorkForYou for the Houses of the Oireachtas',
490 490
         'url'			=> 'http://www.kildarestreet.com/'
491 491
     ),
492
-    'mzalendo' => array (
492
+    'mzalendo' => array(
493 493
         'title'			=> 'Mzalendo',
494 494
         'heading'		=> 'Keeping an eye on the Kenyan Parliament',
495 495
         'url'			=> 'http://info.mzalendo.com/'
496 496
     ),
497
-    'lordsdebate'  => array (
497
+    'lordsdebate'  => array(
498 498
         'parent'		=> 'lordsdebatesfront',
499 499
         'url'			=> 'lords/',
500
-        'session_vars'	=> array ('id'),
500
+        'session_vars'	=> array('id'),
501 501
     ),
502
-    'lordsdebates'  => array (
502
+    'lordsdebates'  => array(
503 503
         'parent'		=> 'lordsdebatesfront',
504 504
         'url'			=> 'lords/',
505
-        'session_vars'	=> array ('id'),
505
+        'session_vars'	=> array('id'),
506 506
     ),
507
-    'lordsdebatesday' => array (
507
+    'lordsdebatesday' => array(
508 508
         'parent'		=> 'lordsdebatesfront',
509
-        'session_vars'	=> array ('d'),
509
+        'session_vars'	=> array('d'),
510 510
         'url'			=> 'lords/',
511 511
     ),
512
-    'lordsdebatesfront' => array (
513
-        'menu'			=> array (
512
+    'lordsdebatesfront' => array(
513
+        'menu'			=> array(
514 514
             'text'			=> 'Lords debates',
515 515
             'title'			=> "House of Lords debates"
516 516
         ),
@@ -519,24 +519,24 @@  discard block
 block discarded – undo
519 519
         'rss'			=> 'rss/lords.rss',
520 520
         'url'			=> 'lords/'
521 521
     ),
522
-    'lordsdebatesyear' => array (
522
+    'lordsdebatesyear' => array(
523 523
         'parent'		=> 'lordsdebatesfront',
524 524
         'url'			=> 'lords/'
525 525
     ),
526 526
 
527 527
         // Parliament landing page
528
-        'parliament_landing' => array (
528
+        'parliament_landing' => array(
529 529
                 'title'                 => 'Parliament',
530 530
                 'url'                   => 'parliament/',
531 531
         ),
532 532
 
533
-    'peer' => array (
533
+    'peer' => array(
534 534
         'parent'		=> 'peers',
535 535
         'title'			=> 'Peer',
536 536
         'url'			=> 'peer/'
537 537
     ),
538
-    'peers' => array (
539
-         'menu'			=> array (
538
+    'peers' => array(
539
+         'menu'			=> array(
540 540
             'text'			=> 'Lords',
541 541
             'title'			=> "List of all Lords"
542 542
         ),
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
         'title'			=> '',
545 545
         'url'			=> 'peers/'
546 546
     ),
547
-'overview' => array (
548
-     'menu'			=> array (
547
+'overview' => array(
548
+     'menu'			=> array(
549 549
         'text'			=> 'Overview',
550 550
         'title'			=> "Overview of the UK Parliament"
551 551
     ),
@@ -554,50 +554,50 @@  discard block
 block discarded – undo
554 554
     'rss'			=> 'news/index.rdf',
555 555
     'url'			=> ''
556 556
 ),
557
-    'mla' => array (
557
+    'mla' => array(
558 558
         'parent'		=> 'mlas',
559 559
         'title'			=> 'Find your MLA',
560 560
         'url'			=> 'mla/'
561 561
     ),
562
-    'mlas' => array (
562
+    'mlas' => array(
563 563
         'parent'		=> 'ni_home',
564
-        'menu'			=> array (
564
+        'menu'			=> array(
565 565
             'text'			=> 'MLAs',
566 566
             'title'			=> "List of all Members of the Northern Ireland Assembly (MLAs)"
567 567
         ),
568 568
         'title'			=> '',
569 569
         'url'			=> 'mlas/'
570 570
     ),
571
-    'msps' => array (
571
+    'msps' => array(
572 572
         'parent'		=> 'sp_home',
573
-        'menu'			=> array (
573
+        'menu'			=> array(
574 574
             'text'			=> 'MSPs',
575 575
             'title'			=> "List of Members of the Scottish Parliament (MSPs)"
576 576
         ),
577 577
         'title'			=> '',
578 578
         'url'			=> 'msps/'
579 579
     ),
580
-    'msp' => array (
580
+    'msp' => array(
581 581
         'parent'		=> 'msps',
582 582
         'title'			=> 'Find your MSP',
583 583
         'url'			=> 'msp/'
584 584
     ),
585 585
     /* Not 'Your MP', whose name is 'yourmp'... */
586
-    'mp' => array (
586
+    'mp' => array(
587 587
         'parent'			=> 'mps',
588 588
         'title'			=> 'Find your MP',
589 589
         'url'			=> 'mp/'
590 590
     ),
591
-    'emailfriend' => array (
591
+    'emailfriend' => array(
592 592
         'title'			=> 'Send this page to a friend',
593 593
         'url'			=> 'email/'
594 594
     ),
595 595
     // The directory MPs' RSS feeds are stored in.
596
-    'mp_rss' => array (
596
+    'mp_rss' => array(
597 597
         'url'			=> 'rss/mp/'
598 598
     ),
599
-    'mps' => array (
600
-         'menu'			=> array (
599
+    'mps' => array(
600
+         'menu'			=> array(
601 601
             'text'			=> 'MPs',
602 602
             'title'			=> "List of all Members of Parliament (MPs)"
603 603
         ),
@@ -608,16 +608,16 @@  discard block
 block discarded – undo
608 608
 
609 609
     /* Northern Ireland Assembly */
610 610
     'ni_home' => array(
611
-        'menu'			=> array (
611
+        'menu'			=> array(
612 612
             'text'			=> 'Northern Ireland Assembly',
613 613
             'title'			=> 'Full authority over <em>transferred matters</em>, which include agriculture, education, employment, the environment and health'
614 614
         ),
615 615
         'title'			=> 'Northern Ireland Assembly',
616 616
         'url'			=> 'ni/'
617 617
     ),
618
-    'nioverview' => array (
618
+    'nioverview' => array(
619 619
         'parent'		=> 'ni_home',
620
-        'menu'			=> array (
620
+        'menu'			=> array(
621 621
             'text'			=> 'Debates',
622 622
             'title'			=> "Overview of the Northern Ireland Assembly debates"
623 623
         ),
@@ -625,23 +625,23 @@  discard block
 block discarded – undo
625 625
         'rss'			=> 'rss/ni.rss',
626 626
         'url'			=> 'ni/'
627 627
     ),
628
-    'nidebate'  => array (
628
+    'nidebate'  => array(
629 629
         'parent'		=> 'nidebatesfront',
630 630
         'url'			=> 'ni/',
631
-        'session_vars'	=> array ('id'),
631
+        'session_vars'	=> array('id'),
632 632
     ),
633
-    'nidebates'  => array (
633
+    'nidebates'  => array(
634 634
         'parent'		=> 'nidebatesfront',
635 635
         'url'			=> 'ni/',
636
-        'session_vars'	=> array ('id'),
636
+        'session_vars'	=> array('id'),
637 637
     ),
638
-    'nidebatesday' => array (
638
+    'nidebatesday' => array(
639 639
         'parent'		=> 'nidebatesfront',
640
-        'session_vars'	=> array ('d'),
640
+        'session_vars'	=> array('d'),
641 641
         'url'			=> 'ni/',
642 642
     ),
643
-    'nidebatesfront' => array (
644
-        'menu'			=> array (
643
+    'nidebatesfront' => array(
644
+        'menu'			=> array(
645 645
             'text'			=> 'Debates',
646 646
             'title'			=> "Northern Ireland Assembly debates"
647 647
         ),
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         'rss'			=> 'rss/ni.rss',
651 651
         'url'			=> 'ni/'
652 652
     ),
653
-    'nidebatesyear' => array (
653
+    'nidebatesyear' => array(
654 654
         'parent'		=> 'nidebatesfront',
655 655
         'url'			=> 'ni/'
656 656
     ),
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     /* London Assembly */
659 659
 
660 660
     'london_home' => array(
661
-        'menu'          => array (
661
+        'menu'          => array(
662 662
             'text'      => 'London Assembly',
663 663
             'title'     => 'Scottish education, health, agriculture, justice, prisons and other devolved areas. Some tax-varying powers'
664 664
         ),
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
         'url'           => 'london-assembly/'
667 667
     ),
668 668
 
669
-    'london_assembly_members' => array (
669
+    'london_assembly_members' => array(
670 670
         'parent'        => 'london_home',
671
-        'menu'          => array (
671
+        'menu'          => array(
672 672
             'text'      => 'London Assembly Members',
673 673
             'title'     => "List of Members of the London Assembly)"
674 674
         ),
@@ -676,25 +676,25 @@  discard block
 block discarded – undo
676 676
         'url'           => 'london-assembly-members/'
677 677
     ),
678 678
 
679
-    'london_assembly_member' => array (
679
+    'london_assembly_member' => array(
680 680
         'parent'        => 'london_assembly_members',
681 681
         'title'         => 'Find your London Assembly Member',
682 682
         'url'           => 'london-assembly-member/'
683 683
     ),
684 684
 
685
-    'otheruseredit' => array (
685
+    'otheruseredit' => array(
686 686
         'pg'			=> 'editother',
687 687
         'title'			=> "Editing a user's data",
688 688
         'url'			=> 'user/'
689 689
     ),
690
-    'privacy' => array (
690
+    'privacy' => array(
691 691
         'title'			=> 'Privacy Policy',
692 692
         'url'			=> 'privacy/'
693 693
     ),
694 694
 
695 695
     /* Public bill committees */
696
-    'pbc_front' => array (
697
-        'menu'			=> array (
696
+    'pbc_front' => array(
697
+        'menu'			=> array(
698 698
             'text'			=> 'Bill Committees',
699 699
             'title'			=> "Public Bill Committees (formerly Standing Committees) debates"
700 700
         ),
@@ -712,17 +712,17 @@  discard block
 block discarded – undo
712 712
         'title' => '',
713 713
         'url' => 'pbc/',
714 714
         'parent' => 'pbc_front',
715
-        'session_vars'	=> array ('bill'),
715
+        'session_vars'	=> array('bill'),
716 716
     ),
717 717
     'pbc_clause' => array(
718 718
         'parent'		=> 'pbc_front',
719 719
         'url'			=> 'pbc/',
720
-        'session_vars'	=> array ('id'),
720
+        'session_vars'	=> array('id'),
721 721
     ),
722 722
     'pbc_speech' => array(
723 723
         'parent'		=> 'pbc_front',
724 724
         'url'			=> 'pbc/',
725
-        'session_vars'	=> array ('id'),
725
+        'session_vars'	=> array('id'),
726 726
     ),
727 727
 
728 728
     'people' => array(
@@ -734,62 +734,62 @@  discard block
 block discarded – undo
734 734
         'url'			=> '',
735 735
     ),
736 736
 
737
-    'raw' => array (
737
+    'raw' => array(
738 738
         'title'			=> 'Raw data',
739 739
         'url'			=> 'raw/'
740 740
     ),
741 741
 
742
-    'regmem' => array (
742
+    'regmem' => array(
743 743
         'title'			=> 'Changes to the Register of Members\' Interests',
744 744
         'url'			=> 'regmem/'
745 745
     ),
746 746
 
747
-    'regmem_date' => array (
747
+    'regmem_date' => array(
748 748
         'url'			=> 'regmem/',
749 749
         'parent'		=> 'regmem'
750 750
     ),
751 751
 
752
-    'regmem_mp' => array (
752
+    'regmem_mp' => array(
753 753
         'url'			=> 'regmem/',
754 754
         'parent'		=> 'regmem'
755 755
     ),
756 756
 
757
-    'regmem_diff' => array (
757
+    'regmem_diff' => array(
758 758
         'url'			=> 'regmem/',
759 759
         'parent'		=> 'regmem'
760 760
     ),
761 761
 
762
-    'royal' => array (
762
+    'royal' => array(
763 763
         'parent'        => 'hansard',
764 764
         'title'         => 'Royal',
765 765
         'url'           => 'royal/',
766 766
     ),
767 767
 
768
-    'topic' => array (
768
+    'topic' => array(
769 769
         'parent'        => 'topics',
770 770
         'url'           => 'topic/topic.php',
771 771
     ),
772 772
 
773
-    'topics' => array (
773
+    'topics' => array(
774 774
         'title'        => 'Topics',
775 775
         'url'          => 'topic/',
776 776
     ),
777 777
 
778
-    'search'		=> array (
778
+    'search'		=> array(
779 779
         'sidebar'		=> 'search',
780 780
         'url'			=> 'search/',
781 781
         'robots'		=> 'noindex, nofollow',
782 782
         'heading'		=> '',
783
-        'session_vars'	=> array ('q', 's', 'pid', 'o', 'pop')
783
+        'session_vars'	=> array('q', 's', 'pid', 'o', 'pop')
784 784
     ),
785
-    'search_help'		=> array (
785
+    'search_help'		=> array(
786 786
         'sidebar'		=> 'search',
787 787
         'title'			=> 'Help with searching',
788 788
         'url'			=> 'search/'
789 789
     ),
790 790
 
791
-    'sitenews'		=> array (
792
-        'menu'			=> array (
791
+    'sitenews'		=> array(
792
+        'menu'			=> array(
793 793
             'text'			=> 'TheyWorkForYou news',
794 794
             'title'			=> "News about changes to this website"
795 795
         ),
@@ -799,68 +799,68 @@  discard block
 block discarded – undo
799 799
         'title'			=> 'TheyWorkForYou news',
800 800
         'url'			=> 'news/'
801 801
     ),
802
-    'sitenews_archive'		=> array (
802
+    'sitenews_archive'		=> array(
803 803
         'parent'		=> 'sitenews',
804 804
         'rss'			=> 'news/index.rdf',
805 805
         'sidebar'		=> 'sitenews',
806 806
         'title'			=> 'Archive',
807 807
         'url'			=> 'news/archives/'
808 808
     ),
809
-    'sitenews_atom' 	=> array (
809
+    'sitenews_atom' 	=> array(
810 810
         'url'			=> 'news/atom.xml'
811 811
     ),
812
-    'sitenews_date'	=> array (
812
+    'sitenews_date'	=> array(
813 813
         'parent'		=> 'sitenews',
814 814
         'rss'			=> 'news/index.rdf',
815 815
         'sidebar'		=> 'sitenews'
816 816
     ),
817
-    'sitenews_individual'	=> array (
817
+    'sitenews_individual'	=> array(
818 818
         'parent'		=> 'sitenews',
819 819
         'rss'			=> 'news/index.rdf',
820 820
         'sidebar'		=> 'sitenews',
821 821
     ),
822
-    'sitenews_rss1' 	=> array (
822
+    'sitenews_rss1' 	=> array(
823 823
         'url'			=> 'news/index.rdf'
824 824
     ),
825
-    'sitenews_rss2' 	=> array (
825
+    'sitenews_rss2' 	=> array(
826 826
         'url'			=> 'news/index.xml'
827 827
     ),
828 828
 
829 829
     /* Scottish Parliament */
830 830
     'sp_home' => array(
831
-        'menu'			=> array (
831
+        'menu'			=> array(
832 832
             'text'			=> 'Scottish Parliament',
833 833
             'title'			=> 'Scottish education, health, agriculture, justice, prisons and other devolved areas. Some tax-varying powers'
834 834
         ),
835 835
         'title'			=> 'Scottish Parliament',
836 836
         'url'			=> 'scotland/'
837 837
     ),
838
-    'spoverview' => array (
838
+    'spoverview' => array(
839 839
         'parent'		=> 'sp_home',
840
-        'menu'			=> array (
840
+        'menu'			=> array(
841 841
             'text'			=> 'Overview',
842 842
             'title'			=> "Overview of the Scottish Parliament"
843 843
         ),
844 844
         'title'			=> '',
845 845
         'url'			=> 'scotland/'
846 846
     ),
847
-    'spdebate'  => array (
847
+    'spdebate'  => array(
848 848
         'parent'		=> 'spdebatesfront',
849 849
         'url'			=> 'sp/',
850
-        'session_vars'	=> array ('id'),
850
+        'session_vars'	=> array('id'),
851 851
     ),
852
-    'spdebates'  => array (
852
+    'spdebates'  => array(
853 853
         'parent'		=> 'spdebatesfront',
854 854
         'url'			=> 'sp/',
855
-        'session_vars'	=> array ('id'),
855
+        'session_vars'	=> array('id'),
856 856
     ),
857
-    'spdebatesday' => array (
857
+    'spdebatesday' => array(
858 858
         'parent'		=> 'spdebatesfront',
859
-        'session_vars'	=> array ('d'),
859
+        'session_vars'	=> array('d'),
860 860
         'url'			=> 'sp/',
861 861
     ),
862
-    'spdebatesfront' => array (
863
-        'menu'			=> array (
862
+    'spdebatesfront' => array(
863
+        'menu'			=> array(
864 864
             'text'			=> 'Debates',
865 865
             'title'			=> ''
866 866
         ),
@@ -869,21 +869,21 @@  discard block
 block discarded – undo
869 869
         'url'			=> 'sp/'
870 870
     ),
871 871
 
872
-    'spdebatesyear' => array (
872
+    'spdebatesyear' => array(
873 873
         'parent'		=> 'spdebatesfront',
874 874
         'url'			=> 'sp/'
875 875
     ),
876
-    'spwrans'  => array (
876
+    'spwrans'  => array(
877 877
         'parent'		=> 'spwransfront',
878 878
         'url'			=> 'spwrans/',
879 879
         #'session_vars'	=> array ('id'),
880 880
     ),
881
-    'spwransday'  => array (
881
+    'spwransday'  => array(
882 882
         'parent'		=> 'spwransfront',
883 883
         'url'			=> 'spwrans/'
884 884
     ),
885
-    'spwransfront'  => array (
886
-        'menu'			=> array (
885
+    'spwransfront'  => array(
886
+        'menu'			=> array(
887 887
             'text'			=> 'Written Answers',
888 888
             'title'			=> ''
889 889
         ),
@@ -896,31 +896,31 @@  discard block
 block discarded – undo
896 896
         'title'			=> 'For questions asked by ',
897 897
         'url'			=> 'spwrans/'
898 898
     ),
899
-    'spwransyear' => array (
899
+    'spwransyear' => array(
900 900
         'parent'		=> 'spwransfront',
901 901
         'url'			=> 'spwrans/'
902 902
     ),
903 903
 
904 904
     // Topic pages
905 905
 
906
-    'topic' => array (
906
+    'topic' => array(
907 907
         'url'           => 'topic/',
908 908
         'title'         => 'Topics'
909 909
     ),
910 910
 
911
-    'topicbenefits' => array (
911
+    'topicbenefits' => array(
912 912
         'url'           => 'topic/benefits',
913 913
         'parent'        => 'topic',
914 914
         'title'         => 'Benefits'
915 915
     ),
916 916
 
917
-    'topiccrimestats' => array (
917
+    'topiccrimestats' => array(
918 918
         'url'           => 'topic/crime-stats',
919 919
         'parent'        => 'topic',
920 920
         'title'         => 'Crime Statistics'
921 921
     ),
922 922
 
923
-    'topicnhs' => array (
923
+    'topicnhs' => array(
924 924
         'url'           => 'topic/nhs',
925 925
         'parent'        => 'topic',
926 926
         'title'         => 'NHS'
@@ -935,29 +935,29 @@  discard block
 block discarded – undo
935 935
         'url'			=> 'user/alerts/',
936 936
         'parent'		=> 'userviewself'
937 937
     ),
938
-    'userchangepc' => array (
938
+    'userchangepc' => array(
939 939
         'title'			=> 'Change your postcode',
940 940
         'url'			=> 'user/changepc/'
941 941
     ),
942
-    'userconfirm' => array (
942
+    'userconfirm' => array(
943 943
         'url'			=> 'user/confirm/'
944 944
     ),
945
-    'userconfirmed' => array (
945
+    'userconfirmed' => array(
946 946
         'sidebar'		=> 'userconfirmed',
947 947
         'title'			=> 'Welcome to TheyWorkForYou!',
948 948
         'url'			=> 'user/confirm/'
949 949
     ),
950
-    'userconfirmfailed' => array (
950
+    'userconfirmfailed' => array(
951 951
         'title'			=> 'Oops!',
952 952
         'url'			=> 'user/confirm/'
953 953
     ),
954
-    'useredit' => array (
954
+    'useredit' => array(
955 955
         'pg'			=> 'edit',
956 956
         'title'			=> 'Edit your details',
957 957
         'url'			=> 'user/'
958 958
     ),
959
-    'userjoin' => array (
960
-                'menu'                  => array (
959
+    'userjoin' => array(
960
+                'menu'                  => array(
961 961
                         'text'                  => 'Join',
962 962
                         'title'                 => "Joining is free and allows you to annotate speeches"
963 963
                 ),
@@ -966,8 +966,8 @@  discard block
 block discarded – undo
966 966
                 'title'                 => 'Join TheyWorkForYou',
967 967
                 'url'                   => 'user/'
968 968
         ),
969
-    'getinvolved' => array (
970
-        'menu'			=> array (
969
+    'getinvolved' => array(
970
+        'menu'			=> array(
971 971
             'text'			=> 'Get involved',
972 972
             'title'			=> "Contribute to TheyWorkForYou"
973 973
         ),
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
         'title'			=> 'Contribute to TheyWorkForYou',
977 977
         'url'			=> 'getinvolved/'
978 978
     ),
979
-    'userlogin' => array (
980
-        'menu'			=> array (
979
+    'userlogin' => array(
980
+        'menu'			=> array(
981 981
             'text'			=> 'Sign in',
982 982
             'title'			=> "If you've already joined , sign in to add annotations"
983 983
         ),
@@ -986,33 +986,33 @@  discard block
 block discarded – undo
986 986
         'url'			=> 'user/login/'
987 987
     ),
988 988
 
989
-    'userlogout' => array (
990
-        'menu'			=> array (
989
+    'userlogout' => array(
990
+        'menu'			=> array(
991 991
             'text'			=> 'Sign out',
992 992
             'title'			=> "Sign out"
993 993
         ),
994 994
         'url'			=> 'user/logout/'
995 995
     ),
996
-    'userpassword' => array (
996
+    'userpassword' => array(
997 997
         'title'			=> 'Change password',
998 998
         'url'			=> 'user/password/'
999 999
     ),
1000
-    'userprompt' => array (
1000
+    'userprompt' => array(
1001 1001
         'title'			=> 'Please sign in',
1002 1002
         'url'			=> 'user/prompt/'
1003 1003
     ),
1004
-    'userview' => array (
1004
+    'userview' => array(
1005 1005
         'session_vars'	=> array('u'),
1006 1006
         'url'			=> 'user/'
1007 1007
     ),
1008
-    'userviewself' => array (
1009
-        'menu'			=> array (
1008
+    'userviewself' => array(
1009
+        'menu'			=> array(
1010 1010
             'text'			=> 'Your details',
1011 1011
             'title'			=> "View and edit your details"
1012 1012
         ),
1013 1013
         'url'			=> 'user/'
1014 1014
     ),
1015
-    'userwelcome' => array (
1015
+    'userwelcome' => array(
1016 1016
         'title'			=> 'Welcome!',
1017 1017
         'url'			=> 'user/'
1018 1018
     ),
@@ -1040,23 +1040,23 @@  discard block
 block discarded – undo
1040 1040
     ),
1041 1041
 
1042 1042
     /* Westminster Hall */
1043
-    'whall'  => array (
1043
+    'whall'  => array(
1044 1044
         'parent'		=> 'whallfront',
1045 1045
         'url'			=> 'whall/',
1046
-        'session_vars'	=> array ('id'),
1046
+        'session_vars'	=> array('id'),
1047 1047
     ),
1048
-    'whalls'  => array (
1048
+    'whalls'  => array(
1049 1049
         'parent'		=> 'whallfront',
1050 1050
         'url'			=> 'whall/',
1051
-        'session_vars'	=> array ('id'),
1051
+        'session_vars'	=> array('id'),
1052 1052
     ),
1053
-    'whallday' => array (
1053
+    'whallday' => array(
1054 1054
         'parent'		=> 'whallfront',
1055
-        'session_vars'	=> array ('d'),
1055
+        'session_vars'	=> array('d'),
1056 1056
         'url'			=> 'whall/',
1057 1057
     ),
1058
-    'whallfront' => array (
1059
-        'menu'			=> array (
1058
+    'whallfront' => array(
1059
+        'menu'			=> array(
1060 1060
             'text'			=> 'Westminster Hall',
1061 1061
             'title'			=> "Westminster Hall debates"
1062 1062
         ),
@@ -1065,23 +1065,23 @@  discard block
 block discarded – undo
1065 1065
         'rss'			=> 'rss/whall.rss',
1066 1066
         'url'			=> 'whall/'
1067 1067
     ),
1068
-    'whallyear' => array (
1068
+    'whallyear' => array(
1069 1069
         'parent'		=> 'whallfront',
1070 1070
         'url'			=> 'whall/'
1071 1071
     ),
1072 1072
 
1073
-    'wms' => array (
1073
+    'wms' => array(
1074 1074
         'parent'		=> 'wranswmsfront',
1075 1075
         'url'			=> 'wms/',
1076 1076
         'session_vars'	=> array('id')
1077 1077
     ),
1078
-    'wmsday' => array (
1078
+    'wmsday' => array(
1079 1079
         'parent'		=> 'wmsfront',
1080 1080
         'session_vars'	=> array('d'),
1081 1081
         'url'			=> 'wms/'
1082 1082
     ),
1083
-    'wmsfront' => array (
1084
-        'menu'			=> array (
1083
+    'wmsfront' => array(
1084
+        'menu'			=> array(
1085 1085
             'text'			=> 'Written Ministerial Statements',
1086 1086
             'title'			=> ''
1087 1087
         ),
@@ -1090,22 +1090,22 @@  discard block
 block discarded – undo
1090 1090
         'rss'			=> 'rss/wms.rss',
1091 1091
         'url'			=> 'wms/'
1092 1092
     ),
1093
-    'wmsyear' => array (
1093
+    'wmsyear' => array(
1094 1094
         'parent'		=> 'wmsfront',
1095 1095
         'url'			=> 'wms/'
1096 1096
     ),
1097 1097
 
1098
-    'wrans'  => array (
1098
+    'wrans'  => array(
1099 1099
         'parent'		=> 'wranswmsfront',
1100 1100
         'url'			=> 'wrans/',
1101
-        'session_vars'	=> array ('id')
1101
+        'session_vars'	=> array('id')
1102 1102
     ),
1103
-    'wransday'  => array (
1103
+    'wransday'  => array(
1104 1104
         'parent'		=> 'wransfront',
1105 1105
         'url'			=> 'wrans/'
1106 1106
     ),
1107
-    'wransfront'  => array (
1108
-        'menu'			=> array (
1107
+    'wransfront'  => array(
1108
+        'menu'			=> array(
1109 1109
             'text'			=> 'Written Answers',
1110 1110
             'title'			=> "Written Answers"
1111 1111
         ),
@@ -1118,13 +1118,13 @@  discard block
 block discarded – undo
1118 1118
         'title'			=> 'For questions asked by ',
1119 1119
         'url'			=> 'wrans/'
1120 1120
     ),
1121
-    'wransyear' => array (
1121
+    'wransyear' => array(
1122 1122
         'parent'		=> 'wransfront',
1123 1123
         'url'			=> 'wrans/'
1124 1124
     ),
1125 1125
 
1126
-    'wranswmsfront'  => array (
1127
-        'menu'			=> array (
1126
+    'wranswmsfront'  => array(
1127
+        'menu'			=> array(
1128 1128
             'text'			=> 'Written Answers',
1129 1129
             'title'			=> 'Written Answers and Statements',
1130 1130
         ),
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
         'title' => 'Your representative',
1142 1142
         'url' => 'your/',
1143 1143
     ),
1144
-    'yourmp' => array (
1145
-        'menu'			=> array (
1144
+    'yourmp' => array(
1145
+        'menu'			=> array(
1146 1146
             'text'			=> 'Your MP',
1147 1147
             'title'			=> "Find out about your Member of Parliament"
1148 1148
         ),
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
         'url'			=> 'mp/',
1152 1152
         'parent'			=> 'mps',
1153 1153
     ),
1154
-    'yourmp_recent' => array (
1155
-        'menu'			=> array (
1154
+    'yourmp_recent' => array(
1155
+        'menu'			=> array(
1156 1156
             'text'			=> 'Recent appearances',
1157 1157
             'title'			=> "Recent speeches and written answers by this MP"
1158 1158
         ),
@@ -1160,8 +1160,8 @@  discard block
 block discarded – undo
1160 1160
         'title'			=> "Your MP's recent appearances in parliament",
1161 1161
         'url'			=> 'mp/?recent=1'
1162 1162
     ),
1163
-    'yourmsp' => array (
1164
-        'menu'			=> array (
1163
+    'yourmsp' => array(
1164
+        'menu'			=> array(
1165 1165
             'text'			=> 'Your MSPs',
1166 1166
             'title'			=> "Find out about your Members of the Scottish Parliament"
1167 1167
         ),
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
         'title'			=> 'Your MSPs',
1171 1171
         'url'			=> 'msp/'
1172 1172
     ),
1173
-    'yourmla' => array (
1174
-        'menu'			=> array (
1173
+    'yourmla' => array(
1174
+        'menu'			=> array(
1175 1175
             'text'			=> 'Your MLAs',
1176 1176
             'title'			=> "Find out about your Members of the Legislative Assembly"
1177 1177
         ),
@@ -1187,38 +1187,38 @@  discard block
 block discarded – undo
1187 1187
 // The text displayed on the page itself will also be this,
1188 1188
 // UNLESS the section has a 'heading', in which case that's used instead.
1189 1189
 
1190
-$this->section = array (
1190
+$this->section = array(
1191 1191
 
1192 1192
 
1193
-    'about' => array (
1193
+    'about' => array(
1194 1194
         'title' 	=> 'About Us'
1195 1195
     ),
1196
-    'admin' => array (
1196
+    'admin' => array(
1197 1197
         'title'		=> 'Admin'
1198 1198
     ),
1199
-    'debates' => array (
1199
+    'debates' => array(
1200 1200
         'title' 	=> 'Debates',
1201 1201
         'heading'	=> 'House of Commons Debates'
1202 1202
     ),
1203
-    'help_us_out' => array (
1203
+    'help_us_out' => array(
1204 1204
         'title' 	=> 'Help Us Out'
1205 1205
     ),
1206
-    'hansard' => array (
1206
+    'hansard' => array(
1207 1207
         'title' 	=> 'Hansard'
1208 1208
     ),
1209
-    'home' => array (
1209
+    'home' => array(
1210 1210
         'title' 	=> 'Home'
1211 1211
     ),
1212
-    'mp' => array (
1212
+    'mp' => array(
1213 1213
         'title' 	=> 'Your MP'
1214 1214
     ),
1215
-    'search' => array (
1215
+    'search' => array(
1216 1216
         'title' 	=> 'Search'
1217 1217
     ),
1218
-    'sitenews' => array (
1218
+    'sitenews' => array(
1219 1219
         'title' 	=> 'TheyWorkForYou news'
1220 1220
     ),
1221
-    'wrans' => array (
1221
+    'wrans' => array(
1222 1222
         'title' 	=> 'Written Answers'
1223 1223
     )
1224 1224
 
Please login to merge, or discard this patch.
classes/Member.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             $now = new \DateTime();
77 77
 
78 78
             $diff = $date_entered->diff($now);
79
-            if ( $diff->y == 0 && $diff->m <= 6 ) {
79
+            if ($diff->y == 0 && $diff->m <= 6) {
80 80
                 return TRUE;
81 81
             }
82 82
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $entered_house = $this->entered_house($house);
99 99
 
100
-        if ( $entered_house ) {
100
+        if ($entered_house) {
101 101
             $date_entered = $entered_house['date'];
102 102
         }
103 103
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         $left_house = $this->left_house($house);
119 119
 
120
-        if ( $left_house ) {
120
+        if ($left_house) {
121 121
             $date_left = $left_house['date'];
122 122
         }
123 123
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
         $is_lord = $this->house(HOUSE_TYPE_LORDS);
147 147
         if ($is_lord) {
148
-            list($image,$size) = Utility\Member::findMemberImage($this->person_id(), false, 'lord');
148
+            list($image, $size) = Utility\Member::findMemberImage($this->person_id(), false, 'lord');
149 149
         } else {
150
-            list($image,$size) = Utility\Member::findMemberImage($this->person_id(), false, true);
150
+            list($image, $size) = Utility\Member::findMemberImage($this->person_id(), false, true);
151 151
         }
152 152
 
153 153
         // We can determine if the image exists or not by testing if size is set
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 
171 171
         usort(
172 172
             $departures,
173
-            function ($a, $b) {
174
-                if ( $a['date'] == $b['date'] ) {
173
+            function($a, $b) {
174
+                if ($a['date'] == $b['date']) {
175 175
                     return 0;
176
-                } else if ( $a['date'] < $b['date'] ) {
176
+                } else if ($a['date'] < $b['date']) {
177 177
                     return -1;
178 178
                 } else {
179 179
                     return 1;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $office = $office['office'];
212 212
 
213 213
             foreach ($office as $row) {
214
-                if ( $officeObject = $this->getOfficeObject($include_only, $ignore_committees, $row) ) {
214
+                if ($officeObject = $this->getOfficeObject($include_only, $ignore_committees, $row)) {
215 215
                     $out[] = $officeObject;
216 216
                 }
217 217
             }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     private function entered_house_line($house, $house_name) {
349 349
         if (isset($this->entered_house[$house]['date'])) {
350 350
             $string = "<strong>Entered the $house_name ";
351
-            $string .= strlen($this->entered_house[$house]['date_pretty'])==HOUSE_TYPE_SCOTLAND ? 'in ' : 'on ';
351
+            $string .= strlen($this->entered_house[$house]['date_pretty']) == HOUSE_TYPE_SCOTLAND ? 'in ' : 'on ';
352 352
             $string .= $this->entered_house[$house]['date_pretty'] . '</strong>';
353 353
             if ($this->entered_house[$house]['reason']) {
354 354
                 $string .= ' &mdash; ' . $this->entered_house[$house]['reason'];
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     private function left_house_line($house, $house_name) {
361 361
         if ($this->house($house) && !$this->current_member($house)) {
362 362
             $string = "<strong>Left the $house_name ";
363
-            $string .= strlen($this->left_house[$house]['date_pretty'])==4 ? 'in ' : 'on ';
363
+            $string .= strlen($this->left_house[$house]['date_pretty']) == 4 ? 'in ' : 'on ';
364 364
             $string .= $this->left_house[$house]['date_pretty'] . '</strong>';
365 365
             if ($this->left_house[$house]['reason']) {
366 366
                 $string .= ' &mdash; ' . $this->left_house[$house]['reason'];
@@ -373,19 +373,19 @@  discard block
 block discarded – undo
373 373
         $policy_diffs = array();
374 374
         $party_positions = $party->getAllPolicyPositions($policiesList);
375 375
 
376
-        if ( !$party_positions ) {
376
+        if (!$party_positions) {
377 377
             return $policy_diffs;
378 378
         }
379 379
 
380
-        foreach ( $positions->positionsById as $policy_id => $details ) {
381
-            if ( $details['has_strong'] && $details['score'] != -1 && isset($party_positions[$policy_id])) {
380
+        foreach ($positions->positionsById as $policy_id => $details) {
381
+            if ($details['has_strong'] && $details['score'] != -1 && isset($party_positions[$policy_id])) {
382 382
                 $mp_score = $details['score'];
383 383
                 $party_score = $party_positions[$policy_id]['score'];
384 384
 
385 385
                 $score_diff = $this->calculatePolicyDiffScore($mp_score, $party_score);
386 386
 
387 387
                 // skip anything that isn't a yes vs no diff
388
-                if ( $only_diffs && $score_diff < 2 ) {
388
+                if ($only_diffs && $score_diff < 2) {
389 389
                     continue;
390 390
                 }
391 391
                 $policy_diffs[$policy_id] = $score_diff;
@@ -397,18 +397,18 @@  discard block
 block discarded – undo
397 397
         return $policy_diffs;
398 398
     }
399 399
 
400
-    private function calculatePolicyDiffScore( $mp_score, $party_score ) {
400
+    private function calculatePolicyDiffScore($mp_score, $party_score) {
401 401
         $score_diff = abs($mp_score - $party_score);
402 402
         // if they are on opposite sides of mixture of for and against
403 403
         if (
404
-            ( $mp_score < 0.4 && $party_score > 0.6 ) ||
405
-            ( $mp_score > 0.6 && $party_score < 0.4 )
404
+            ($mp_score < 0.4 && $party_score > 0.6) ||
405
+            ($mp_score > 0.6 && $party_score < 0.4)
406 406
         ) {
407 407
             $score_diff += 2;
408 408
         // if on is mixture of for and against and one is for/against
409 409
         } else if (
410
-            ( $mp_score > 0.4 && $mp_score < 0.6 && ( $party_score > 0.6 || $party_score < 0.4 ) ) ||
411
-            ( $party_score > 0.4 && $party_score < 0.6 && ( $mp_score > 0.6 || $mp_score < 0.4 ) )
410
+            ($mp_score > 0.4 && $mp_score < 0.6 && ($party_score > 0.6 || $party_score < 0.4)) ||
411
+            ($party_score > 0.4 && $party_score < 0.6 && ($mp_score > 0.6 || $mp_score < 0.4))
412 412
         ) {
413 413
             $score_diff += 1;
414 414
         }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
         $mreg = array();
423 423
         $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($postcode);
424
-        if ( isset($constituencies[$type]) ) {
424
+        if (isset($constituencies[$type])) {
425 425
             $cons_name = $constituencies[$type];
426 426
             $query_base = "SELECT member.person_id, title, lordofname, given_name, family_name, constituency, house
427 427
                 FROM member, person_names
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                     ':cons_name' => $cons_name
439 439
                 )
440 440
             );
441
-            if ( !$q->rows() && ($dissolution = Dissolution::db()) ) {
441
+            if (!$q->rows() && ($dissolution = Dissolution::db())) {
442 442
                 $q = $db->query("$query_base AND $dissolution[query]",
443 443
                     array(
444 444
                         ':house' => $house,
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     }
463 463
 
464 464
     public static function getRepNameForHouse($house) {
465
-        switch ( $house ) {
465
+        switch ($house) {
466 466
             case HOUSE_TYPE_COMMONS:
467 467
                 $name = 'MP';
468 468
                 break;
Please login to merge, or discard this patch.
www/docs/mp/index.php 1 patch
Braces   +128 added lines, -57 removed lines patch added patch discarded remove patch
@@ -61,16 +61,36 @@  discard block
 block discarded – undo
61 61
 $constituency = strtolower(str_replace('_', ' ', get_http_var('c')));
62 62
 
63 63
 // Fix for names with non-ASCII characters
64
-if ($name == 'sion simon') $name = 'si\xf4n simon';
65
-if ($name == 'sian james') $name = 'si\xe2n james';
66
-if ($name == 'lembit opik') $name = 'lembit \xf6pik';
67
-if ($name == 'bairbre de brun') $name = 'bairbre de br\xfan';
68
-if ($name == 'daithi mckay') $name = 'daith\xed mckay';
69
-if ($name == 'caral ni chuilin') $name = 'car\xe1l n\xed chuil\xedn';
70
-if ($name == 'caledon du pre') $name = 'caledon du pr\xe9';
71
-if ($name == 'sean etchingham') $name = 'se\xe1n etchingham';
72
-if ($name == 'john tinne') $name = 'john tinn\xe9';
73
-if ($name == 'renee short') $name = 'ren\xe9e short';
64
+if ($name == 'sion simon') {
65
+    $name = 'si\xf4n simon';
66
+}
67
+if ($name == 'sian james') {
68
+    $name = 'si\xe2n james';
69
+}
70
+if ($name == 'lembit opik') {
71
+    $name = 'lembit \xf6pik';
72
+}
73
+if ($name == 'bairbre de brun') {
74
+    $name = 'bairbre de br\xfan';
75
+}
76
+if ($name == 'daithi mckay') {
77
+    $name = 'daith\xed mckay';
78
+}
79
+if ($name == 'caral ni chuilin') {
80
+    $name = 'car\xe1l n\xed chuil\xedn';
81
+}
82
+if ($name == 'caledon du pre') {
83
+    $name = 'caledon du pr\xe9';
84
+}
85
+if ($name == 'sean etchingham') {
86
+    $name = 'se\xe1n etchingham';
87
+}
88
+if ($name == 'john tinne') {
89
+    $name = 'john tinn\xe9';
90
+}
91
+if ($name == 'renee short') {
92
+    $name = 'ren\xe9e short';
93
+}
74 94
 
75 95
 // Fix for common misspellings, name changes etc
76 96
 $name_fix = array(
@@ -102,7 +122,9 @@  discard block
 block discarded – undo
102 122
 }
103 123
 
104 124
 // Fixes for Ynys Mon, and a Unicode URL
105
-if ($constituency == 'ynys mon') $constituency = "ynys m\xf4n";
125
+if ($constituency == 'ynys mon') {
126
+    $constituency = "ynys m\xf4n";
127
+}
106 128
 if (preg_match("#^ynys m\xc3\xb4n#i", $constituency)) {
107 129
     $constituency = "ynys m\xf4n";
108 130
 }
@@ -194,8 +216,9 @@  discard block
 block discarded – undo
194 216
 $desc = "Read $member_name's contributions to Parliament, including speeches and questions";
195 217
 
196 218
 // Enhance description if this is a current member
197
-if ($MEMBER->current_member_anywhere())
219
+if ($MEMBER->current_member_anywhere()) {
198 220
     $desc .= ', investigate their voting record, and get email alerts on their activity';
221
+}
199 222
 
200 223
 // Enhance title if this is a member of the Commons
201 224
 if ($MEMBER->house(HOUSE_TYPE_COMMONS)) {
@@ -203,8 +226,10 @@  discard block
 block discarded – undo
203 226
         $title .= ', former';
204 227
     }
205 228
     $title .= ' MP';
206
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
207
-}
229
+    if ($MEMBER->constituency()) {
230
+        $title .= ', ' . $MEMBER->constituency();
231
+    }
232
+    }
208 233
 
209 234
 // Enhance title if this is a member of NIA
210 235
 if ($MEMBER->house(HOUSE_TYPE_NI)) {
@@ -217,8 +242,10 @@  discard block
 block discarded – undo
217 242
         $title .= ', former';
218 243
     }
219 244
     $title .= ' MLA';
220
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
221
-}
245
+    if ($MEMBER->constituency()) {
246
+        $title .= ', ' . $MEMBER->constituency();
247
+    }
248
+    }
222 249
 
223 250
 // Enhance title if this is a member of Scottish Parliament
224 251
 if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) {
@@ -253,8 +280,9 @@  discard block
 block discarded – undo
253 280
 
254 281
 // Build the RSS link and add it to page data.
255 282
 $feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf';
256
-if (file_exists(BASEDIR . '/' . $feedurl))
283
+if (file_exists(BASEDIR . '/' . $feedurl)) {
257 284
     $DATA->set_page_metadata($this_page, 'rss', $feedurl);
285
+}
258 286
 
259 287
 // Prepare data for the template
260 288
 $data['full_name'] = $MEMBER->full_name();
@@ -591,11 +619,13 @@  discard block
 block discarded – undo
591 619
         $url = $MEMBER->url();
592 620
         $params = array();
593 621
         foreach ($_GET as $key => $value) {
594
-            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid')
595
-                $params[] = "$key=$value";
622
+            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') {
623
+                            $params[] = "$key=$value";
624
+            }
625
+        }
626
+        if (count($params)) {
627
+                    $url .= '?' . join('&', $params);
596 628
         }
597
-        if (count($params))
598
-            $url .= '?' . join('&', $params);
599 629
         if ($pagetype) {
600 630
             $pagetype = '/' . $pagetype;
601 631
         } else {
@@ -672,16 +702,21 @@  discard block
 block discarded – undo
672 702
     $current_member = $MEMBER->current_member();
673 703
     $left_house = $MEMBER->left_house();
674 704
 
675
-    if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) { # Royal short-circuit
705
+    if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) {
706
+# Royal short-circuit
676 707
         return '<strong>Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
677 708
             . '<br>Coronated on 2 June 1953</strong></li>';
678 709
     }
679 710
     $desc = '';
680 711
     foreach ($MEMBER->houses() as $house) {
681
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
682
-            continue; # Same info is printed further down
712
+        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) {
713
+                    continue;
714
+        }
715
+        # Same info is printed further down
683 716
 
684
-        if (!$current_member[$house]) $desc .= 'Former ';
717
+        if (!$current_member[$house]) {
718
+            $desc .= 'Former ';
719
+        }
685 720
 
686 721
         $party = $left_house[$house]['party'];
687 722
         $party_br = '';
@@ -689,8 +724,9 @@  discard block
 block discarded – undo
689 724
             $party_br = $m[2];
690 725
             $party = $m[1];
691 726
         }
692
-        if ($party != 'unknown')
693
-            $desc .= _htmlentities($party);
727
+        if ($party != 'unknown') {
728
+                    $desc .= _htmlentities($party);
729
+        }
694 730
         if ($party == 'Speaker' || $party == 'Deputy Speaker') {
695 731
             $desc .= ', and ';
696 732
             # XXX: Might go horribly wrong if something odd happens
@@ -701,15 +737,23 @@  discard block
 block discarded – undo
701 737
         }
702 738
         if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
703 739
             $desc .= ' ';
704
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
705
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
706
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
740
+            if ($house==HOUSE_TYPE_COMMONS) {
741
+                $desc .= '<abbr title="Member of Parliament">MP</abbr>';
742
+            }
743
+            if ($house==HOUSE_TYPE_NI) {
744
+                $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
745
+            }
746
+            if ($house==HOUSE_TYPE_SCOTLAND) {
747
+                $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
748
+            }
707 749
             if ($party_br) {
708 750
                 $desc .= " ($party_br)";
709 751
             }
710 752
             $desc .= ' for ' . $left_house[$house]['constituency'];
711 753
         }
712
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
754
+        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') {
755
+            $desc .= ' Peer';
756
+        }
713 757
         $desc .= ', ';
714 758
     }
715 759
     $desc = preg_replace('#, $#', '', $desc);
@@ -971,10 +1015,13 @@  discard block
 block discarded – undo
971 1015
     # Find latest entered house
972 1016
     $entered_house = null;
973 1017
     foreach ($member->entered_house() as $h => $eh) {
974
-        if (!$entered_house || $eh['date'] > $entered_house) $entered_house = $eh['date'];
1018
+        if (!$entered_house || $eh['date'] > $entered_house) {
1019
+            $entered_house = $eh['date'];
1020
+        }
1021
+    }
1022
+    if ($entered_house > $year_ago) {
1023
+            $since_text = 'since joining Parliament';
975 1024
     }
976
-    if ($entered_house > $year_ago)
977
-        $since_text = 'since joining Parliament';
978 1025
 
979 1026
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
980 1027
     $section = 'section:debates section:whall section:lords section:ni';
@@ -988,10 +1035,12 @@  discard block
 block discarded – undo
988 1035
         $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1));
989 1036
         // We assume that if they've answered a question, they're a minister
990 1037
         $minister = 0; $Lminister = false;
991
-        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0)
992
-            $minister = 1;
993
-        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0)
994
-            $Lminister = true;
1038
+        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
1039
+                    $minister = 1;
1040
+        }
1041
+        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
1042
+                    $Lminister = true;
1043
+        }
995 1044
         if ($member->party() == 'SPK' || $member->party() == 'CWM' || $member->party() == 'DCWM') {
996 1045
             $minister = 2;
997 1046
         }
@@ -1039,11 +1088,17 @@  discard block
 block discarded – undo
1039 1088
 
1040 1089
     if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1041 1090
         $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1042
-        if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1043
-        elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1044
-        elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1045
-        elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1046
-        elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1091
+        if ($member->house_disp == HOUSE_TYPE_COMMONS) {
1092
+            $line .= 'this MP';
1093
+        } elseif ($member->house_disp == HOUSE_TYPE_LORDS) {
1094
+            $line .= 'this peer';
1095
+        } elseif ($member->house_disp == HOUSE_TYPE_NI) {
1096
+            $line .= 'this MLA';
1097
+        } elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) {
1098
+            $line .= 'this MSP';
1099
+        } elseif ($member->house_disp == HOUSE_TYPE_ROYAL) {
1100
+            $line .= $member->full_name();
1101
+        }
1047 1102
         if ($has_email_alerts) {
1048 1103
             $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1049 1104
         }
@@ -1067,10 +1122,12 @@  discard block
 block discarded – undo
1067 1122
 
1068 1123
 function display_stats_line($category, $blurb, $type, $inwhat, $afterstuff, $extra_info, $minister = false, $Lminister = false) {
1069 1124
     $return = false;
1070
-    if (isset($extra_info[$category]))
1071
-        $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1072
-    if (isset($extra_info["L$category"]))
1073
-        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1125
+    if (isset($extra_info[$category])) {
1126
+            $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1127
+    }
1128
+    if (isset($extra_info["L$category"])) {
1129
+            $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1130
+    }
1074 1131
     return $return;
1075 1132
 }
1076 1133
 
@@ -1082,17 +1139,21 @@  discard block
 block discarded – undo
1082 1139
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1083 1140
         }
1084 1141
     }
1085
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1142
+    if ($house==HOUSE_TYPE_LORDS) {
1143
+        $inwhat = str_replace('MP', 'Lord', $inwhat);
1144
+    }
1086 1145
     $line = $blurb;
1087 1146
     $line .= '<strong>' . $extra_info[$category];
1088
-    if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1147
+    if ($type) {
1148
+        $line .= ' ' . make_plural($type, $extra_info[$category]);
1149
+    }
1089 1150
     $line .= '</strong>';
1090 1151
     $line .= $inwhat;
1091 1152
     if ($minister===2) {
1092 1153
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1093
-    } elseif ($minister)
1094
-        $line .= ' &#8212; Ministers do not ask written questions';
1095
-    else {
1154
+    } elseif ($minister) {
1155
+            $line .= ' &#8212; Ministers do not ask written questions';
1156
+    } else {
1096 1157
         $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1097 1158
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1098 1159
             $line .= ' &#8212; ';
@@ -1131,11 +1192,21 @@  discard block
 block discarded – undo
1131 1192
         $mean = $extra_info["writetothem_responsiveness_mean_$year"];
1132 1193
 
1133 1194
         $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
1134
-        if ($a == 'very low') $a = 'a very low';
1135
-        if ($a == 'low') $a = 'a low';
1136
-        if ($a == 'medium') $a = 'a medium';
1137
-        if ($a == 'high') $a = 'a high';
1138
-        if ($a == 'very high') $a = 'a very high';
1195
+        if ($a == 'very low') {
1196
+            $a = 'a very low';
1197
+        }
1198
+        if ($a == 'low') {
1199
+            $a = 'a low';
1200
+        }
1201
+        if ($a == 'medium') {
1202
+            $a = 'a medium';
1203
+        }
1204
+        if ($a == 'high') {
1205
+            $a = 'a high';
1206
+        }
1207
+        if ($a == 'very high') {
1208
+            $a = 'a very high';
1209
+        }
1139 1210
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1140 1211
 
1141 1212
         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.
tests/PageTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $this->assertRegexp('#<span class="person-header__about__position__role">\s*Labour\s*MP\s*</span>#', $page);
35 35
     }
36 36
 
37
-	public function testSittingMLA()
37
+    public function testSittingMLA()
38 38
     {
39 39
         $page = $this->fetch_page( array( 'pid' => 4, 'representative_type' => 'mla', 'url' => '/mp/4/test_current-mla' ) );
40 40
         $this->assertContains('Test Current-MLA', $page);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * Ensure that the Speaker is given the correct constituency.
65 65
      */
66
-	public function testSpeaker()
66
+    public function testSpeaker()
67 67
     {
68 68
         $page = $this->fetch_page( array( 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ) );
69 69
         $this->assertRegexp('#<span class="person-header__about__position__role">\s*Speaker\s*MP\s*</span>#', $page);
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/member.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/member.xml');
15 15
     }
16 16
 
17 17
     private function fetch_page($vars)
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function testQueenie()
23 23
     {
24
-        $page = $this->fetch_page( array( 'representative_type' => 'royal', 'n' => 'elizabeth_the_second' ) );
24
+        $page = $this->fetch_page(array('representative_type' => 'royal', 'n' => 'elizabeth_the_second'));
25 25
         $this->assertContains('Elizabeth the Second', $page);
26 26
         $this->assertContains('Coronated on 2 June 1953', $page);
27 27
     }
28 28
 
29 29
     public function testSittingMP()
30 30
     {
31
-        $page = $this->fetch_page( array( 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ) );
31
+        $page = $this->fetch_page(array('pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency'));
32 32
         $this->assertContains('Test Current-MP', $page);
33 33
         $this->assertRegexp('#<span class="person-header__about__position__constituency">\s*Test Westminster Constituency\s*</span>#', $page);
34 34
         $this->assertRegexp('#<span class="person-header__about__position__role">\s*Labour\s*MP\s*</span>#', $page);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function testSittingMLA()
38 38
     {
39
-        $page = $this->fetch_page( array( 'pid' => 4, 'representative_type' => 'mla', 'url' => '/mp/4/test_current-mla' ) );
39
+        $page = $this->fetch_page(array('pid' => 4, 'representative_type' => 'mla', 'url' => '/mp/4/test_current-mla'));
40 40
         $this->assertContains('Test Current-MLA', $page);
41 41
         $this->assertRegexp('#<span class="person-header__about__position__constituency">\s*Test Northern Ireland Constituency\s*</span>#', $page);
42 42
         $this->assertRegexp('#<span class="person-header__about__position__role">\s*Sinn Féin\s*MLA\s*</span>#', $page);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function testSittingSinnFeinMP()
49 49
     {
50
-        $page = $this->fetch_page( array( 'pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency' ) );
50
+        $page = $this->fetch_page(array('pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency'));
51 51
         $this->assertContains('Sinn F&eacute;in MPs do not take their seats in Parliament.', $page);
52 52
     }
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function testSittingNonSinnFeinMP()
58 58
     {
59
-        $page = $this->fetch_page( array( 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ) );
59
+        $page = $this->fetch_page(array('pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency'));
60 60
         $this->assertNotContains('Sinn F&eacute;in MPs do not take their seats in Parliament.', $page);
61 61
     }
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
 	public function testSpeaker()
67 67
     {
68
-        $page = $this->fetch_page( array( 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ) );
68
+        $page = $this->fetch_page(array('pid' => 13, 'url' => '/mp/13/test_speaker/buckingham'));
69 69
         $this->assertRegexp('#<span class="person-header__about__position__role">\s*Speaker\s*MP\s*</span>#', $page);
70 70
     }
71 71
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
         # makes sure it is empty in case there's something hanging
76 76
         # about in memcached
77 77
         $banner->set_text('');
78
-        $page = $this->fetch_page( array( 'url' => '/' ) );
78
+        $page = $this->fetch_page(array('url' => '/'));
79 79
         $this->assertNotContains('<div class="banner">', $page);
80 80
         $this->assertNotContains('This is a banner', $page);
81 81
 
82 82
         $banner->set_text('This is a banner');
83
-        $page = $this->fetch_page( array( 'url' => '/' ) );
83
+        $page = $this->fetch_page(array('url' => '/'));
84 84
         $this->assertContains('This is a banner', $page);
85 85
 
86 86
         $banner->set_text('');
87
-        $page = $this->fetch_page( array( 'url' => '/' ) );
87
+        $page = $this->fetch_page(array('url' => '/'));
88 88
         $this->assertNotContains('<div class="banner">', $page);
89 89
         $this->assertNotContains('This is a banner', $page);
90 90
     }
91 91
 
92 92
     public function testNewMPMessage() {
93
-        $page = $this->fetch_page( array( 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ) );
93
+        $page = $this->fetch_page(array('pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency'));
94 94
         $this->assertNotContains('is a recently elected MP', $page);
95 95
         $this->db->query('UPDATE member SET entered_house = NOW() WHERE person_id = 17');
96
-        $page = $this->fetch_page( array( 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ) );
96
+        $page = $this->fetch_page(array('pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency'));
97 97
         $this->assertContains('is a recently elected MP', $page);
98 98
     }
99 99
 
Please login to merge, or discard this patch.