@@ -108,7 +108,9 @@ discard block |
||
108 | 108 | $geometry = _api_getGeometry(); |
109 | 109 | $out = array(); |
110 | 110 | foreach ($geometry['data'] as $name => $data) { |
111 | - if (!isset($data['centre_lat']) || !isset($data['centre_lon'])) continue; |
|
111 | + if (!isset($data['centre_lat']) || !isset($data['centre_lon'])) { |
|
112 | + continue; |
|
113 | + } |
|
112 | 114 | $distance = R_e * acos( |
113 | 115 | sin(deg2rad($lat)) * sin(deg2rad($data['centre_lat'])) |
114 | 116 | + cos(deg2rad($lat)) * cos(deg2rad($data['centre_lat'])) |
@@ -125,8 +127,12 @@ discard block |
||
125 | 127 | } |
126 | 128 | } |
127 | 129 | usort($out, function($a, $b) { |
128 | - if ($a['distance'] > $b['distance']) return 1; |
|
129 | - if ($a['distance'] < $b['distance']) return -1; |
|
130 | + if ($a['distance'] > $b['distance']) { |
|
131 | + return 1; |
|
132 | + } |
|
133 | + if ($a['distance'] < $b['distance']) { |
|
134 | + return -1; |
|
135 | + } |
|
130 | 136 | return 0; |
131 | 137 | }); |
132 | 138 | return $out; |
@@ -145,7 +151,9 @@ discard block |
||
145 | 151 | * smallest angle between them. |
146 | 152 | */ |
147 | 153 | function _api_angle_between($a1, $a2) { |
148 | - if (abs($a1 - $a2) > M_PI) return 2*M_PI - abs($a1 - $a2); |
|
154 | + if (abs($a1 - $a2) > M_PI) { |
|
155 | + return 2*M_PI - abs($a1 - $a2); |
|
156 | + } |
|
149 | 157 | return abs($a1 - $a2); |
150 | 158 | } |
151 | 159 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | and c_main.main_name and constituency.name like :constituency_name and constituency.from_date <= date(now()) |
42 | 42 | and date(now()) <= constituency.to_date |
43 | 43 | order by name', array( |
44 | - ':constituency_name' => '%' . $s .'%' |
|
44 | + ':constituency_name' => '%' . $s . '%' |
|
45 | 45 | )); |
46 | 46 | $output = array(); |
47 | 47 | $done = array(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | function api_getConstituencies($date = 'now()') { |
71 | 71 | $db = new ParlDB; |
72 | 72 | $q = $db->query('select cons_id, name from constituency |
73 | - where main_name and from_date <= date('.$date.') and date('.$date.') <= to_date |
|
73 | + where main_name and from_date <= date('.$date . ') and date(' . $date . ') <= to_date |
|
74 | 74 | order by name'); |
75 | 75 | $output = array(); |
76 | 76 | foreach ($q as $row) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * smallest angle between them. |
146 | 146 | */ |
147 | 147 | function _api_angle_between($a1, $a2) { |
148 | - if (abs($a1 - $a2) > M_PI) return 2*M_PI - abs($a1 - $a2); |
|
148 | + if (abs($a1 - $a2) > M_PI) return 2 * M_PI - abs($a1 - $a2); |
|
149 | 149 | return abs($a1 - $a2); |
150 | 150 | } |
151 | 151 |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | |
24 | 24 | if ($hide_question) { |
25 | 25 | $show_survey_qn = $current_question; |
26 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
26 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
27 | 27 | } elseif ($has_answered_question == $current_question && !$always_ask) { |
28 | 28 | $show_survey_qn = $current_question; |
29 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
29 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
30 | 30 | } elseif (isset($_COOKIE['survey'])) { |
31 | 31 | $show_survey_qn = $_COOKIE['survey']; |
32 | 32 | } |
@@ -36,18 +36,18 @@ discard block |
||
36 | 36 | |
37 | 37 | $page_url = ''; |
38 | 38 | $hide_url = ''; |
39 | - if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) { |
|
39 | + if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) { |
|
40 | 40 | global $MEMBER; |
41 | - if ( $MEMBER ) { |
|
41 | + if ($MEMBER) { |
|
42 | 42 | $page_url = $MEMBER->url(true) . "?answered_survey=$current_question"; |
43 | 43 | $hide_url = $MEMBER->url() . "?hide_survey=$current_question"; |
44 | 44 | } |
45 | 45 | } else { |
46 | 46 | $URL = new Url($this_page); |
47 | - $URL->insert(array('answered_survey' => $current_question )); |
|
47 | + $URL->insert(array('answered_survey' => $current_question)); |
|
48 | 48 | $page_url = 'https://' . DOMAIN . $URL->generate(); |
49 | 49 | $URL = new Url($this_page); |
50 | - $URL->insert(array('hide_survey' => $current_question )); |
|
50 | + $URL->insert(array('hide_survey' => $current_question)); |
|
51 | 51 | $hide_url = $URL->generate(); |
52 | 52 | } |
53 | 53 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <p> |
2 | 2 | <a href="#for"><?= $division['for'] ?> for</a>, |
3 | 3 | <a href="#against"><?= $division['against'] ?> against</a><?php |
4 | - if ($division['both'] > 0) { ?>, |
|
4 | + if ($division['both'] > 0) { ?>, |
|
5 | 5 | <a href="#both"><?= $division['both'] ?> abstained</a><?php |
6 | - } |
|
7 | - if ($division['absent'] > 0) { ?>, |
|
6 | + } |
|
7 | + if ($division['absent'] > 0) { ?>, |
|
8 | 8 | <a href="#absent"><?= $division['absent'] ?> absent</a><?php |
9 | - } ?>. |
|
9 | + } ?>. |
|
10 | 10 | </p> |
@@ -339,7 +339,7 @@ |
||
339 | 339 | |
340 | 340 | $data .= '===================='; |
341 | 341 | $sentemails++; |
342 | - mlog("SEND $sentemails : Sending email to $current[email] ... "); |
|
342 | + mlog("send $sentemails : Sending email to $current[email] ... "); |
|
343 | 343 | $d = array('to' => $current['email'], 'template' => $template); |
344 | 344 | $m = array( |
345 | 345 | 'DATA' => $data, |
@@ -217,7 +217,7 @@ |
||
217 | 217 | # unset($SEARCHENGINE); |
218 | 218 | $total_results = $data['info']['total_results']; |
219 | 219 | $queries++; |
220 | - mlog(", hits " . $total_results . ", time " . (getmicrotime()-$start) . "\n"); |
|
220 | + mlog(", hits " . $total_results . ", time " . (getmicrotime() - $start) . "\n"); |
|
221 | 221 | } else { |
222 | 222 | mlog(" ACTION $active/$outof CACHE HIT : Using cached result for '$criteria_batch'\n"); |
223 | 223 | $data = $results[$criteria_batch]; |
@@ -340,17 +340,20 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | public function check_token($token) { |
343 | - if (!is_null($this->token_checked)) |
|
344 | - return $this->token_checked; |
|
343 | + if (!is_null($this->token_checked)) { |
|
344 | + return $this->token_checked; |
|
345 | + } |
|
345 | 346 | |
346 | 347 | $arg = strstr($token, '::') ? '::' : '-'; |
347 | 348 | $token_parts = explode($arg, $token); |
348 | - if (count($token_parts) != 2) |
|
349 | - return false; |
|
349 | + if (count($token_parts) != 2) { |
|
350 | + return false; |
|
351 | + } |
|
350 | 352 | |
351 | 353 | list($alert_id, $registrationtoken) = $token_parts; |
352 | - if (!is_numeric($alert_id) || !$registrationtoken) |
|
353 | - return false; |
|
354 | + if (!is_numeric($alert_id) || !$registrationtoken) { |
|
355 | + return false; |
|
356 | + } |
|
354 | 357 | |
355 | 358 | $q = $this->db->query("SELECT alert_id, email, criteria |
356 | 359 | FROM alerts |
@@ -398,7 +401,9 @@ discard block |
||
398 | 401 | // If all goes well the alert will be confirmed. |
399 | 402 | // The alert will be active when scripts run each day to send the actual emails. |
400 | 403 | public function confirm($token) { |
401 | - if (!($alert = $this->check_token($token))) return false; |
|
404 | + if (!($alert = $this->check_token($token))) { |
|
405 | + return false; |
|
406 | + } |
|
402 | 407 | $this->criteria = $alert['criteria']; |
403 | 408 | $this->email = $alert['email']; |
404 | 409 | $r = $this->db->query("UPDATE alerts SET confirmed = 1, deleted = 0 WHERE alert_id = :alert_id", array( |
@@ -412,7 +417,9 @@ discard block |
||
412 | 417 | // and the deletion page has passed the token from the URL to here. |
413 | 418 | // If all goes well the alert will be deleted. |
414 | 419 | public function delete($token) { |
415 | - if (!($alert = $this->check_token($token))) return false; |
|
420 | + if (!($alert = $this->check_token($token))) { |
|
421 | + return false; |
|
422 | + } |
|
416 | 423 | $r = $this->db->query("DELETE FROM alerts WHERE alert_id = :alert_id", array( |
417 | 424 | ':alert_id' => $alert['id'] |
418 | 425 | )); |
@@ -421,7 +428,9 @@ discard block |
||
421 | 428 | } |
422 | 429 | |
423 | 430 | public function delete_all($token) { |
424 | - if (!($alert = $this->check_token($token))) return false; |
|
431 | + if (!($alert = $this->check_token($token))) { |
|
432 | + return false; |
|
433 | + } |
|
425 | 434 | $r = $this->db->query("DELETE FROM alerts WHERE email = :email", array( |
426 | 435 | ':email' => $alert['email'] |
427 | 436 | )); |
@@ -430,7 +439,9 @@ discard block |
||
430 | 439 | } |
431 | 440 | |
432 | 441 | public function suspend($token) { |
433 | - if (!($alert = $this->check_token($token))) return false; |
|
442 | + if (!($alert = $this->check_token($token))) { |
|
443 | + return false; |
|
444 | + } |
|
434 | 445 | $r = $this->db->query("UPDATE alerts SET deleted = 2 WHERE alert_id = :alert_id", array( |
435 | 446 | ':alert_id' => $alert['id'] |
436 | 447 | )); |
@@ -439,7 +450,9 @@ discard block |
||
439 | 450 | } |
440 | 451 | |
441 | 452 | public function resume($token) { |
442 | - if (!($alert = $this->check_token($token))) return false; |
|
453 | + if (!($alert = $this->check_token($token))) { |
|
454 | + return false; |
|
455 | + } |
|
443 | 456 | $r = $this->db->query("UPDATE alerts SET deleted = 0 WHERE alert_id = :alert_id", array( |
444 | 457 | ':alert_id' => $alert['id'] |
445 | 458 | )); |
@@ -460,8 +473,12 @@ discard block |
||
460 | 473 | } |
461 | 474 | } |
462 | 475 | $criteria = ''; |
463 | - if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n"; |
|
464 | - if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n"; |
|
476 | + if (count($words)) { |
|
477 | + $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n"; |
|
478 | + } |
|
479 | + if ($spokenby) { |
|
480 | + $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n"; |
|
481 | + } |
|
465 | 482 | return $criteria; |
466 | 483 | } |
467 | 484 |
@@ -52,9 +52,9 @@ |
||
52 | 52 | // FUNCTION: fetch_between |
53 | 53 | |
54 | 54 | public function fetch_between($confirmed, $deleted, $start_date, $end_date) { |
55 | - // Return summary data on all the alerts that were created between $start_date |
|
56 | - // and $end_date (inclusive) and whose confirmed and deleted values match the booleans |
|
57 | - // passed in $confirmed and $deleted |
|
55 | + // Return summary data on all the alerts that were created between $start_date |
|
56 | + // and $end_date (inclusive) and whose confirmed and deleted values match the booleans |
|
57 | + // passed in $confirmed and $deleted |
|
58 | 58 | $q = $this->db->query("SELECT criteria, count(*) as cnt |
59 | 59 | FROM alerts |
60 | 60 | WHERE confirmed = :confirmed |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public $token_checked = null; |
42 | 42 | private $alert_id = ""; |
43 | 43 | public $email = ""; |
44 | - public $criteria = ""; // Sets the terms that are used to produce the search results. |
|
44 | + public $criteria = ""; // Sets the terms that are used to produce the search results. |
|
45 | 45 | |
46 | 46 | private $db; |
47 | 47 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $contents = array('criteria' => $row['criteria'], 'count' => $row['cnt']); |
73 | 73 | $data[] = $contents; |
74 | 74 | } |
75 | - $data = array ('alerts' => $data); |
|
75 | + $data = array('alerts' => $data); |
|
76 | 76 | return $data; |
77 | 77 | } |
78 | 78 | |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | $data[] = $contents; |
112 | 112 | } |
113 | 113 | $info = "Alert"; |
114 | - $data = array ('info' => $info, 'data' => $data); |
|
114 | + $data = array('info' => $info, 'data' => $data); |
|
115 | 115 | |
116 | 116 | return $data; |
117 | 117 | } |
118 | 118 | |
119 | - public function add($details, $confirmation_email=false, $instantly_confirm=true) { |
|
119 | + public function add($details, $confirmation_email = false, $instantly_confirm = true) { |
|
120 | 120 | |
121 | 121 | // Adds a new alert's info into the database. |
122 | 122 | // Then calls another function to send them a confirmation email. |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | // This gives a code for their email address which is then joined |
180 | 180 | // to the timestamp so as to provide a unique ID for each alert. |
181 | 181 | |
182 | - $token = substr( password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16 ); |
|
182 | + $token = substr(password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16); |
|
183 | 183 | |
184 | 184 | // Full stops don't work well at the end of URLs in emails, |
185 | 185 | // so replace them. We won't be doing anything clever with the hash |
@@ -252,19 +252,19 @@ discard block |
||
252 | 252 | |
253 | 253 | $urltoken = $this->alert_id . '-' . $this->registrationtoken; |
254 | 254 | |
255 | - if ( isset($details['confirm_base']) && $details['confirm_base'] !== '' ) { |
|
255 | + if (isset($details['confirm_base']) && $details['confirm_base'] !== '') { |
|
256 | 256 | $confirmurl = $details['confirm_base'] . $urltoken; |
257 | 257 | } else { |
258 | 258 | $confirmurl = 'https://' . DOMAIN . '/A/' . $urltoken; |
259 | 259 | } |
260 | 260 | |
261 | 261 | // Arrays we need to send a templated email. |
262 | - $data = array ( |
|
262 | + $data = array( |
|
263 | 263 | 'to' => $details['email'], |
264 | 264 | 'template' => 'alert_confirmation' |
265 | 265 | ); |
266 | 266 | |
267 | - $merge = array ( |
|
267 | + $merge = array( |
|
268 | 268 | 'FIRSTNAME' => 'THEY WORK FOR YOU', |
269 | 269 | 'LASTNAME' => ' ALERT CONFIRMATION', |
270 | 270 | 'CONFIRMURL' => $confirmurl, |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | public function send_already_signedup_email($details) { |
283 | - $data = array ( |
|
283 | + $data = array( |
|
284 | 284 | 'to' => $details['email'], |
285 | 285 | 'template' => 'alert_already_signedup' |
286 | 286 | ); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details); |
289 | 289 | $this->criteria = $criteria; |
290 | 290 | |
291 | - $merge = array ( |
|
291 | + $merge = array( |
|
292 | 292 | 'FIRSTNAME' => 'THEY WORK FOR YOU', |
293 | 293 | 'LASTNAME' => ' ALERT ALREADY SIGNED UP', |
294 | 294 | 'CRITERIA' => $this->criteria_pretty() |
@@ -448,17 +448,17 @@ discard block |
||
448 | 448 | public function email() { return $this->email; } |
449 | 449 | public function criteria() { return $this->criteria; } |
450 | 450 | public function criteria_pretty($html = false) { |
451 | - $criteria = explode(' ',$this->criteria); |
|
451 | + $criteria = explode(' ', $this->criteria); |
|
452 | 452 | $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($this->criteria)); |
453 | 453 | $words = array(); |
454 | 454 | foreach ($criteria as $c) { |
455 | - if (!preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
455 | + if (!preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
456 | 456 | $words[] = $c; |
457 | 457 | } |
458 | 458 | } |
459 | 459 | $criteria = ''; |
460 | - if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n"; |
|
461 | - if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n"; |
|
460 | + if (count($words)) $criteria .= ($html ? '<li>' : '* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html ? '</li>' : '') . "\n"; |
|
461 | + if ($spokenby) $criteria .= ($html ? '<li>' : '* ') . "Things by " . implode(' or ', $spokenby) . ($html ? '</li>' : '') . "\n"; |
|
462 | 462 | return $criteria; |
463 | 463 | } |
464 | 464 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | Based on postcode <strong><?= $mp_data['postcode'] ?></strong> |
27 | 27 | <a href="<?= $mp_data['change_url'] ?>">(Change postcode)</a> |
28 | 28 | </p> |
29 | - <?php if ( isset( $mp_data ) && $type != 'mlas' ) { ?> |
|
29 | + <?php if (isset($mp_data) && $type != 'mlas') { ?> |
|
30 | 30 | <h3>Your <?= $mp_data['former'] ? $mp_data['former'] . ' ' : '' ?><?= $rep_name ?> is</h3> |
31 | 31 | </div> |
32 | 32 | <a href="<?= $mp_data['mp_url'] ?>" class="people-list__person"> |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | </p> |
39 | 39 | </a> |
40 | 40 | <?php } |
41 | - if ( isset($reps) ) { |
|
42 | - if ( isset($mp_data) && $type != 'mlas' ) { ?> |
|
41 | + if (isset($reps)) { |
|
42 | + if (isset($mp_data) && $type != 'mlas') { ?> |
|
43 | 43 | <div class="people-list__your-mp__replist-header"> |
44 | 44 | <?php } ?> |
45 | 45 | <h3>Your <?=$former ?> <?= $rep_plural == 'MSPs' ? 'regional ' : '' ?><?= $rep_plural ?> are</h3> |
46 | 46 | </div> |
47 | - <?php foreach ( $reps as $rep ) { ?> |
|
47 | + <?php foreach ($reps as $rep) { ?> |
|
48 | 48 | <a href="<?= $rep['mp_url'] ?>" class="people-list__person"> |
49 | 49 | <img class="people-list__person__image" src="<?= $rep['image'] ?>"> |
50 | 50 | <h2 class="people-list__person__name"><?= $rep['name'] ?></h2> |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | <div class="search-page__section search-page__section--search"> |
66 | 66 | <div class="search-page__section__primary"> |
67 | 67 | <p class="search-page-main-inputs"> |
68 | - <?php if ( $type == 'peers' ) { ?> |
|
68 | + <?php if ($type == 'peers') { ?> |
|
69 | 69 | <label for="find-mp-by-name-or-postcode">Find <?= $rep_plural ?> by name:</label> |
70 | - <?php } elseif ( $type == 'mlas' || $type == 'msps' ) { ?> |
|
70 | + <?php } elseif ($type == 'mlas' || $type == 'msps') { ?> |
|
71 | 71 | <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by postcode:</label> |
72 | 72 | <?php } else { ?> |
73 | 73 | <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by name or postcode:</label> |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | <div class="search-page__section__primary"> |
109 | 109 | <h2>All <?= $rep_plural ?></h2> |
110 | 110 | |
111 | - <?php if ( $type != 'peers' ) { ?> |
|
111 | + <?php if ($type != 'peers') { ?> |
|
112 | 112 | <ul class="search-result-display-options"> |
113 | - <?php if ( $order == 'given_name' ) { ?> |
|
113 | + <?php if ($order == 'given_name') { ?> |
|
114 | 114 | <li><strong>Sorted by</strong> First name</li> |
115 | 115 | <li>Sort by <a href="<?= $urls['by_last'] ?>">Last name</a> / <a href="<?= $urls['by_party'] ?>">Party</a></li> |
116 | - <?php } else if ( $order == 'party' ) { ?> |
|
116 | + <?php } else if ($order == 'party') { ?> |
|
117 | 117 | <li><strong>Sorted by</strong> Party</li> |
118 | 118 | <li>Sort by <a href="<?= $urls['by_first'] ?>">First name</a> / <a href="<?= $urls['by_last'] ?>">Last name</a></li> |
119 | 119 | <?php } else { ?> |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | </ul> |
124 | 124 | <?php } else { ?> |
125 | 125 | <ul class="search-result-display-options"> |
126 | - <?php if ( $order == 'party' ) { ?> |
|
126 | + <?php if ($order == 'party') { ?> |
|
127 | 127 | <li><strong>Sorted by</strong> Party</li> |
128 | 128 | <li>Sort by <a href="<?= $urls['by_name'] ?>">Name</a></li> |
129 | 129 | <?php } else { ?> |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | $initial_link = ''; |
176 | - foreach ( $data as $person ) { |
|
176 | + foreach ($data as $person) { |
|
177 | 177 | if ($order != 'party') { |
178 | - $initial = substr( strtoupper($person[$a_to_z_key]), 0, 1); |
|
179 | - if ( $initial != $current_initial ) { |
|
178 | + $initial = substr(strtoupper($person[$a_to_z_key]), 0, 1); |
|
179 | + if ($initial != $current_initial) { |
|
180 | 180 | $current_initial = $initial; |
181 | 181 | $initial_link = "name=\"$initial\" "; |
182 | 182 | } else { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | <img class="people-list__person__image" src="<?= $person['image'] ?>"> |
189 | 189 | <h2 class="people-list__person__name"><?= ucfirst($person['name']) ?></h2> |
190 | 190 | <p class="people-list__person__memberships"> |
191 | - <?php if ( $person['constituency'] ) { ?> |
|
191 | + <?php if ($person['constituency']) { ?> |
|
192 | 192 | <span class="people-list__person__constituency"><?= $person['constituency'] ?></span> |
193 | 193 | <?php } ?> |
194 | 194 | <span class="people-list__person__party <?= slugify($person['party']) ?>"><?= $person['party'] ?></span> |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | <a href="<?= $urls['by_csv'] ?>">Download this list as a CSV</a> |
207 | 207 | suitable for Excel |
208 | 208 | </p> |
209 | - <?php if ( $type == 'mps' ) { ?> |
|
209 | + <?php if ($type == 'mps') { ?> |
|
210 | 210 | <form method="get" action="<?= $urls['plain'] ?>" class="sidebar-item-with-icon sidebar-item-with-icon--date"> |
211 | 211 | <p> |
212 | 212 | Or view a past list |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | }) |
259 | 259 | }); |
260 | 260 | </script> |
261 | - <?php } else if ( $type == 'msps' ) { ?> |
|
261 | + <?php } else if ($type == 'msps') { ?> |
|
262 | 262 | <p class="past-list-dates" id="past-list-dates"> |
263 | 263 | <a href="<?= $urls['plain'] ?>?date=2011-05-05">MSPs at 2011 election</a> |
264 | 264 | <a href="<?= $urls['plain'] ?>?date=2007-05-03">MSPs at 2007 election</a> |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | </p> |
273 | 273 | <?php } ?> |
274 | 274 | |
275 | - <?php include( dirname(__FILE__) . '/../sidebar/looking_for.php' ) ?> |
|
275 | + <?php include(dirname(__FILE__) . '/../sidebar/looking_for.php') ?> |
|
276 | 276 | </div> |
277 | 277 | </div> |
278 | 278 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | if ($data['division']['house'] == 'pbc') { |
59 | 59 | $location = '– in a Public Bill Committee'; |
60 | 60 | } |
61 | -$data['debate_time_human'] = False; |
|
61 | +$data['debate_time_human'] = false; |
|
62 | 62 | $data['debate_day_human'] = format_date($data['division']['date'], LONGDATEFORMAT); |
63 | 63 | $data['col_country'] = $country; |
64 | 64 | $data['location'] = $location; |
@@ -45,11 +45,11 @@ |
||
45 | 45 | $data['mp_vote']['with_majority'] = true; |
46 | 46 | } |
47 | 47 | } else { |
48 | - if ($data['division']['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) { |
|
49 | - $data['before_mp'] = true; |
|
50 | - } else if ($data['division']['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) { |
|
51 | - $data['after_mp'] = true; |
|
52 | - } |
|
48 | + if ($data['division']['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) { |
|
49 | + $data['before_mp'] = true; |
|
50 | + } else if ($data['division']['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) { |
|
51 | + $data['after_mp'] = true; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $mp_data = array( |
@@ -38,20 +38,20 @@ |
||
38 | 38 | |
39 | 39 | $vote_sets = array( |
40 | 40 | 'yes_votes' => array( |
41 | - 'title' => 'Aye', |
|
42 | - 'anchor' => 'for', |
|
41 | + 'title' => 'Aye', |
|
42 | + 'anchor' => 'for', |
|
43 | 43 | ), |
44 | 44 | 'no_votes' => array( |
45 | - 'title' => 'No', |
|
46 | - 'anchor' => 'against', |
|
45 | + 'title' => 'No', |
|
46 | + 'anchor' => 'against', |
|
47 | 47 | ), |
48 | 48 | 'absent_votes' => array( |
49 | - 'title' => 'Absent', |
|
50 | - 'anchor' => 'absent', |
|
49 | + 'title' => 'Absent', |
|
50 | + 'anchor' => 'absent', |
|
51 | 51 | ), |
52 | 52 | 'both_votes' => array( |
53 | - 'title' => 'Abstained', |
|
54 | - 'anchor' => 'both', |
|
53 | + 'title' => 'Abstained', |
|
54 | + 'anchor' => 'both', |
|
55 | 55 | ), |
56 | 56 | ); |
57 | 57 |
@@ -24,9 +24,9 @@ |
||
24 | 24 | }); |
25 | 25 | $sections_with_votes = array_values($sections_with_votes); |
26 | 26 | |
27 | -for ($i=0; $i<count($sections_with_votes); $i+=2) { |
|
27 | +for ($i = 0; $i < count($sections_with_votes); $i += 2) { |
|
28 | 28 | $l = $sections_with_votes[$i]; |
29 | - $r = $i+1 < count($sections_with_votes) ? $sections_with_votes[$i+1] : null; |
|
29 | + $r = $i + 1 < count($sections_with_votes) ? $sections_with_votes[$i + 1] : null; |
|
30 | 30 | |
31 | 31 | $vote_title = $vote_sets[$l]['title']; |
32 | 32 | $anchor = $vote_sets[$l]['anchor']; |
@@ -1,5 +1,6 @@ |
||
1 | 1 | <div class="debate-speech__division__your-mp"> |
2 | - <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
2 | + <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { |
|
3 | +/* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
3 | 4 | <div class="your-mp__header"> |
4 | 5 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
5 | 6 | <p> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <div class="debate-speech__division__your-mp"> |
2 | - <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
2 | + <?php if (!isset($main_vote_mp) || !$main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
3 | 3 | <div class="your-mp__header"> |
4 | 4 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
5 | 5 | <p> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | </div> |
10 | 10 | <?php } ?> |
11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
12 | - <?php if ( isset($mp_vote) ) { ?> |
|
12 | + <?php if (isset($mp_vote)) { ?> |
|
13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
14 | 14 | switch ($mp_vote['vote']) { |
15 | 15 | case 'aye': |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | echo 'N/A'; |
34 | 34 | } |
35 | 35 | ?></span> |
36 | - <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?> |
|
36 | + <?php } else if (isset($before_mp) || isset($after_mp)) { ?> |
|
37 | 37 | <span class="your-mp__vote">N/A</span> |
38 | 38 | <?php } ?> |
39 | 39 | <img class="your-mp__image" src="<?= $data['mp_data']['image'] ?>"> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | <h2 class="people-list__person__name"><?= $data['mp_data']['name'] ?></h2> |
42 | 42 | <p class="people-list__person__memberships"> |
43 | 43 | <span class="people-list__person__constituency"><?= $data['mp_data']['constituency'] ?></span> |
44 | - <span class="people-list__person__party <?= slugify( $data['mp_data']['party'] ) ?>"><?= $data['mp_data']['party'] ?></span> |
|
44 | + <span class="people-list__person__party <?= slugify($data['mp_data']['party']) ?>"><?= $data['mp_data']['party'] ?></span> |
|
45 | 45 | </p> |
46 | 46 | </div> |
47 | 47 | </a> |
@@ -11,28 +11,28 @@ |
||
11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
12 | 12 | <?php if ( isset($mp_vote) ) { ?> |
13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
14 | - switch ($mp_vote['vote']) { |
|
15 | - case 'aye': |
|
14 | + switch ($mp_vote['vote']) { |
|
15 | + case 'aye': |
|
16 | 16 | echo 'Aye'; |
17 | - break; |
|
18 | - case 'no': |
|
17 | + break; |
|
18 | + case 'no': |
|
19 | 19 | echo 'No'; |
20 | - break; |
|
21 | - case 'absent': |
|
20 | + break; |
|
21 | + case 'absent': |
|
22 | 22 | echo 'Absent'; |
23 | - break; |
|
24 | - case 'both': |
|
23 | + break; |
|
24 | + case 'both': |
|
25 | 25 | echo 'Abstain'; |
26 | - break; |
|
27 | - case 'tellaye': |
|
26 | + break; |
|
27 | + case 'tellaye': |
|
28 | 28 | echo 'Aye (Teller)'; |
29 | - break; |
|
30 | - case 'tellno': |
|
29 | + break; |
|
30 | + case 'tellno': |
|
31 | 31 | echo 'No (Teller)'; |
32 | - break; |
|
33 | - default: |
|
32 | + break; |
|
33 | + default: |
|
34 | 34 | echo 'N/A'; |
35 | - } |
|
35 | + } |
|
36 | 36 | ?></span> |
37 | 37 | <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?> |
38 | 38 | <span class="your-mp__vote">N/A</span> |