@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once INCLUDESPATH."easyparliament/member.php"; |
|
3 | +include_once INCLUDESPATH . "easyparliament/member.php"; |
|
4 | 4 | |
5 | 5 | function api_getHansard_front() { |
6 | 6 | ?> |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | function api_getHansard_search($s) { |
32 | - _api_getHansard_search( array( |
|
32 | + _api_getHansard_search(array( |
|
33 | 33 | 's' => $s, |
34 | 34 | 'pid' => get_http_var('person') |
35 | - ) ); |
|
35 | + )); |
|
36 | 36 | } |
37 | 37 | function api_getHansard_person($pid) { |
38 | 38 | _api_getHansard_search(array( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function _api_getHansard_date($type, $d) { |
44 | - $args = array ('date' => $d); |
|
44 | + $args = array('date' => $d); |
|
45 | 45 | $LIST = _api_getListObject($type); |
46 | 46 | $LIST->display('date', $args, 'api'); |
47 | 47 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $type = isset($array['type']) ? $array['type'] : ''; |
57 | 57 | $search = filter_user_input($search, 'strict'); |
58 | 58 | if ($pid) { |
59 | - $search .= ($search?' ':'') . 'speaker:' . $pid; |
|
59 | + $search .= ($search ? ' ' : '') . 'speaker:' . $pid; |
|
60 | 60 | } |
61 | 61 | if ($type) { |
62 | 62 | $search .= " section:" . $type; |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | } |
92 | 92 | # $query_desc_short = $SEARCHENGINE->query_description_short(); |
93 | 93 | $pagenum = get_http_var('page'); |
94 | - $args = array ( |
|
94 | + $args = array( |
|
95 | 95 | 's' => $search, |
96 | 96 | 'p' => $pagenum, |
97 | 97 | 'num' => get_http_var('num'), |
98 | 98 | 'pop' => 1, |
99 | - 'o' => ($o=='d' || $o=='r') ? $o : 'd', |
|
99 | + 'o' => ($o == 'd' || $o == 'r') ? $o : 'd', |
|
100 | 100 | ); |
101 | 101 | $LIST = new HANSARDLIST(); |
102 | 102 | $data = $LIST->display('search', $args, 'none'); |
@@ -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> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!empty($details['pid'])) { |
22 | - $criteria[] = 'speaker:'.$details['pid']; |
|
22 | + $criteria[] = 'speaker:' . $details['pid']; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $criteria = join(' ', $criteria); |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $token = $row['alert_id'] . '-' . $row['registrationtoken']; |
42 | 42 | |
43 | 43 | $status = 'confirmed'; |
44 | - if ( !$row['confirmed'] ) { |
|
44 | + if (!$row['confirmed']) { |
|
45 | 45 | $status = 'unconfirmed'; |
46 | - } elseif ( $row['deleted'] == 2 ) { |
|
46 | + } elseif ($row['deleted'] == 2) { |
|
47 | 47 | $status = 'suspended'; |
48 | 48 | } |
49 | 49 | |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | |
61 | 61 | public static function prettifyCriteria($alert_criteria) { |
62 | 62 | $text = ''; |
63 | - if ( $alert_criteria ) { |
|
63 | + if ($alert_criteria) { |
|
64 | 64 | $criteria = explode(' ', $alert_criteria); |
65 | 65 | $words = array(); |
66 | 66 | $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($alert_criteria)); |
67 | 67 | |
68 | 68 | foreach ($criteria as $c) { |
69 | - if (!preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
69 | + if (!preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
70 | 70 | $words[] = $c; |
71 | 71 | } |
72 | 72 | } |
73 | - if ( $spokenby && count($words) ) { |
|
73 | + if ($spokenby && count($words)) { |
|
74 | 74 | $text = implode(' or ', $spokenby) . ' mentions [' . implode(' ', $words) . ']'; |
75 | - } else if ( count( $words ) ) { |
|
75 | + } else if (count($words)) { |
|
76 | 76 | $text = '[' . implode(' ', $words) . ']' . ' is mentioned'; |
77 | - } else if ( $spokenby ) { |
|
77 | + } else if ($spokenby) { |
|
78 | 78 | $text = implode(' or ', $spokenby) . " speaks"; |
79 | 79 | } |
80 | 80 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | <?php if (isset($data['mp_data'])) { |
29 | 29 | include('_your_mp.php'); |
30 | - } ?> |
|
30 | + } ?> |
|
31 | 31 | |
32 | 32 | <div class="debate-speech__division__details"> |
33 | 33 | <p> |
@@ -37,7 +37,7 @@ |
||
37 | 37 | </span><br> |
38 | 38 | <?php } else { ?> |
39 | 39 | <?php if ($mp_vote['with_majority']) { ?> |
40 | - <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>agreed</b> and'; include('_vote_description.php'); ?> |
|
40 | + <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>agreed</b> and'; include('_vote_description.php'); ?> |
|
41 | 41 | <?php } else { ?> |
42 | 42 | <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>disagreed</b> and'; include('_vote_description.php'); ?> |
43 | 43 | <?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 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <div class="debate-speech__speaker-and-content"> |
117 | 117 | <?php } ?> |
118 | 118 | |
119 | - <?php if(isset($speech['speaker']) && count($speech['speaker']) > 0) { ?> |
|
119 | + <?php if (isset($speech['speaker']) && count($speech['speaker']) > 0) { ?> |
|
120 | 120 | <h2 class="debate-speech__speaker"> |
121 | 121 | <?php |
122 | 122 | |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | <?php if ($division['has_description']) { ?> |
185 | 185 | <div class="debate-speech__division__details"> |
186 | 186 | <span class="policy-vote__text"> |
187 | - <?php include( dirname(__FILE__) . '/../divisions/_vote_description.php'); ?> |
|
187 | + <?php include(dirname(__FILE__) . '/../divisions/_vote_description.php'); ?> |
|
188 | 188 | </span><br> |
189 | 189 | </div> |
190 | 190 | <?php } ?> |
191 | 191 | |
192 | 192 | <?php if (isset($speech['mp_vote'])) { |
193 | - $mp_vote = array( 'vote' => $speech['mp_vote']['vote'] ); |
|
194 | - if ( isset($speech['before_mp']) ) { |
|
193 | + $mp_vote = array('vote' => $speech['mp_vote']['vote']); |
|
194 | + if (isset($speech['before_mp'])) { |
|
195 | 195 | $before_mp = $speech['before_mp']; |
196 | 196 | } |
197 | - if ( isset($speech['after_mp']) ) { |
|
197 | + if (isset($speech['after_mp'])) { |
|
198 | 198 | $after_mp = $speech['after_mp']; |
199 | 199 | } |
200 | 200 | include dirname(__FILE__) . '/../divisions/_your_mp.php'; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | </div> |
214 | 214 | <?php } ?> |
215 | 215 | |
216 | - <?php if ( $section ) { |
|
216 | + <?php if ($section) { |
|
217 | 217 | if ($speech['voting_data']) { ?> |
218 | 218 | |
219 | 219 | <div class="debate-speech__question-answered"> |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $moreinfo[] = sprintf(ngettext('%s annotation', '%s annotations', $row['totalcomments']), $row['totalcomments']); |
352 | 352 | } |
353 | 353 | if (count($moreinfo) > 0) { |
354 | - print "<small>(" . implode (', ', $moreinfo) . ") </small>"; |
|
354 | + print "<small>(" . implode(', ', $moreinfo) . ") </small>"; |
|
355 | 355 | } |
356 | 356 | } else { |
357 | 357 | // Nothing in this item, so no link. |
@@ -164,7 +164,7 @@ |
||
164 | 164 | <?php # XXX |
165 | 165 | if ($data['info']['major'] == 8 && preg_match('#\d{4}-\d\d-\d\d\.(.*?)\.q#', $speech['gid'], $m)) { |
166 | 166 | ?><p class="debate-speech__question_id"><small> |
167 | - <?= "Question $m[1]" ?> |
|
167 | + <?= "question $m[1]" ?> |
|
168 | 168 | </small></p> |
169 | 169 | <?php } ?> |
170 | 170 |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | private function fetch_division_page() { |
20 | - return $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) ); |
|
20 | + return $this->fetch_page(array('pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions')); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | private function fetch_mp_recent_page() |
24 | 24 | { |
25 | - $vars = array( 'pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent' ); |
|
25 | + $vars = array('pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent'); |
|
26 | 26 | return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/recent.php'); |
27 | 27 | } |
28 | 28 | |
29 | 29 | private function fetch_recent_page() { |
30 | - return $this->base_fetch_page( array('url' => '/divisions' ), 'divisions', 'index.php', '/divisions/index.php' ); |
|
30 | + return $this->base_fetch_page(array('url' => '/divisions'), 'divisions', 'index.php', '/divisions/index.php'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | public function testNotEnoughInfoStatement() { |
116 | - return $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) ); |
|
116 | + return $this->fetch_page(array('pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions')); |
|
117 | 117 | $this->assertContains('we don’t have enough information to calculate Test Current-MP’s position', $page); |
118 | 118 | } |
119 | 119 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | public function testSingleDivision() { |
127 | - $page = $this->base_fetch_page( array('url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons' ), 'divisions', 'division.php', '/divisions/division.php' ); |
|
127 | + $page = $this->base_fetch_page(array('url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons'), 'divisions', 'division.php', '/divisions/division.php'); |
|
128 | 128 | $this->assertContains('A majority of MPs <b>voted in favour</b> of a thing', $page); |
129 | 129 | $this->assertContains('Aye: 200', $page); |
130 | 130 | $this->assertNotContains('No:', $page); # Summary 100, but no actual votes. In reality, summary can only be <= actual. |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $this->db = new \ParlDB; |
24 | 24 | } |
25 | 25 | |
26 | - private function query($where='') { |
|
26 | + private function query($where = '') { |
|
27 | 27 | $q = $this->db->query( |
28 | 28 | "SELECT id, slug, title, description, search_string, front_page, image FROM topics $where" |
29 | 29 | ); |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | $o = get_http_var('o'); |
15 | - $args = array ( |
|
15 | + $args = array( |
|
16 | 16 | 's' => $this->searchstring, |
17 | 17 | 'p' => $pagenum, |
18 | 18 | 'num' => get_http_var('num'), |
19 | 19 | 'pop' => get_http_var('pop'), |
20 | - 'o' => ($o=='d' || $o=='r' || $o=='o') ? $o : 'd', |
|
20 | + 'o' => ($o == 'd' || $o == 'r' || $o == 'o') ? $o : 'd', |
|
21 | 21 | ); |
22 | 22 | |
23 | 23 | return $args; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | $sort_order = 'newest'; |
58 | - if ( $args['o'] == 'o' ) { |
|
58 | + if ($args['o'] == 'o') { |
|
59 | 59 | $sort_order = 'oldest'; |
60 | - } else if ( $args['o'] == 'r' ) { |
|
60 | + } else if ($args['o'] == 'r') { |
|
61 | 61 | $sort_order = 'relevance'; |
62 | 62 | } |
63 | 63 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return array('error' => $SEARCHENGINE->error); |
74 | 74 | } else { |
75 | 75 | $LIST = new \HANSARDLIST(); |
76 | - $data = $LIST->display('search', $args , 'none'); |
|
76 | + $data = $LIST->display('search', $args, 'none'); |
|
77 | 77 | $data['search_type'] = 'normal'; |
78 | 78 | $data['sort_order'] = $sort_order; |
79 | 79 | $data['members'] = $members; |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
96 | - list ($constituencies, ) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm); |
|
96 | + list ($constituencies,) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm); |
|
97 | 97 | |
98 | 98 | $constituency = ""; |
99 | - if (count($constituencies)==1) { |
|
99 | + if (count($constituencies) == 1) { |
|
100 | 100 | $constituency = $constituencies[0]; |
101 | 101 | } |
102 | 102 | |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | |
113 | 113 | $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1)); |
114 | 114 | $cons[] = $MEMBER; |
115 | - if ( $MEMBER->current_member(1) ) { |
|
115 | + if ($MEMBER->current_member(1)) { |
|
116 | 116 | $mp_types['mp']++; |
117 | 117 | } else { |
118 | 118 | $mp_types['former']++; |
119 | 119 | } |
120 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
120 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
121 | 121 | $cons = array(); |
122 | 122 | } |
123 | 123 | } elseif (count($constituencies)) { |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | try { |
126 | 126 | $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1)); |
127 | 127 | $cons[] = $MEMBER; |
128 | - if ( $MEMBER->current_member(1) ) { |
|
128 | + if ($MEMBER->current_member(1)) { |
|
129 | 129 | $mp_types['mp']++; |
130 | 130 | } else { |
131 | 131 | $mp_types['former']++; |
132 | 132 | } |
133 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
133 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $link = array( |
202 | 202 | 'url' => $url->generate(), |
203 | 203 | 'page' => $n, |
204 | - 'current' => ( $n == $data['page'] ) |
|
204 | + 'current' => ($n == $data['page']) |
|
205 | 205 | ); |
206 | 206 | |
207 | 207 | $links[] = $link; |
@@ -242,27 +242,27 @@ discard block |
||
242 | 242 | $numlinks = $this->generate_pagination_links($data, $URL, $firstpage, $lastpage); |
243 | 243 | |
244 | 244 | $pagelinks['nums'] = $numlinks; |
245 | - $pagelinks['first_result'] = $page == 1 ? 1 : ( ( $page - 1 ) * $results_per_page ) + 1; |
|
246 | - $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ( $results_per_page - 1 ); |
|
245 | + $pagelinks['first_result'] = $page == 1 ? 1 : (($page - 1) * $results_per_page) + 1; |
|
246 | + $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ($results_per_page - 1); |
|
247 | 247 | |
248 | - if ( $page != 1 ) { |
|
248 | + if ($page != 1) { |
|
249 | 249 | $prev_page = $page - 1; |
250 | - $URL->insert(array( 'p' => $prev_page ) ); |
|
250 | + $URL->insert(array('p' => $prev_page)); |
|
251 | 251 | $pagelinks['prev'] = array( |
252 | 252 | 'url' => $URL->generate() |
253 | 253 | ); |
254 | - $URL->insert(array( 'p' => 1 ) ); |
|
254 | + $URL->insert(array('p' => 1)); |
|
255 | 255 | $pagelinks['firstpage'] = array( |
256 | 256 | 'url' => $URL->generate() |
257 | 257 | ); |
258 | 258 | } |
259 | 259 | if ($page != $numpages) { |
260 | 260 | $next_page = $page + 1; |
261 | - $URL->insert(array( 'p' => $next_page ) ); |
|
261 | + $URL->insert(array('p' => $next_page)); |
|
262 | 262 | $pagelinks['next'] = array( |
263 | 263 | 'url' => $URL->generate() |
264 | 264 | ); |
265 | - $URL->insert(array( 'p' => $numpages ) ); |
|
265 | + $URL->insert(array('p' => $numpages)); |
|
266 | 266 | $pagelinks['lastpage'] = array( |
267 | 267 | 'url' => $URL->generate() |
268 | 268 | ); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $links['rss'] = $DATA->page_metadata($this_page, 'rss'); |
280 | 280 | |
281 | 281 | if ($SEARCHENGINE) { |
282 | - $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch='.urlencode($this->searchstring) : ''); |
|
282 | + $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch=' . urlencode($this->searchstring) : ''); |
|
283 | 283 | $links['email_desc'] = $SEARCHENGINE->query_description_long(); |
284 | 284 | } |
285 | 285 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $search_engine = new \SEARCHENGINE($filter_ss); |
294 | 294 | $links['email_section'] = $links['email']; |
295 | 295 | $links['email_desc_section'] = $links['email_desc']; |
296 | - $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch='.urlencode($filter_ss) : ''); |
|
296 | + $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch=' . urlencode($filter_ss) : ''); |
|
297 | 297 | $links['email_desc'] = $search_engine->query_description_long(); |
298 | 298 | } |
299 | 299 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $parts = parse_url($url); |
16 | 16 | parse_str($parts['query'], $query); |
17 | 17 | |
18 | - if ( $query['id'] ) { |
|
18 | + if ($query['id']) { |
|
19 | 19 | if (strpos($parts['path'], 'lords') !== false) { |
20 | 20 | $gid = 'uk.org.publicwhip/lords/'; |
21 | 21 | } elseif (strpos($parts['path'], 'whall') !== false) { |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | |
32 | 32 | public static function gid_to_url($gid) { |
33 | - if ( !$gid ) { |
|
33 | + if (!$gid) { |
|
34 | 34 | return ''; |
35 | 35 | } |
36 | 36 | global $hansardmajors; |
37 | 37 | $db = new \ParlDB(); |
38 | 38 | |
39 | - $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ))->first(); |
|
39 | + $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid))->first(); |
|
40 | 40 | $url_gid = fix_gid_from_db($gid); |
41 | 41 | $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']); |
42 | 42 | $url->insert(array('id' => $url_gid)); |