@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | protected function getSearchSections() { |
26 | 26 | return array( |
27 | - array( 'section' => 'sp' ) |
|
27 | + array('section' => 'sp') |
|
28 | 28 | ); |
29 | 29 | } |
30 | 30 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | protected function display_front() { |
14 | 14 | global $DATA, $this_page; |
15 | - if ( get_http_var('type') == 'wrans') { |
|
15 | + if (get_http_var('type') == 'wrans') { |
|
16 | 16 | return parent::display_front(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $data = array(); |
20 | 20 | |
21 | - $args = array( 'months' => 1 ); |
|
21 | + $args = array('months' => 1); |
|
22 | 22 | $WRANSLIST = new \WRANSLIST; |
23 | 23 | |
24 | 24 | $wrans = array(); |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getSearchSections() { |
52 | 52 | $sections = array( |
53 | - array( 'section' => 'wrans', 'title' => 'Written Answers' ), |
|
53 | + array('section' => 'wrans', 'title' => 'Written Answers'), |
|
54 | 54 | ); |
55 | - if ( get_http_var('type') == '') { |
|
56 | - $sections[] = array( 'section' => 'wms', 'title' => 'Written Ministerial Statements' ); |
|
55 | + if (get_http_var('type') == '') { |
|
56 | + $sections[] = array('section' => 'wms', 'title' => 'Written Ministerial Statements'); |
|
57 | 57 | } |
58 | 58 | return $sections; |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | # speech bar the first (assuming that's the question) |
63 | 63 | private $votelinks_so_far = 0; |
64 | 64 | |
65 | - protected function generate_votes ($votes, $id, $gid) { |
|
65 | + protected function generate_votes($votes, $id, $gid) { |
|
66 | 66 | /* |
67 | 67 | Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar. |
68 | 68 | $votes = => array ( |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | if ($last_postcode == $postcode) { |
41 | 41 | $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value; |
42 | - twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value )); |
|
42 | + twfy_debug ("TIME", "postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value )); |
|
43 | 43 | return $return_value; |
44 | 44 | } |
45 | 45 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if ($last_postcode == $postcode) { |
41 | 41 | $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value; |
42 | - twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value )); |
|
42 | + twfy_debug("TIME", "Postcode $postcode looked up last time, is " . (is_array($return_value) ? implode(', ', $return_value) : $return_value)); |
|
43 | 43 | return $return_value; |
44 | 44 | } |
45 | 45 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $name = $q['name']; |
76 | 76 | if (self::postcodeIsScottish($postcode)) { |
77 | 77 | $name = explode('|', $name); |
78 | - if (count($name)==3) |
|
78 | + if (count($name) == 3) |
|
79 | 79 | return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]); |
80 | 80 | } elseif (self::postcodeIsNi($postcode)) { |
81 | 81 | $name = explode('|', $name); |
82 | - if (count($name)==2) |
|
82 | + if (count($name) == 2) |
|
83 | 83 | return array('WMC' => $name[0], 'NIE' => $name[1]); |
84 | 84 | } else { |
85 | 85 | return array('WMC' => $name); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $r = json_decode($file, true); |
115 | 115 | if (!$r) { |
116 | - trigger_error("Postcode database is not working. Content:\n".$file.", request: ". $filename, E_USER_WARNING); |
|
116 | + trigger_error("Postcode database is not working. Content:\n" . $file . ", request: " . $filename, E_USER_WARNING); |
|
117 | 117 | return ''; |
118 | 118 | } |
119 | 119 | if (isset($r['error']) || !isset($r['areas'])) { |
@@ -179,29 +179,29 @@ discard block |
||
179 | 179 | if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) |
180 | 180 | return true; |
181 | 181 | |
182 | - if ($m[1]=='DG') { |
|
183 | - if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England |
|
182 | + if ($m[1] == 'DG') { |
|
183 | + if ($m[2] == 16 && $m[3] == 5 && in_array($m[4], array('HT', 'HU', 'HZ', 'JA', 'JB'))) return false; # A few postcodes in England |
|
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | |
187 | 187 | # Damn postcodes crossing country boundaries |
188 | - if ($m[1]=='TD') { |
|
189 | - if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland |
|
190 | - if ($m[2]==9) { |
|
191 | - if ($m[3]!=0) return true; # TD9 1-9 all in Scotland |
|
192 | - if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland |
|
188 | + if ($m[1] == 'TD') { |
|
189 | + if ($m[2] != 15 && $m[2] != 12 && $m[2] != 9) return true; # TD1-8, 10-11, 13-14 all in Scotland |
|
190 | + if ($m[2] == 9) { |
|
191 | + if ($m[3] != 0) return true; # TD9 1-9 all in Scotland |
|
192 | + if (!in_array($m[4], array('TJ', 'TP', 'TR', 'TS', 'TT', 'TU', 'TW'))) return true; # Nearly all of TD9 0 in Scotland |
|
193 | 193 | } |
194 | 194 | $m[5] = substr($m[4], 0, 1); |
195 | - if ($m[2]==12) { # $m[3] will be 4 currently. |
|
196 | - if ($m[4]=='XE') return true; |
|
197 | - if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
195 | + if ($m[2] == 12) { # $m[3] will be 4 currently. |
|
196 | + if ($m[4] == 'XE') return true; |
|
197 | + if (in_array($m[5], array('A', 'B', 'D', 'E', 'H', 'J', 'L', 'N', 'W', 'Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
198 | 198 | } |
199 | 199 | # TD15 is mostly England |
200 | - if ($m[2]==15) { |
|
201 | - if ($m[3]!=1) return false; # TD15 2 and 9 are in England |
|
202 | - if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true; |
|
203 | - if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland |
|
204 | - if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
200 | + if ($m[2] == 15) { |
|
201 | + if ($m[3] != 1) return false; # TD15 2 and 9 are in England |
|
202 | + if (in_array($m[4], array('BT', 'SU', 'SZ', 'UF', 'UG', 'UH', 'UJ', 'UL', 'US', 'UZ', 'WY', 'WZ'))) return true; |
|
203 | + if ($m[5] == 'T' && $m[4] != 'TA' && $m[4] != 'TB') return true; # Most of TD15 1T* in Scotland |
|
204 | + if ($m[5] == 'X' && $m[4] != 'XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | $ret = self::postcodeFetchFromMapit($postcode); |
53 | 53 | } |
54 | 54 | |
55 | - if (is_string($ret)) return $ret; |
|
55 | + if (is_string($ret)) { |
|
56 | + return $ret; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $last_postcode = $postcode; |
58 | 60 | $last_postcode_value = $ret; |
@@ -75,12 +77,14 @@ discard block |
||
75 | 77 | $name = $q['name']; |
76 | 78 | if (self::postcodeIsScottish($postcode)) { |
77 | 79 | $name = explode('|', $name); |
78 | - if (count($name)==3) |
|
79 | - return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]); |
|
80 | + if (count($name)==3) { |
|
81 | + return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]); |
|
82 | + } |
|
80 | 83 | } elseif (self::postcodeIsNi($postcode)) { |
81 | 84 | $name = explode('|', $name); |
82 | - if (count($name)==2) |
|
83 | - return array('WMC' => $name[0], 'NIE' => $name[1]); |
|
85 | + if (count($name)==2) { |
|
86 | + return array('WMC' => $name[0], 'NIE' => $name[1]); |
|
87 | + } |
|
84 | 88 | } else { |
85 | 89 | return array('WMC' => $name); |
86 | 90 | } |
@@ -121,8 +125,9 @@ discard block |
||
121 | 125 | } |
122 | 126 | $areas = array(); |
123 | 127 | foreach ($r['areas'] as $row) { |
124 | - if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE'))) |
|
125 | - $areas[$row['type']] = $row['name']; |
|
128 | + if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE'))) { |
|
129 | + $areas[$row['type']] = $row['name']; |
|
130 | + } |
|
126 | 131 | } |
127 | 132 | |
128 | 133 | if (!isset($areas['WMC'])) { |
@@ -172,36 +177,67 @@ discard block |
||
172 | 177 | */ |
173 | 178 | |
174 | 179 | public static function postcodeIsScottish($pc) { |
175 | - if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m)) |
|
176 | - return false; |
|
180 | + if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m)) { |
|
181 | + return false; |
|
182 | + } |
|
177 | 183 | |
178 | 184 | # Check for Scottish postal areas |
179 | - if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) |
|
180 | - return true; |
|
185 | + if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) { |
|
186 | + return true; |
|
187 | + } |
|
181 | 188 | |
182 | 189 | if ($m[1]=='DG') { |
183 | - if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England |
|
190 | + if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) { |
|
191 | + return false; |
|
192 | + } |
|
193 | + # A few postcodes in England |
|
184 | 194 | return true; |
185 | 195 | } |
186 | 196 | |
187 | 197 | # Damn postcodes crossing country boundaries |
188 | 198 | if ($m[1]=='TD') { |
189 | - if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland |
|
199 | + if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) { |
|
200 | + return true; |
|
201 | + } |
|
202 | + # TD1-8, 10-11, 13-14 all in Scotland |
|
190 | 203 | if ($m[2]==9) { |
191 | - if ($m[3]!=0) return true; # TD9 1-9 all in Scotland |
|
192 | - if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland |
|
204 | + if ($m[3]!=0) { |
|
205 | + return true; |
|
206 | + } |
|
207 | + # TD9 1-9 all in Scotland |
|
208 | + if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) { |
|
209 | + return true; |
|
210 | + } |
|
211 | + # Nearly all of TD9 0 in Scotland |
|
193 | 212 | } |
194 | 213 | $m[5] = substr($m[4], 0, 1); |
195 | - if ($m[2]==12) { # $m[3] will be 4 currently. |
|
196 | - if ($m[4]=='XE') return true; |
|
197 | - if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
214 | + if ($m[2]==12) { |
|
215 | +# $m[3] will be 4 currently. |
|
216 | + if ($m[4]=='XE') { |
|
217 | + return true; |
|
218 | + } |
|
219 | + if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) { |
|
220 | + return true; |
|
221 | + } |
|
222 | + # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
198 | 223 | } |
199 | 224 | # TD15 is mostly England |
200 | 225 | if ($m[2]==15) { |
201 | - if ($m[3]!=1) return false; # TD15 2 and 9 are in England |
|
202 | - if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true; |
|
203 | - if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland |
|
204 | - if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
226 | + if ($m[3]!=1) { |
|
227 | + return false; |
|
228 | + } |
|
229 | + # TD15 2 and 9 are in England |
|
230 | + if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) { |
|
231 | + return true; |
|
232 | + } |
|
233 | + if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') { |
|
234 | + return true; |
|
235 | + } |
|
236 | + # Most of TD15 1T* in Scotland |
|
237 | + if ($m[5]=='X' && $m[4]!='XX') { |
|
238 | + return true; |
|
239 | + } |
|
240 | + # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
205 | 241 | } |
206 | 242 | } |
207 | 243 | |
@@ -215,8 +251,9 @@ discard block |
||
215 | 251 | |
216 | 252 | public static function postcodeIsNi($pc) { |
217 | 253 | $prefix = substr(self::canonicalisePostcode($pc), 0, 2); |
218 | - if ($prefix == 'BT') |
|
219 | - return true; |
|
254 | + if ($prefix == 'BT') { |
|
255 | + return true; |
|
256 | + } |
|
220 | 257 | return false; |
221 | 258 | } |
222 | 259 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } elseif ($this->session) { |
66 | 66 | # Display the bills for a particular session |
67 | 67 | $this_page = 'pbc_session'; |
68 | - $DATA->set_page_metadata($this_page, 'title', "Session $this->session"); |
|
68 | + $DATA->set_page_metadata($this_page, 'title', "session $this->session"); |
|
69 | 69 | $args = array ( |
70 | 70 | 'session' => $this->session, |
71 | 71 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } elseif ($bill_id) { |
48 | 48 | # Display the page for a particular bill |
49 | 49 | $this_page = 'pbc_bill'; |
50 | - $args = array ( |
|
50 | + $args = array( |
|
51 | 51 | 'id' => $bill_id, |
52 | 52 | 'title' => $this->bill, |
53 | 53 | 'session' => $this->session, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | # Display the bills for a particular session |
67 | 67 | $this_page = 'pbc_session'; |
68 | 68 | $DATA->set_page_metadata($this_page, 'title', "Session $this->session"); |
69 | - $args = array ( |
|
69 | + $args = array( |
|
70 | 70 | 'session' => $this->session, |
71 | 71 | ); |
72 | 72 | $data = array(); |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function getSearchSections() { |
90 | 90 | return array( |
91 | - array( 'section' => 'pbc' ) |
|
91 | + array('section' => 'pbc') |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function front_content() { |
96 | - return $this->list->display( 'recent_pbc_debates', array( 'num' => 50 ), 'none' ); |
|
96 | + return $this->list->display('recent_pbc_debates', array('num' => 50), 'none'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | protected function display_front() { |
@@ -512,7 +512,7 @@ |
||
512 | 512 | if ($row['totalcomments'] > 1) { |
513 | 513 | $morecount = $row['totalcomments'] - 1; |
514 | 514 | $plural = $morecount == 1 ? 'annotation' : 'annotations'; |
515 | - $linktext = "Read $morecount more $plural"; |
|
515 | + $linktext = "read $morecount more $plural"; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | } else { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $data = $this->addCommonData($data); |
33 | 33 | } elseif ($date = get_http_var('d')) { |
34 | 34 | $data = $this->display_day($date); |
35 | - if ( !isset($data['template']) ) { |
|
35 | + if (!isset($data['template'])) { |
|
36 | 36 | $data['template'] = 'section/day'; |
37 | 37 | } |
38 | 38 | $data = $this->addCommonData($data); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $data = $this->display_section_or_speech(); |
41 | 41 | } else { |
42 | 42 | $data = $this->display_front(); |
43 | - if ( !isset($data['template']) ) { |
|
43 | + if (!isset($data['template'])) { |
|
44 | 44 | $data['template'] = 'section/recent'; |
45 | 45 | } |
46 | 46 | $data['search_sections'] = $this->getSearchSections(); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | $data['recess_major'] = $this->getRecessMajor(); |
60 | 60 | |
61 | 61 | $nextprev = $DATA->page_metadata($this_page, 'nextprev'); |
62 | - if ( isset($nextprev['next']['url']) ) { |
|
62 | + if (isset($nextprev['next']['url'])) { |
|
63 | 63 | $data['next'] = $nextprev['next']; |
64 | 64 | } |
65 | - if ( isset($nextprev['prev']['url']) ) { |
|
65 | + if (isset($nextprev['prev']['url'])) { |
|
66 | 66 | $data['prev'] = $nextprev['prev']; |
67 | 67 | } |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (!isset($data['title']) && $parent_page != '') { |
72 | 72 | $data['title'] = $DATA->page_metadata($parent_page, 'title'); |
73 | 73 | } |
74 | - if ( $parent_page ) { |
|
74 | + if ($parent_page) { |
|
75 | 75 | $data['parent_title'] = $DATA->page_metadata($parent_page, 'title'); |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $urls = array_merge($urls, $this->getViewUrls()); |
89 | 89 | |
90 | - if ( isset($data['info']['page']) ) { |
|
90 | + if (isset($data['info']['page'])) { |
|
91 | 91 | $day = new \MySociety\TheyWorkForYou\Url($data['info']['page']); |
92 | 92 | $urls['day'] = $day; |
93 | 93 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $DATA->set_page_metadata($this_page, 'title', $year); |
134 | 134 | } |
135 | 135 | |
136 | - $args = array ( 'year' => $year ); |
|
136 | + $args = array('year' => $year); |
|
137 | 137 | $data = $this->list->display('calendar', $args, 'none'); |
138 | 138 | return $data; |
139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function display_column($date, $column) { |
142 | 142 | global $this_page; |
143 | 143 | $this_page = $this->page_base; |
144 | - $args = array( 'date' => $date, 'column' => $column ); |
|
144 | + $args = array('date' => $date, 'column' => $column); |
|
145 | 145 | $content = $this->list->display('column', $args, 'none'); |
146 | 146 | |
147 | 147 | $data = array(); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | protected function display_day($date) { |
167 | 167 | global $this_page; |
168 | 168 | $this_page = $this->page_base . 'day'; |
169 | - $args = array ( 'date' => get_http_var('d') ); |
|
169 | + $args = array('date' => get_http_var('d')); |
|
170 | 170 | $data = $this->list->display('date', $args, 'none'); |
171 | 171 | list($year, $month, $day) = explode('-', $date); |
172 | - $args = array( 'year' => $year, 'month' => $month, 'day' => $day); |
|
172 | + $args = array('year' => $year, 'month' => $month, 'day' => $day); |
|
173 | 173 | $calendar = $this->list->display('calendar', $args, 'none'); |
174 | - if ( isset($calendar['years']) ) { |
|
174 | + if (isset($calendar['years'])) { |
|
175 | 175 | $data['calendar'] = $calendar['years']; |
176 | 176 | } |
177 | 177 | return $data; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | global $DATA, $this_page, $THEUSER; |
182 | 182 | |
183 | 183 | # += as we *don't* want to override any already supplied argument |
184 | - $args += array ( |
|
184 | + $args += array( |
|
185 | 185 | 'gid' => get_http_var('id'), |
186 | 186 | 's' => get_http_var('s'), // Search terms to be highlighted. |
187 | 187 | 'member_id' => get_http_var('m'), // Member's speeches to be highlighted. |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | if ($this->major == 6) { |
199 | 199 | # Magically (as in I can't remember quite why), pbc_clause will |
200 | 200 | # contain the new URL without any change... |
201 | - $URL->remove( array('id') ); |
|
201 | + $URL->remove(array('id')); |
|
202 | 202 | } else { |
203 | - $URL->insert( array('id'=>$e->getMessage()) ); |
|
203 | + $URL->insert(array('id'=>$e->getMessage())); |
|
204 | 204 | } |
205 | 205 | # put the search term back in so highlighting works. |
206 | 206 | # NB: as we don't see the # part of the URL we lose this :( |
207 | - if ( $args['s'] !== '' ) { |
|
208 | - $URL->insert( array('s'=>$args['s']) ); |
|
207 | + if ($args['s'] !== '') { |
|
208 | + $URL->insert(array('s'=>$args['s'])); |
|
209 | 209 | } |
210 | 210 | redirect($URL->generate('none'), 301); |
211 | 211 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (array_key_exists('text_heading', $data['info'])) { |
281 | 281 | // avoid having Clause 1 etc as the alert text search string on PBC pages as it's |
282 | 282 | // almost certainly not what the person wants |
283 | - if ( $this->major == 6 ) { |
|
283 | + if ($this->major == 6) { |
|
284 | 284 | $data['email_alert_text'] = $data['section_title']; |
285 | 285 | } else { |
286 | 286 | $data['email_alert_text'] = $data['info']['text_heading']; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $body = preg_replace('#<phrase class="honfriend" id="uk.org.publicwhip/member/(\d+)" name="([^"]*?)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?m=$1" title="Our page on $2 - \'$3\'">$4</a>', $body); |
328 | 328 | $body = preg_replace('#<phrase class="honfriend" name="([^"]*?)" person_id="uk.org.publicwhip/person/(\d+)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?p=$2" title="Our page on $1 - \'$3\'">$4</a>', $body); |
329 | 329 | $body = preg_replace_callback('#<phrase class="offrep" id="(.*?)/(\d+)-(\d+)-(\d+)\.(.*?)">(.*?)</phrase>#', function($matches) { |
330 | - return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] .'">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>'; |
|
330 | + return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] . '">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>'; |
|
331 | 331 | }, $body); |
332 | 332 | #$body = preg_replace('#<phrase class="offrep" id="((.*?)/(\d+)-(\d+)-(\d+)\.(.*?))">(.*?)</phrase>#e', "\"<a href='/search/?pop=1&s=date:$3$4$5+column:$6+section:$2&match=$1'>\" . str_replace('Official Report', 'Hansard', '$7') . '</a>'", $body); |
333 | 333 | $bodies[] = $body; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $data['section_title'] = ''; |
361 | 361 | $subsection_title = ''; |
362 | 362 | $rows = count($data['rows']); |
363 | - for ($i=0; $i<$rows; $i++) { |
|
363 | + for ($i = 0; $i < $rows; $i++) { |
|
364 | 364 | $row = $data['rows'][$i]; |
365 | 365 | $htype = $row['htype']; |
366 | 366 | // HPOS should be defined below if it's needed; otherwise default to 0 |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | # Voting links |
384 | 384 | $data['rows'][$i]['voting_data'] = ''; |
385 | 385 | if (isset($row['votes'])) { |
386 | - $data['rows'][$i]['voting_data'] = $this->generate_votes( $row['votes'], $row['epobject_id'], $row['gid'] ); |
|
386 | + $data['rows'][$i]['voting_data'] = $this->generate_votes($row['votes'], $row['epobject_id'], $row['gid']); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | # Annotation link |
@@ -424,52 +424,52 @@ discard block |
||
424 | 424 | |
425 | 425 | private function getCountryDetails() { |
426 | 426 | $details = array( |
427 | - 1 => array ( |
|
427 | + 1 => array( |
|
428 | 428 | 'country' => 'UK', |
429 | 429 | 'assembly' => 'uk-commons', |
430 | 430 | 'location' => '– in the House of Commons' |
431 | 431 | ), |
432 | - 2 => array ( |
|
432 | + 2 => array( |
|
433 | 433 | 'country' => 'UK', |
434 | 434 | 'assembly' => 'uk-commons', |
435 | 435 | 'location' => '– in Westminster Hall' |
436 | 436 | ), |
437 | - 3 => array ( |
|
437 | + 3 => array( |
|
438 | 438 | 'country' => 'UK', |
439 | 439 | 'assembly' => 'uk-commons', |
440 | 440 | 'location' => 'written question – answered' |
441 | 441 | ), |
442 | - 4 => array ( |
|
442 | + 4 => array( |
|
443 | 443 | 'country' => 'UK', |
444 | 444 | 'assembly' => 'uk-commons', |
445 | 445 | 'location' => 'written statement – made' |
446 | 446 | ), |
447 | - 5 => array ( |
|
447 | + 5 => array( |
|
448 | 448 | 'country' => 'NORTHERN IRELAND', |
449 | 449 | 'assembly' => 'ni', |
450 | 450 | 'location' => '– in the Northern Ireland Assembly' |
451 | 451 | ), |
452 | - 6 => array ( |
|
452 | + 6 => array( |
|
453 | 453 | 'country' => 'UK', |
454 | 454 | 'assembly' => 'uk-commons', |
455 | 455 | 'location' => '– in a Public Bill Committee' |
456 | 456 | ), |
457 | - 7 => array ( |
|
457 | + 7 => array( |
|
458 | 458 | 'country' => 'SCOTLAND', |
459 | 459 | 'assembly' => 'scotland', |
460 | 460 | 'location' => '– in the Scottish Parliament' |
461 | 461 | ), |
462 | - 8 => array ( |
|
462 | + 8 => array( |
|
463 | 463 | 'country' => 'SCOTLAND', |
464 | 464 | 'assembly' => 'scotland', |
465 | 465 | 'location' => '– Scottish Parliament written question – answered' |
466 | 466 | ), |
467 | - 9 => array ( |
|
467 | + 9 => array( |
|
468 | 468 | 'country' => 'LONDON', |
469 | 469 | 'assembly' => 'london-assembly', |
470 | 470 | 'location' => 'Questions to the Mayor of London – answered' |
471 | 471 | ), |
472 | - 101 => array ( |
|
472 | + 101 => array( |
|
473 | 473 | 'country' => 'UK', |
474 | 474 | 'assembly' => 'uk-lords', |
475 | 475 | 'location' => '– in the House of Lords' |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | global $DATA, $this_page; |
501 | 501 | $this_page = $this->page_base . 'front'; |
502 | 502 | $data = array(); |
503 | - if ( $this->index_template ) { |
|
503 | + if ($this->index_template) { |
|
504 | 504 | $data['template'] = $this->index_template; |
505 | 505 | } |
506 | 506 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | |
511 | 511 | $content['calendar'] = $class->display('calendar', array('months' => 1), 'none'); |
512 | 512 | |
513 | - if ( $rssurl = $DATA->page_metadata($this_page, 'rss') ) { |
|
513 | + if ($rssurl = $DATA->page_metadata($this_page, 'rss')) { |
|
514 | 514 | $content['rssurl'] = $rssurl; |
515 | 515 | } |
516 | 516 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | //$totalcomments, $comment, $commenturl |
528 | - function generate_commentteaser ($row) { |
|
528 | + function generate_commentteaser($row) { |
|
529 | 529 | // Returns HTML for the one fragment of comment and link for the sidebar. |
530 | 530 | // $totalcomments is the number of comments this item has on it. |
531 | 531 | // $comment is an array like: |
@@ -24,7 +24,7 @@ |
||
24 | 24 | </form> |
25 | 25 | </div> |
26 | 26 | <!-- TheyWorkForYou box, end --> |
27 | -END; |
|
27 | +end; |
|
28 | 28 | print $link_to_us_form; |
29 | 29 | ?> |
30 | 30 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | <div class="row nested-row"> |
42 | 42 | <div class="homepage-in-the-news homepage-content-section"> |
43 | 43 | <?php if ( $featured ) { |
44 | - include dirname(__FILE__) . "/../homepage/featured.php"; |
|
44 | + include dirname(__FILE__) . "/../homepage/featured.php"; |
|
45 | 45 | } ?> |
46 | 46 | </div> |
47 | 47 | <div class="homepage-create-alert homepage-content-section"> |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | </div> |
12 | 12 | <div class="row"> |
13 | 13 | <div class="medium-9 columns"> |
14 | - <?php if ( count($data['regional']) > 0 ) { ?> |
|
14 | + <?php if (count($data['regional']) > 0) { ?> |
|
15 | 15 | <ul class="homepage-rep-list"> |
16 | 16 | <li>Your Regional MSPs:</li> |
17 | - <?php foreach ( $data['regional'] as $msp ) { ?> |
|
17 | + <?php foreach ($data['regional'] as $msp) { ?> |
|
18 | 18 | <li class="homepage-rep-list__rep"><a href="/msp/?p=<?= $msp['person_id'] ?>"><?= $msp['name'] ?></a></li> |
19 | 19 | <?php } ?> |
20 | 20 | </ul> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | <div class="panel panel--flushtop clearfix"> |
58 | 58 | <div class="row nested-row"> |
59 | 59 | <div class="homepage-in-the-news homepage-content-section"> |
60 | - <?php if ( $featured ) { |
|
60 | + <?php if ($featured) { |
|
61 | 61 | include dirname(__FILE__) . "/../homepage/featured.php"; |
62 | 62 | } ?> |
63 | 63 | </div> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | <h2>Recently in Parliament</h2> |
106 | 106 | <ul class="recently__list"><?php |
107 | - foreach ( $debates['recent'] as $recent ) { |
|
107 | + foreach ($debates['recent'] as $recent) { |
|
108 | 108 | include dirname(__FILE__) . '/../homepage/recent-debates.php'; |
109 | 109 | } |
110 | 110 | ?></ul> |
@@ -157,7 +157,7 @@ |
||
157 | 157 | <?php # XXX |
158 | 158 | if ($data['info']['major'] == 8 && preg_match('#\d{4}-\d\d-\d\d\.(.*?)\.q#', $speech['gid'], $m)) { |
159 | 159 | ?><p class="debate-speech__question_id"><small> |
160 | - <?= "Question $m[1]" ?> |
|
160 | + <?= "question $m[1]" ?> |
|
161 | 161 | </small></p> |
162 | 162 | <?php } ?> |
163 | 163 | </h2> |
@@ -186,7 +186,8 @@ |
||
186 | 186 | } # End of voting HTML |
187 | 187 | |
188 | 188 | // Video |
189 | - if ($data['info']['major'] == 1 && !$individual_item) { # Commons debates only |
|
189 | + if ($data['info']['major'] == 1 && !$individual_item) { |
|
190 | +# Commons debates only |
|
190 | 191 | if ($speech['video_status']&4) { ?> |
191 | 192 | <a href="<?= $speech['commentsurl'] ?>" class="watch debate-speech__meta__link" onclick="return moveVideo(\'debate/'<?= $speech['gid'] ?>\');">Watch this</a> |
192 | 193 | <?php |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | if ($hansardmajors[$data['info']['major']]['location'] == 'Scotland') { |
13 | 13 | $body = preg_replace('# (S\d[O0WF]-\d+)[, ]#', ' <a href="/spwrans/?spid=$1">$1</a> ', $body); |
14 | 14 | $body = preg_replace_callback('#<citation id="uk\.org\.publicwhip/(.*?)/(.*?)">\[(.*?)\]</citation>#', function($matches) { |
15 | - if ($matches[1] == 'spor') { |
|
16 | - $href_segment = 'sp/?g'; |
|
17 | - } elseif ($matches[1] == 'spwa') { |
|
15 | + if ($matches[1] == 'spor') { |
|
16 | + $href_segment = 'sp/?g'; |
|
17 | + } elseif ($matches[1] == 'spwa') { |
|
18 | 18 | $href_segment = 'spwrans/?'; |
19 | 19 | } else { |
20 | 20 | $href_segment = 'debates/?'; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $after_mp = $speech['after_mp']; |
192 | 192 | } |
193 | 193 | include dirname(__FILE__) . '/../divisions/_your_mp.php'; |
194 | - } ?> |
|
194 | + } ?> |
|
195 | 195 | <div class="debate-speech__division__details"> |
196 | 196 | <?php include dirname(__FILE__) . '/../divisions/_votes.php'; ?> |
197 | 197 | </div> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -foreach($data['rows'] as $speech) { ?> |
|
3 | +foreach ($data['rows'] as $speech) { ?> |
|
4 | 4 | |
5 | 5 | <?php |
6 | 6 | |
@@ -63,27 +63,27 @@ discard block |
||
63 | 63 | $source = array(); |
64 | 64 | |
65 | 65 | $major = $data['info']['major']; |
66 | - if ($major==1 || $major==2 || (($major==3 || $major==4) && isset($speech['speaker']['house'])) || $major==101 || $major==6) { |
|
66 | + if ($major == 1 || $major == 2 || (($major == 3 || $major == 4) && isset($speech['speaker']['house'])) || $major == 101 || $major == 6) { |
|
67 | 67 | $source['title'] = 'Citation: '; |
68 | - if ($major==1 || $major==2) { |
|
68 | + if ($major == 1 || $major == 2) { |
|
69 | 69 | $source['title'] .= 'HC'; |
70 | - } elseif ($major==3 || $major==4) { |
|
71 | - if ($speech['speaker']['house']==1) { |
|
70 | + } elseif ($major == 3 || $major == 4) { |
|
71 | + if ($speech['speaker']['house'] == 1) { |
|
72 | 72 | $source['title'] .= 'HC'; |
73 | 73 | } else { |
74 | 74 | $source['title'] .= 'HL'; |
75 | 75 | } |
76 | - } elseif ($major==6) { |
|
76 | + } elseif ($major == 6) { |
|
77 | 77 | $source['title'] .= $data['section_title']; |
78 | 78 | } else { |
79 | 79 | $source['title'] .= 'HL'; |
80 | 80 | } |
81 | 81 | $source['title'] .= ' Deb, ' . format_date($data['info']['date'], LONGDATEFORMAT) . ', c' . $speech['colnum']; |
82 | - if ($major==2) { |
|
82 | + if ($major == 2) { |
|
83 | 83 | $source['title'] .= 'WH'; |
84 | - } elseif ($major==3) { |
|
84 | + } elseif ($major == 3) { |
|
85 | 85 | $source['title'] .= 'W'; |
86 | - } elseif ($major==4) { |
|
86 | + } elseif ($major == 4) { |
|
87 | 87 | $source['title'] .= 'WS'; |
88 | 88 | } |
89 | 89 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | <div class="debate-speech__speaker-and-content"> |
115 | 115 | <?php } ?> |
116 | 116 | |
117 | - <?php if(isset($speech['speaker']) && count($speech['speaker']) > 0) { ?> |
|
117 | + <?php if (isset($speech['speaker']) && count($speech['speaker']) > 0) { ?> |
|
118 | 118 | <h2 class="debate-speech__speaker"> |
119 | 119 | <?php |
120 | 120 | |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | <?php if ($division['has_description']) { ?> |
182 | 182 | <div class="debate-speech__division__details"> |
183 | 183 | <span class="policy-vote__text"> |
184 | - <?php include( dirname(__FILE__) . '/../divisions/_vote_description.php'); ?> |
|
184 | + <?php include(dirname(__FILE__) . '/../divisions/_vote_description.php'); ?> |
|
185 | 185 | </span><br> |
186 | 186 | </div> |
187 | 187 | <?php } ?> |
188 | 188 | |
189 | 189 | <?php if (isset($speech['mp_vote'])) { |
190 | - $mp_vote = array( 'vote' => $speech['mp_vote']['vote'] ); |
|
191 | - if ( isset($speech['before_mp']) ) { |
|
190 | + $mp_vote = array('vote' => $speech['mp_vote']['vote']); |
|
191 | + if (isset($speech['before_mp'])) { |
|
192 | 192 | $before_mp = $speech['before_mp']; |
193 | 193 | } |
194 | - if ( isset($speech['after_mp']) ) { |
|
194 | + if (isset($speech['after_mp'])) { |
|
195 | 195 | $after_mp = $speech['after_mp']; |
196 | 196 | } |
197 | 197 | include dirname(__FILE__) . '/../divisions/_your_mp.php'; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | <div class="debate-speech__content"><?=$body ?></div> |
204 | 204 | <?php } ?> |
205 | 205 | |
206 | - <?php if ( $section ) { |
|
206 | + <?php if ($section) { |
|
207 | 207 | if ($speech['voting_data']) { ?> |
208 | 208 | |
209 | 209 | <div class="debate-speech__question-answered"> |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $moreinfo[] = $row['totalcomments'] . " $plural"; |
362 | 362 | } |
363 | 363 | if (count($moreinfo) > 0) { |
364 | - print "<small>(" . implode (', ', $moreinfo) . ") </small>"; |
|
364 | + print "<small>(" . implode(', ', $moreinfo) . ") </small>"; |
|
365 | 365 | } |
366 | 366 | } else { |
367 | 367 | // Nothing in this item, so no link. |
@@ -34,6 +34,6 @@ |
||
34 | 34 | </div> |
35 | 35 | </div> |
36 | 36 | |
37 | - <?php $search_title = "Search $title"; include '_search.php'; ?> |
|
37 | + <?php $search_title = "search $title"; include '_search.php'; ?> |
|
38 | 38 | |
39 | 39 | </div> |