@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | <div class="row"> |
10 | 10 | <span class="label">Website</span> |
11 | - <span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span> |
|
11 | + <span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">' . _htmlentities($website) . '</a>' ?></span> |
|
12 | 12 | </div> |
13 | 13 | |
14 | 14 | <div class="row"> |
@@ -6,9 +6,9 @@ |
||
6 | 6 | <a href="/help/#vote-descriptions">vote descriptions</a> and |
7 | 7 | <a href="/help/#votingrecord">how the voting record is decided</a></p> |
8 | 8 | |
9 | - <?php if(isset($data['photo_attribution_text'])) { ?> |
|
9 | + <?php if (isset($data['photo_attribution_text'])) { ?> |
|
10 | 10 | <p> |
11 | - <?php if(isset($data['photo_attribution_link'])) { ?> |
|
11 | + <?php if (isset($data['photo_attribution_link'])) { ?> |
|
12 | 12 | Profile photo: |
13 | 13 | <a href="<?= $data['photo_attribution_link'] ?>"><?= $data['photo_attribution_text'] ?></a> |
14 | 14 | <?php } else { ?> |
@@ -20,7 +20,7 @@ |
||
20 | 20 | <input type="hidden" name="scrub" value="$email"> |
21 | 21 | <input type="submit" value="Delete user"> |
22 | 22 | </form> |
23 | -EOF; |
|
23 | +eof; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $user_data = array( |
@@ -2,12 +2,12 @@ |
||
2 | 2 | <img src="<?= $member->image()['url'] ?>" alt=""> |
3 | 3 | <h3 class="search-result__title"><a href="<?= $member->url() ?>"><?= $member->full_name() ?></a></h3> |
4 | 4 | <?php $latest_membership = $member->getMostRecentMembership(); ?> |
5 | - <?php if ( $latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL ) { ?> |
|
5 | + <?php if ($latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL) { ?> |
|
6 | 6 | <p class="search-result__description"> |
7 | 7 | <?= $latest_membership['current'] ? '' : 'Former' ?> |
8 | 8 | <?= $latest_membership['party'] == 'Bishop' ? '' : $latest_membership['party'] ?> |
9 | 9 | <?= $latest_membership['rep_name'] ?> |
10 | - <?php if ( $latest_membership['constituency'] ) { ?> |
|
10 | + <?php if ($latest_membership['constituency']) { ?> |
|
11 | 11 | for <?= $latest_membership['constituency'] ?> |
12 | 12 | <?php } ?> |
13 | 13 | (<?= format_date($latest_membership['start_date'], SHORTDATEFORMAT) ?> – <?= $latest_membership['current'] ? 'current' : format_date($latest_membership['end_date'], SHORTDATEFORMAT); ?>) |
@@ -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 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->assertRegexp('#<span class="person-header__about__position__role">\s*Labour\s*MP\s*</span>#', $page); |
35 | 35 | } |
36 | 36 | |
37 | - public function testSittingMLA() |
|
37 | + public function testSittingMLA() |
|
38 | 38 | { |
39 | 39 | $page = $this->fetch_page( array( 'pid' => 4, 'mla' => 1, 'url' => '/mp/4/test_current-mla' ) ); |
40 | 40 | $this->assertContains('Test Current-MLA', $page); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Ensure that the Speaker is given the correct constituency. |
65 | 65 | */ |
66 | - public function testSpeaker() |
|
66 | + public function testSpeaker() |
|
67 | 67 | { |
68 | 68 | $page = $this->fetch_page( array( 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ) ); |
69 | 69 | $this->assertRegexp('#<span class="person-header__about__position__role">\s*Speaker\s*MP\s*</span>#', $page); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function getDataSet() |
13 | 13 | { |
14 | - return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/member.xml'); |
|
14 | + return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/member.xml'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | private function fetch_page($vars) |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | |
22 | 22 | public function testQueenie() |
23 | 23 | { |
24 | - $page = $this->fetch_page( array( 'royal' => 1, 'n' => 'elizabeth_the_second' ) ); |
|
24 | + $page = $this->fetch_page(array('royal' => 1, 'n' => 'elizabeth_the_second')); |
|
25 | 25 | $this->assertContains('Elizabeth the Second', $page); |
26 | 26 | $this->assertContains('Coronated on 2 June 1953', $page); |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function testSittingMP() |
30 | 30 | { |
31 | - $page = $this->fetch_page( array( 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ) ); |
|
31 | + $page = $this->fetch_page(array('pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency')); |
|
32 | 32 | $this->assertContains('Test Current-MP', $page); |
33 | 33 | $this->assertRegexp('#<span class="person-header__about__position__constituency">\s*Test Westminster Constituency\s*</span>#', $page); |
34 | 34 | $this->assertRegexp('#<span class="person-header__about__position__role">\s*Labour\s*MP\s*</span>#', $page); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function testSittingMLA() |
38 | 38 | { |
39 | - $page = $this->fetch_page( array( 'pid' => 4, 'mla' => 1, 'url' => '/mp/4/test_current-mla' ) ); |
|
39 | + $page = $this->fetch_page(array('pid' => 4, 'mla' => 1, 'url' => '/mp/4/test_current-mla')); |
|
40 | 40 | $this->assertContains('Test Current-MLA', $page); |
41 | 41 | $this->assertRegexp('#<span class="person-header__about__position__constituency">\s*Test Northern Ireland Constituency\s*</span>#', $page); |
42 | 42 | $this->assertRegexp('#<span class="person-header__about__position__role">\s*Sinn Féin\s*MLA\s*</span>#', $page); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function testSittingSinnFeinMP() |
49 | 49 | { |
50 | - $page = $this->fetch_page( array( 'pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency' ) ); |
|
50 | + $page = $this->fetch_page(array('pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency')); |
|
51 | 51 | $this->assertContains('Sinn Féin MPs do not take their seats in Parliament.', $page); |
52 | 52 | } |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function testSittingNonSinnFeinMP() |
58 | 58 | { |
59 | - $page = $this->fetch_page( array( 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ) ); |
|
59 | + $page = $this->fetch_page(array('pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency')); |
|
60 | 60 | $this->assertNotContains('Sinn Féin MPs do not take their seats in Parliament.', $page); |
61 | 61 | } |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function testSpeaker() |
67 | 67 | { |
68 | - $page = $this->fetch_page( array( 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ) ); |
|
68 | + $page = $this->fetch_page(array('pid' => 13, 'url' => '/mp/13/test_speaker/buckingham')); |
|
69 | 69 | $this->assertRegexp('#<span class="person-header__about__position__role">\s*Speaker\s*MP\s*</span>#', $page); |
70 | 70 | } |
71 | 71 | |
@@ -75,25 +75,25 @@ discard block |
||
75 | 75 | # makes sure it is empty in case there's something hanging |
76 | 76 | # about in memcached |
77 | 77 | $banner->set_text(''); |
78 | - $page = $this->fetch_page( array( 'url' => '/' ) ); |
|
78 | + $page = $this->fetch_page(array('url' => '/')); |
|
79 | 79 | $this->assertNotContains('<div class="banner">', $page); |
80 | 80 | $this->assertNotContains('This is a banner', $page); |
81 | 81 | |
82 | 82 | $banner->set_text('This is a banner'); |
83 | - $page = $this->fetch_page( array( 'url' => '/' ) ); |
|
83 | + $page = $this->fetch_page(array('url' => '/')); |
|
84 | 84 | $this->assertContains('This is a banner', $page); |
85 | 85 | |
86 | 86 | $banner->set_text(''); |
87 | - $page = $this->fetch_page( array( 'url' => '/' ) ); |
|
87 | + $page = $this->fetch_page(array('url' => '/')); |
|
88 | 88 | $this->assertNotContains('<div class="banner">', $page); |
89 | 89 | $this->assertNotContains('This is a banner', $page); |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function testNewMPMessage() { |
93 | - $page = $this->fetch_page( array( 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ) ); |
|
93 | + $page = $this->fetch_page(array('pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency')); |
|
94 | 94 | $this->assertNotContains('is a recently elected MP', $page); |
95 | 95 | $this->db->query('UPDATE member SET entered_house = NOW() WHERE person_id = 17'); |
96 | - $page = $this->fetch_page( array( 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ) ); |
|
96 | + $page = $this->fetch_page(array('pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency')); |
|
97 | 97 | $this->assertContains('is a recently elected MP', $page); |
98 | 98 | } |
99 | 99 |
@@ -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]; |