@@ -70,7 +70,7 @@ |
||
70 | 70 | if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') { |
71 | 71 | $output .= 'before '; |
72 | 72 | } |
73 | - $output .= format_date($this->from_date,SHORTDATEFORMAT) . ' '; |
|
73 | + $output .= format_date($this->from_date, SHORTDATEFORMAT) . ' '; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $output .= 'to '; |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | |
44 | 44 | try { |
45 | 45 | $accessToken = $helper->getAccessToken(); |
46 | - } catch(\Facebook\Exceptions\FacebookResponseException $e) { |
|
46 | + } catch (\Facebook\Exceptions\FacebookResponseException $e) { |
|
47 | 47 | $data['error'] = 'Graph returned an error: ' . $e->getMessage(); |
48 | 48 | return $data; |
49 | - } catch(\Facebook\Exceptions\FacebookSDKException $e) { |
|
49 | + } catch (\Facebook\Exceptions\FacebookSDKException $e) { |
|
50 | 50 | $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage(); |
51 | 51 | return $data; |
52 | 52 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return false; |
68 | 68 | } |
69 | 69 | |
70 | - if (! $accessToken->isLongLived()) { |
|
70 | + if (!$accessToken->isLongLived()) { |
|
71 | 71 | $oAuth2Client = $this->getFacebookObject()->getOAuth2Client(); |
72 | 72 | try { |
73 | 73 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
@@ -145,59 +145,59 @@ |
||
145 | 145 | |
146 | 146 | public static function antiTagInTag($content = '', $format = 'htmlhead') |
147 | 147 | { |
148 | - $tagend = -1; |
|
149 | - for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
148 | + $tagend = -1; |
|
149 | + for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
150 | 150 | { |
151 | - // got the start of a tag. Now find the proper end! |
|
152 | - $walker = $tagstart + 1; |
|
153 | - $open = 1; |
|
154 | - while( $open != 0 && $walker < strlen( $content ) ) |
|
151 | + // got the start of a tag. Now find the proper end! |
|
152 | + $walker = $tagstart + 1; |
|
153 | + $open = 1; |
|
154 | + while( $open != 0 && $walker < strlen( $content ) ) |
|
155 | 155 | { |
156 | - $nextopen = strpos( $content, '<', $walker ); |
|
157 | - $nextclose = strpos( $content, '>', $walker ); |
|
158 | - if( $nextclose === false ) { |
|
159 | - // ERROR! Open waka without close waka! |
|
160 | - // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
|
161 | - return $content; |
|
162 | - } |
|
163 | - if( $nextopen === false || $nextopen > $nextclose ) { |
|
164 | - // No more opens, but there was a close; or, a close happens before the next open. |
|
165 | - // walker goes to the close+1, and open decrements |
|
166 | - $open --; |
|
167 | - $walker = $nextclose + 1; |
|
168 | - } elseif( $nextopen < $nextclose ) { |
|
169 | - // an open before the next close |
|
170 | - $open ++; |
|
171 | - $walker = $nextopen + 1; |
|
172 | - } |
|
156 | + $nextopen = strpos( $content, '<', $walker ); |
|
157 | + $nextclose = strpos( $content, '>', $walker ); |
|
158 | + if( $nextclose === false ) { |
|
159 | + // ERROR! Open waka without close waka! |
|
160 | + // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
|
161 | + return $content; |
|
162 | + } |
|
163 | + if( $nextopen === false || $nextopen > $nextclose ) { |
|
164 | + // No more opens, but there was a close; or, a close happens before the next open. |
|
165 | + // walker goes to the close+1, and open decrements |
|
166 | + $open --; |
|
167 | + $walker = $nextclose + 1; |
|
168 | + } elseif( $nextopen < $nextclose ) { |
|
169 | + // an open before the next close |
|
170 | + $open ++; |
|
171 | + $walker = $nextopen + 1; |
|
172 | + } |
|
173 | 173 | } |
174 | - $tagend = $walker; |
|
175 | - if( $tagend > strlen( $content ) ) { |
|
176 | - $tagend = strlen( $content ); |
|
177 | - } else { |
|
178 | - $tagend --; |
|
179 | - $tagstart ++; |
|
180 | - } |
|
181 | - $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
182 | - $tags[] = '<' . $tag . '>'; |
|
183 | - |
|
184 | - if (function_exists('format_to_output')) { |
|
174 | + $tagend = $walker; |
|
175 | + if( $tagend > strlen( $content ) ) { |
|
176 | + $tagend = strlen( $content ); |
|
177 | + } else { |
|
178 | + $tagend --; |
|
179 | + $tagstart ++; |
|
180 | + } |
|
181 | + $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
182 | + $tags[] = '<' . $tag . '>'; |
|
183 | + |
|
184 | + if (function_exists('format_to_output')) { |
|
185 | 185 | $newtag = format_to_output($tag, $format); |
186 | - } else { |
|
186 | + } else { |
|
187 | 187 | $newtag = strip_tags($tag); |
188 | - } |
|
188 | + } |
|
189 | 189 | |
190 | - $newtags[] = '<' . $newtag . '>'; |
|
190 | + $newtags[] = '<' . $newtag . '>'; |
|
191 | 191 | |
192 | - if (function_exists('format_to_output')) { |
|
192 | + if (function_exists('format_to_output')) { |
|
193 | 193 | $newtag = format_to_output($tag, $format); |
194 | - } else { |
|
194 | + } else { |
|
195 | 195 | $newtag = strip_tags($tag); |
196 | - } |
|
196 | + } |
|
197 | + } |
|
198 | + if (isset($tags)&&isset($newtags)) { |
|
199 | + $content = str_replace($tags, $newtags, $content); |
|
197 | 200 | } |
198 | - if (isset($tags)&&isset($newtags)) { |
|
199 | - $content = str_replace($tags, $newtags, $content); |
|
200 | - } |
|
201 | 201 | |
202 | 202 | return $content; |
203 | 203 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | twfy_debug("WIKIPEDIA", "Matched '$phrase'"); |
115 | 115 | # 1 means only replace one match for phrase per paragraph |
116 | - $source = preg_replace ('{ |
|
116 | + $source = preg_replace('{ |
|
117 | 117 | \b(' . $phrase_re . ')\b # Match the phrase itself |
118 | 118 | (?! # Match as long as the following does *not* apply: |
119 | 119 | (?: # Match, possessively, as many strings of: |
@@ -146,39 +146,39 @@ discard block |
||
146 | 146 | public static function antiTagInTag($content = '', $format = 'htmlhead') |
147 | 147 | { |
148 | 148 | $tagend = -1; |
149 | - for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
149 | + for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) |
|
150 | 150 | { |
151 | 151 | // got the start of a tag. Now find the proper end! |
152 | 152 | $walker = $tagstart + 1; |
153 | 153 | $open = 1; |
154 | - while( $open != 0 && $walker < strlen( $content ) ) |
|
154 | + while ($open != 0 && $walker < strlen($content)) |
|
155 | 155 | { |
156 | - $nextopen = strpos( $content, '<', $walker ); |
|
157 | - $nextclose = strpos( $content, '>', $walker ); |
|
158 | - if( $nextclose === false ) { |
|
156 | + $nextopen = strpos($content, '<', $walker); |
|
157 | + $nextclose = strpos($content, '>', $walker); |
|
158 | + if ($nextclose === false) { |
|
159 | 159 | // ERROR! Open waka without close waka! |
160 | 160 | // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
161 | 161 | return $content; |
162 | 162 | } |
163 | - if( $nextopen === false || $nextopen > $nextclose ) { |
|
163 | + if ($nextopen === false || $nextopen > $nextclose) { |
|
164 | 164 | // No more opens, but there was a close; or, a close happens before the next open. |
165 | 165 | // walker goes to the close+1, and open decrements |
166 | - $open --; |
|
166 | + $open--; |
|
167 | 167 | $walker = $nextclose + 1; |
168 | - } elseif( $nextopen < $nextclose ) { |
|
168 | + } elseif ($nextopen < $nextclose) { |
|
169 | 169 | // an open before the next close |
170 | - $open ++; |
|
170 | + $open++; |
|
171 | 171 | $walker = $nextopen + 1; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | $tagend = $walker; |
175 | - if( $tagend > strlen( $content ) ) { |
|
176 | - $tagend = strlen( $content ); |
|
175 | + if ($tagend > strlen($content)) { |
|
176 | + $tagend = strlen($content); |
|
177 | 177 | } else { |
178 | - $tagend --; |
|
179 | - $tagstart ++; |
|
178 | + $tagend--; |
|
179 | + $tagstart++; |
|
180 | 180 | } |
181 | - $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
181 | + $tag = substr($content, $tagstart, $tagend - $tagstart); |
|
182 | 182 | $tags[] = '<' . $tag . '>'; |
183 | 183 | |
184 | 184 | if (function_exists('format_to_output')) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $newtag = strip_tags($tag); |
196 | 196 | } |
197 | 197 | } |
198 | - if (isset($tags)&&isset($newtags)) { |
|
198 | + if (isset($tags) && isset($newtags)) { |
|
199 | 199 | $content = str_replace($tags, $newtags, $content); |
200 | 200 | } |
201 | 201 |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept); |
90 | 90 | } |
91 | 91 | if (!isset($speakers[$pid]['name'])) { |
92 | - $speakers[$pid]['name'] = $full_name . ($house==1?' MP':''); |
|
92 | + $speakers[$pid]['name'] = $full_name . ($house == 1 ? ' MP' : ''); |
|
93 | 93 | } |
94 | - if ( !isset($speakers[$pid]['party']) && $party ) { |
|
94 | + if (!isset($speakers[$pid]['party']) && $party) { |
|
95 | 95 | $speakers[$pid]['party'] = $party; |
96 | 96 | } |
97 | 97 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Return query result from looking for MPs |
145 | 145 | */ |
146 | 146 | |
147 | - public static function searchMemberDbLookup($searchstring, $current_only=false) { |
|
147 | + public static function searchMemberDbLookup($searchstring, $current_only = false) { |
|
148 | 148 | if (!$searchstring) { |
149 | 149 | return array(); |
150 | 150 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | // And here we're assuming the user's put the names in the right order. |
159 | 159 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
160 | 160 | $params[':like_1'] = '%' . $searchwords[1] . '%'; |
161 | - $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%'; |
|
162 | - $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-'. $searchwords[1] . '%'; |
|
161 | + $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%'; |
|
162 | + $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-' . $searchwords[1] . '%'; |
|
163 | 163 | $where = "(given_name LIKE :like_0 AND family_name LIKE :like_1)"; |
164 | 164 | $where .= " OR (given_name LIKE :like_1 AND family_name LIKE :like_0)"; |
165 | 165 | $where .= " OR (title LIKE :like_0 AND family_name LIKE :like_1)"; |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
175 | 175 | $params[':like_1'] = '%' . $searchwords[1] . '%'; |
176 | 176 | $params[':like_2'] = '%' . $searchwords[2] . '%'; |
177 | - $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%'; |
|
178 | - $params[':like_1_and_2'] = '%' . $searchwords[1] . ' '. $searchwords[2] . '%'; |
|
179 | - $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-'. $searchwords[2] . '%'; |
|
177 | + $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%'; |
|
178 | + $params[':like_1_and_2'] = '%' . $searchwords[1] . ' ' . $searchwords[2] . '%'; |
|
179 | + $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-' . $searchwords[2] . '%'; |
|
180 | 180 | $where = "(given_name LIKE :like_0_and_1 AND family_name LIKE :like_2)"; |
181 | 181 | $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2)"; |
182 | 182 | $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2_hyphen)"; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | return array_unique($pids); |
206 | 206 | } |
207 | 207 | |
208 | - public static function searchMemberDbLookupWithNames($searchstring, $current_only=false) { |
|
208 | + public static function searchMemberDbLookupWithNames($searchstring, $current_only = false) { |
|
209 | 209 | $pids = self::searchMemberDbLookup($searchstring, $current_only); |
210 | 210 | |
211 | 211 | if (!count($pids)) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // Looks like a postcode - can we find the constituency? |
255 | 255 | $constituency = Postcode::postcodeToConstituency($searchterm); |
256 | 256 | if ($constituency) { |
257 | - return array( array($constituency), true ); |
|
257 | + return array(array($constituency), true); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $constituencies[] = $row['name']; |
273 | 273 | } |
274 | 274 | |
275 | - return array( $constituencies, false ); |
|
275 | + return array($constituencies, false); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $speakers = []; |
289 | 289 | |
290 | 290 | foreach ($criteria as $c) { |
291 | - if (preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
291 | + if (preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
292 | 292 | $MEMBER = new \MEMBER(array('person_id'=>$m[1])); |
293 | 293 | $speakers[$m[1]] = $MEMBER->full_name(); |
294 | 294 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | public static function speakerIDsToNames($searchstring) { |
308 | 308 | $speakers = self::speakerNamesForIDs($searchstring); |
309 | 309 | |
310 | - foreach ( $speakers as $id => $name ) { |
|
310 | + foreach ($speakers as $id => $name) { |
|
311 | 311 | $searchstring = str_replace('speaker:' . $id, "speaker:$name", $searchstring); |
312 | 312 | } |
313 | 313 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param int $limit The number of results to limit the output to. |
84 | 84 | */ |
85 | 85 | |
86 | - private function getMemberPolicyPositions ($limit = null) { |
|
86 | + private function getMemberPolicyPositions($limit = null) { |
|
87 | 87 | |
88 | 88 | // Make sure member info has actually been set. |
89 | 89 | if (count($this->member->extra_info) === 0) { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // don't return votes where they haven't voted on a strong division |
131 | 131 | // if we're limiting the number of votes |
132 | - if ( $limit && !empty($dream_info) && !$dream_info['has_strong'] ) { |
|
132 | + if ($limit && !empty($dream_info) && !$dream_info['has_strong']) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $has_strong = 1; |
209 | 209 | } |
210 | 210 | $full_sentence = $consistency . ' ' . $policy_description; |
211 | - $out = array( 'full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong ); |
|
211 | + $out = array('full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | return $out; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | # If not current MP/Lord, but current MLA/MSP, need to say voting record is when MP |
240 | 240 | if (!$current_member[HOUSE_TYPE_COMMONS] and |
241 | 241 | !$current_member[HOUSE_TYPE_LORDS] and |
242 | - ( $current_member[HOUSE_TYPE_SCOTLAND] or $current_member[HOUSE_TYPE_NI] ) |
|
242 | + ($current_member[HOUSE_TYPE_SCOTLAND] or $current_member[HOUSE_TYPE_NI]) |
|
243 | 243 | ) { |
244 | 244 | $since .= ' whilst an MP'; |
245 | 245 | } |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>'; |
261 | 261 | } |
262 | 262 | if ( |
263 | - ( isset($extra_info['public_whip_division_attendance']) and |
|
264 | - $extra_info['public_whip_division_attendance'] != 'n/a' ) |
|
263 | + (isset($extra_info['public_whip_division_attendance']) and |
|
264 | + $extra_info['public_whip_division_attendance'] != 'n/a') |
|
265 | 265 | or |
266 | - ( isset($extra_info['Lpublic_whip_division_attendance']) and |
|
267 | - $extra_info['Lpublic_whip_division_attendance'] != 'n/a' ) |
|
266 | + (isset($extra_info['Lpublic_whip_division_attendance']) and |
|
267 | + $extra_info['Lpublic_whip_division_attendance'] != 'n/a') |
|
268 | 268 | ) { |
269 | 269 | $record[] = '<a href="https://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . |
270 | 270 | $this->member->member_id() . |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | exit; |
22 | 22 | } |
23 | 23 | |
24 | -$start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT')); |
|
24 | +$start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT')); |
|
25 | 25 | $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT')); |
26 | 26 | |
27 | 27 | $q = $db->query("select video_timestamps.gid, adate, atime, time_to_sec(timediff(atime, '$start')) as timediff, |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | $timetoend = $row['timetoend'] - $file_offset; |
44 | - if ($timetoend>0) { |
|
44 | + if ($timetoend > 0) { |
|
45 | 45 | $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $row['adate'], $row['atime']); |
46 | - $new_start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT')); |
|
46 | + $new_start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT')); |
|
47 | 47 | $file_offset += timediff($new_start, $start); |
48 | 48 | $start = $new_start; |
49 | 49 | $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT')); |
50 | 50 | } |
51 | 51 | $timediff = $row['timediff'] - $file_offset; |
52 | - if ($timediff>=0) { |
|
52 | + if ($timediff >= 0) { |
|
53 | 53 | print "<stamp><gid>$gid</gid><file>$video[id]</file><time>$timediff</time></stamp>\n"; |
54 | 54 | } |
55 | 55 | $gids[$gid] = true; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | print '</stamps>'; |
58 | 58 | |
59 | 59 | function timediff($a, $b) { |
60 | - return substr($a, 0, 2)*3600 + substr($a, 3, 2)*60 + substr($a, 6, 2) |
|
61 | - - substr($b, 0, 2)*3600 - substr($b, 3, 2)*60 - substr($b, 6, 2); |
|
60 | + return substr($a, 0, 2) * 3600 + substr($a, 3, 2) * 60 + substr($a, 6, 2) |
|
61 | + - substr($b, 0, 2) * 3600 - substr($b, 3, 2) * 60 - substr($b, 6, 2); |
|
62 | 62 | |
63 | 63 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $major = 1; |
10 | 10 | } |
11 | 11 | |
12 | -if ($action == 'next' || $action=='nextneeded') { |
|
12 | +if ($action == 'next' || $action == 'nextneeded') { |
|
13 | 13 | $gid = get_http_var('gid'); |
14 | 14 | $file = intval(get_http_var('file')); |
15 | 15 | $time = intval(get_http_var('time')); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $q = $db->query("select gid, hpos from hansard |
30 | 30 | where hpos>$hpos and hdate='$hdate' and major=$major |
31 | 31 | and htype IN (12,13,14) " |
32 | - . ($action=='nextneeded'?'and video_status in (1,3)':'') . " |
|
32 | + . ($action == 'nextneeded' ? 'and video_status in (1,3)' : '') . " |
|
33 | 33 | ORDER BY hpos LIMIT 1")->first(); |
34 | 34 | if (!$q) { |
35 | 35 | $PAGE->page_start(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } else { |
44 | 44 | $new_gid = $q['gid']; |
45 | 45 | $new_hpos = $q['hpos']; |
46 | - if ($action=='nextneeded') { |
|
46 | + if ($action == 'nextneeded') { |
|
47 | 47 | $q = $db->query("select adate, atime from hansard, video_timestamps |
48 | 48 | where hansard.gid = video_timestamps.gid and deleted=0 |
49 | 49 | and hpos<$new_hpos and hdate='$hdate' and major=$major |
@@ -26,18 +26,18 @@ |
||
26 | 26 | |
27 | 27 | print '<ul>'; |
28 | 28 | foreach ($data as $body => $arr) { |
29 | - $link = strtolower(str_replace(' ','_',$body)); |
|
29 | + $link = strtolower(str_replace(' ', '_', $body)); |
|
30 | 30 | print '<li>'; |
31 | 31 | print $body; |
32 | 32 | print ' — '; |
33 | 33 | if (isset($arr[3])) { |
34 | - print '<a href="'.$link.'/questions">Written Questions</a>'; |
|
34 | + print '<a href="' . $link . '/questions">Written Questions</a>'; |
|
35 | 35 | } |
36 | - if (count($arr)==2) { |
|
36 | + if (count($arr) == 2) { |
|
37 | 37 | print ' | '; |
38 | 38 | } |
39 | 39 | if (isset($arr[4])) { |
40 | - print '<a href="'.$link.'/statements">Written Ministerial Statements</a>'; |
|
40 | + print '<a href="' . $link . '/statements">Written Ministerial Statements</a>'; |
|
41 | 41 | } |
42 | 42 | print '</li>'; |
43 | 43 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | |
31 | 31 | // Disable the old PAGE class. |
32 | -$new_style_template = TRUE; |
|
32 | +$new_style_template = true; |
|
33 | 33 | |
34 | 34 | // Include all the things this page needs. |
35 | 35 | include_once '../../includes/easyparliament/init.php'; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | // Basic name, title and description |
214 | 214 | $member_name = ucfirst($MEMBER->full_name()); |
215 | 215 | $title = $member_name; |
216 | -$desc = "Read $member_name's contributions to Parliament, including speeches and questions"; |
|
216 | +$desc = "read $member_name's contributions to Parliament, including speeches and questions"; |
|
217 | 217 | |
218 | 218 | // Enhance description if this is a current member |
219 | 219 | if ($MEMBER->current_member_anywhere()) { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | $known_for = ''; |
265 | -$current_offices_ignoring_committees = $MEMBER->offices('current', TRUE); |
|
265 | +$current_offices_ignoring_committees = $MEMBER->offices('current', true); |
|
266 | 266 | if (count($current_offices_ignoring_committees) > 0) { |
267 | 267 | $known_for = $current_offices_ignoring_committees[0]; |
268 | 268 | } |
@@ -332,11 +332,11 @@ discard block |
||
332 | 332 | $data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'Sinn Féin' && !$MEMBER->current_member(HOUSE_TYPE_NI))); |
333 | 333 | $data['has_expenses'] = $data['leave_date'] > '2004-01-01'; |
334 | 334 | |
335 | -$data['pre_2010_expenses'] = False; |
|
335 | +$data['pre_2010_expenses'] = false; |
|
336 | 336 | $data['post_2010_expenses'] = $data['leave_date'] > '2010-05-05'; |
337 | 337 | |
338 | 338 | if ($data['entry_date'] < '2010-05-05') { |
339 | - $data['pre_2010_expenses'] = True; |
|
339 | + $data['pre_2010_expenses'] = true; |
|
340 | 340 | // Set the expenses URL if we know it |
341 | 341 | if (isset($MEMBER->extra_info['expenses_url'])) { |
342 | 342 | $data['expenses_url_2004'] = $MEMBER->extra_info['expenses_url']; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * Redirect to the canonical page for a member. |
557 | 557 | */ |
558 | 558 | |
559 | -function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) { |
|
559 | +function member_redirect (&$MEMBER, $code = 301, $pagetype = null) { |
|
560 | 560 | // We come here after creating a MEMBER object by various methods. |
561 | 561 | // Now we redirect to the canonical MP page, with a person_id. |
562 | 562 | if ($MEMBER->person_id()) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | if ($pid) { |
141 | 141 | $URL = new \MySociety\TheyWorkForYou\Url('search'); |
142 | - $URL->insert( array('pid'=>$pid, 'pop'=>1) ); |
|
142 | + $URL->insert(array('pid'=>$pid, 'pop'=>1)); |
|
143 | 143 | header('Location: ' . $URL->generate('none')); |
144 | 144 | exit; |
145 | 145 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } elseif ($THEUSER->postcode_is_set()) { |
187 | 187 | get_mp_by_user_postcode($THEUSER->postcode()); |
188 | 188 | } else { |
189 | - twfy_debug ('MP', "We don't have any way of telling what MP to display"); |
|
189 | + twfy_debug('MP', "We don't have any way of telling what MP to display"); |
|
190 | 190 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, but we can’t tell which representative to display.'); |
191 | 191 | } |
192 | 192 | if (!isset($MEMBER) || !$MEMBER->valid) { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | if (!$MEMBER->current_member(HOUSE_TYPE_SCOTLAND)) { |
259 | 259 | $title .= ', former'; |
260 | 260 | } |
261 | - $title .= ' MSP, '.$MEMBER->constituency(); |
|
261 | + $title .= ' MSP, ' . $MEMBER->constituency(); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | $known_for = ''; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $data['eu_stance'] = $MEMBER->getEUStance(); |
329 | 329 | |
330 | 330 | # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs |
331 | -$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) ); |
|
331 | +$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS)); |
|
332 | 332 | # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs |
333 | 333 | $data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'Sinn Féin' && !$MEMBER->current_member(HOUSE_TYPE_NI))); |
334 | 334 | $data['has_expenses'] = $data['leave_date'] > '2004-01-01'; |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER); |
369 | 369 | $policySummaries = $divisions->getMemberDivisionDetails(); |
370 | 370 | |
371 | - $policyOptions = array( 'summaries' => $policySummaries); |
|
371 | + $policyOptions = array('summaries' => $policySummaries); |
|
372 | 372 | |
373 | 373 | // Generate voting segments |
374 | 374 | $set_descriptions = $policiesList->getSetDescriptions(); |
375 | - if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) { |
|
375 | + if ($policy_set && array_key_exists($policy_set, $set_descriptions)) { |
|
376 | 376 | $sets = array($policy_set); |
377 | 377 | $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set; |
378 | 378 | $data['page_title'] = $set_descriptions[$policy_set] . ' ' . $title . ' - TheyWorkForYou'; |
@@ -414,15 +414,15 @@ discard block |
||
414 | 414 | |
415 | 415 | case 'divisions': |
416 | 416 | $policyID = get_http_var('policy'); |
417 | - if ( $policyID ) { |
|
418 | - $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID ); |
|
417 | + if ($policyID) { |
|
418 | + $policiesList = new MySociety\TheyWorkForYou\Policies($policyID); |
|
419 | 419 | } else { |
420 | 420 | $policiesList = new MySociety\TheyWorkForYou\Policies; |
421 | 421 | } |
422 | - $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER ); |
|
422 | + $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER); |
|
423 | 423 | $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList); |
424 | 424 | |
425 | - if ( $policyID ) { |
|
425 | + if ($policyID) { |
|
426 | 426 | $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID); |
427 | 427 | } else { |
428 | 428 | $data['policydivisions'] = $divisions->getAllMemberDivisionsByPolicy(); |
@@ -498,16 +498,16 @@ discard block |
||
498 | 498 | global $THEUSER; |
499 | 499 | $pc = preg_replace('#[^a-z0-9]#i', '', $pc); |
500 | 500 | if (!validate_postcode($pc)) { |
501 | - twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
502 | - throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn’t a valid postcode'); |
|
501 | + twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
502 | + throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn’t a valid postcode'); |
|
503 | 503 | } |
504 | - twfy_debug ('MP', "MP lookup by postcode"); |
|
504 | + twfy_debug('MP', "MP lookup by postcode"); |
|
505 | 505 | $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc)); |
506 | 506 | if ($constituency == "connection_timed_out") { |
507 | 507 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, we couldn’t check your postcode right now, as our postcode lookup server is under quite a lot of load.'); |
508 | 508 | } elseif ($constituency == "") { |
509 | - twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency"); |
|
510 | - throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn’t a known postcode'); |
|
509 | + twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency"); |
|
510 | + throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn’t a known postcode'); |
|
511 | 511 | } else { |
512 | 512 | // Redirect to the canonical MP page, with a person id. |
513 | 513 | $MEMBER = new MySociety\TheyWorkForYou\Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS)); |
@@ -519,11 +519,11 @@ discard block |
||
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | -function get_person_by_name($name, $const='') { |
|
522 | +function get_person_by_name($name, $const = '') { |
|
523 | 523 | $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const)); |
524 | 524 | // Edge case, only attempt further detection if this isn't the Queen. |
525 | 525 | if (($name !== 'elizabeth the second' && $name !== 'prince charles') || $const) { |
526 | - twfy_debug ('MP', 'Redirecting for MP found by name/constituency'); |
|
526 | + twfy_debug('MP', 'Redirecting for MP found by name/constituency'); |
|
527 | 527 | member_redirect($MEMBER); |
528 | 528 | } |
529 | 529 | return $MEMBER; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * Redirect to the canonical page for a member. |
558 | 558 | */ |
559 | 559 | |
560 | -function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) { |
|
560 | +function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) { |
|
561 | 561 | // We come here after creating a MEMBER object by various methods. |
562 | 562 | // Now we redirect to the canonical MP page, with a person_id. |
563 | 563 | if ($MEMBER->person_id()) { |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | } else { |
577 | 577 | $pagetype = ''; |
578 | 578 | } |
579 | - header('Location: ' . $url . $pagetype, true, $code ); |
|
579 | + header('Location: ' . $url . $pagetype, true, $code); |
|
580 | 580 | exit; |
581 | 581 | } |
582 | 582 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | |
605 | 605 | function person_error_page($message) { |
606 | 606 | global $this_page; |
607 | - switch($this_page) { |
|
607 | + switch ($this_page) { |
|
608 | 608 | case 'mla': |
609 | 609 | $rep = 'MLA'; |
610 | 610 | $SEARCHURL = '/postcode/'; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * Generate the summary of this person's held positions. |
643 | 643 | */ |
644 | 644 | |
645 | -function person_summary_description ($MEMBER) { |
|
645 | +function person_summary_description($MEMBER) { |
|
646 | 646 | $entered_house = $MEMBER->entered_house(); |
647 | 647 | $current_member = $MEMBER->current_member(); |
648 | 648 | $left_house = $MEMBER->left_house(); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | } |
659 | 659 | $desc = ''; |
660 | 660 | foreach ($MEMBER->houses() as $house) { |
661 | - if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) { |
|
661 | + if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) { |
|
662 | 662 | # Same info is printed further down |
663 | 663 | continue; |
664 | 664 | } |
@@ -684,15 +684,15 @@ discard block |
||
684 | 684 | $desc .= $last['from'] . ' '; |
685 | 685 | } |
686 | 686 | } |
687 | - if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) { |
|
687 | + if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) { |
|
688 | 688 | $desc .= ' '; |
689 | - if ($house==HOUSE_TYPE_COMMONS) { |
|
689 | + if ($house == HOUSE_TYPE_COMMONS) { |
|
690 | 690 | $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
691 | 691 | } |
692 | - if ($house==HOUSE_TYPE_NI) { |
|
692 | + if ($house == HOUSE_TYPE_NI) { |
|
693 | 693 | $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
694 | 694 | } |
695 | - if ($house==HOUSE_TYPE_SCOTLAND) { |
|
695 | + if ($house == HOUSE_TYPE_SCOTLAND) { |
|
696 | 696 | $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
697 | 697 | } |
698 | 698 | if ($party_br) { |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | } |
701 | 701 | $desc .= ' for ' . $left_house[$house]['constituency']; |
702 | 702 | } |
703 | - if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') { |
|
703 | + if ($house == HOUSE_TYPE_LORDS && $party != 'Bishop') { |
|
704 | 704 | $desc .= ' Peer'; |
705 | 705 | } |
706 | 706 | $desc .= ', '; |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | * @return string A HTML summary of this person's rebellion rate. |
720 | 720 | */ |
721 | 721 | |
722 | -function person_rebellion_rate ($member) { |
|
722 | +function person_rebellion_rate($member) { |
|
723 | 723 | |
724 | 724 | // Rebellion string may be empty. |
725 | 725 | $rebellion_string = ''; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | // benefit unfortunately. |
758 | 758 | twfy_debug_timestamp(); |
759 | 759 | |
760 | - $person_id= $member->person_id(); |
|
760 | + $person_id = $member->person_id(); |
|
761 | 761 | |
762 | 762 | $memcache = new MySociety\TheyWorkForYou\Memcache; |
763 | 763 | $recent = $memcache->get('recent_appear:' . $person_id); |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $SEARCHENGINE = new \SEARCHENGINE($searchstring); |
769 | 769 | |
770 | 770 | $hansard = new MySociety\TheyWorkForYou\Hansard(); |
771 | - $args = array ( |
|
771 | + $args = array( |
|
772 | 772 | 's' => $searchstring, |
773 | 773 | 'p' => 1, |
774 | 774 | 'num' => 3, |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | twfy_debug_timestamp(); |
784 | 784 | |
785 | 785 | $MOREURL = new \MySociety\TheyWorkForYou\Url('search'); |
786 | - $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) ); |
|
786 | + $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1)); |
|
787 | 787 | |
788 | 788 | $out['more_href'] = $MOREURL->generate() . '#n4'; |
789 | 789 | $out['more_text'] = 'More of ' . ucfirst($member->full_name()) . '’s recent appearances'; |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | return; |
958 | 958 | } |
959 | 959 | |
960 | - $reg = array( 'date' => '', 'data' => '<p>Nil</p>' ); |
|
960 | + $reg = array('date' => '', 'data' => '<p>Nil</p>'); |
|
961 | 961 | if (isset($extra_info['register_member_interests_date'])) { |
962 | 962 | $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT); |
963 | 963 | } |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | } |
1031 | 1031 | |
1032 | - foreach($mreg as $reg) { |
|
1033 | - $data['members'][] = array ( |
|
1032 | + foreach ($mreg as $reg) { |
|
1033 | + $data['members'][] = array( |
|
1034 | 1034 | 'url' => '/' . $rep_type . '/?p=' . $reg['person_id'], |
1035 | 1035 | 'name' => $reg['given_name'] . ' ' . $reg['family_name'] |
1036 | 1036 | ); |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | # comparison which is Commons only |
1100 | 1100 | $data['party_member_count'] = $party->getCurrentMemberCount(HOUSE_TYPE_COMMONS); |
1101 | 1101 | |
1102 | - $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER, [ |
|
1102 | + $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER, [ |
|
1103 | 1103 | 'summaries' => $policySummaries, |
1104 | 1104 | ]); |
1105 | 1105 | $policy_diffs = $MEMBER->getPartyPolicyDiffs($partyCohort, $policiesList, $positions, $only_diffs); |