@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | */ |
68 | 68 | |
69 | -$page = [ |
|
69 | +$page = [ |
|
70 | 70 | |
71 | 71 | // Things used on EVERY page, unless overridden for a page: |
72 | 72 | 'default' => [ |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | // The text displayed on the page itself will also be this, |
1296 | 1296 | // UNLESS the section has a 'heading', in which case that's used instead. |
1297 | 1297 | |
1298 | -$section = [ |
|
1298 | +$section = [ |
|
1299 | 1299 | |
1300 | 1300 | |
1301 | 1301 | 'about' => [ |
@@ -20,39 +20,39 @@ discard block |
||
20 | 20 | <p class="person-header__about__position"> |
21 | 21 | <?php |
22 | 22 | $lat = $latest_membership['party'] == 'Bishop' ? '' : $latest_membership['party']; |
23 | - if ($latest_membership['current']) { |
|
24 | - if ($latest_membership['constituency']) { |
|
25 | - # First %s is party, second is type of rep (e.g. MS), third is constituency name |
|
26 | - printf( |
|
27 | - gettext('<span class="person-header__about__position__role">%s %s</span> for <span class="person-header__about__position__constituency">%s</span>'), |
|
28 | - $lat, |
|
29 | - $latest_membership['rep_name'], |
|
30 | - $latest_membership['constituency'] |
|
31 | - ); |
|
32 | - } else { |
|
33 | - printf( |
|
34 | - gettext('<span class="person-header__about__position__role">%s %s</span>'), |
|
35 | - $lat, |
|
36 | - $latest_membership['rep_name'] |
|
37 | - ); |
|
38 | - } |
|
39 | - } else { |
|
40 | - if ($latest_membership['constituency']) { |
|
41 | - printf( |
|
42 | - gettext('<span class="person-header__about__position__role">Former %s %s</span> for <span class="person-header__about__position__constituency">%s</span>'), |
|
43 | - $lat, |
|
44 | - $latest_membership['rep_name'], |
|
45 | - $latest_membership['constituency'] |
|
46 | - ); |
|
47 | - } else { |
|
48 | - printf( |
|
49 | - gettext('<span class="person-header__about__position__role">Former %s %s</span>'), |
|
50 | - $lat, |
|
51 | - $latest_membership['rep_name'] |
|
52 | - ); |
|
53 | - } |
|
54 | - } |
|
55 | - ?> |
|
23 | + if ($latest_membership['current']) { |
|
24 | + if ($latest_membership['constituency']) { |
|
25 | + # First %s is party, second is type of rep (e.g. MS), third is constituency name |
|
26 | + printf( |
|
27 | + gettext('<span class="person-header__about__position__role">%s %s</span> for <span class="person-header__about__position__constituency">%s</span>'), |
|
28 | + $lat, |
|
29 | + $latest_membership['rep_name'], |
|
30 | + $latest_membership['constituency'] |
|
31 | + ); |
|
32 | + } else { |
|
33 | + printf( |
|
34 | + gettext('<span class="person-header__about__position__role">%s %s</span>'), |
|
35 | + $lat, |
|
36 | + $latest_membership['rep_name'] |
|
37 | + ); |
|
38 | + } |
|
39 | + } else { |
|
40 | + if ($latest_membership['constituency']) { |
|
41 | + printf( |
|
42 | + gettext('<span class="person-header__about__position__role">Former %s %s</span> for <span class="person-header__about__position__constituency">%s</span>'), |
|
43 | + $lat, |
|
44 | + $latest_membership['rep_name'], |
|
45 | + $latest_membership['constituency'] |
|
46 | + ); |
|
47 | + } else { |
|
48 | + printf( |
|
49 | + gettext('<span class="person-header__about__position__role">Former %s %s</span>'), |
|
50 | + $lat, |
|
51 | + $latest_membership['rep_name'] |
|
52 | + ); |
|
53 | + } |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | </p> |
57 | 57 | <?php } ?> |
58 | 58 | <?php if (count($social_links) > 0) { ?> |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | <?php if ($current_member_anywhere) { ?> |
78 | 78 | <div class="person-header__actions"> |
79 | 79 | <?php if ($this_page != 'royal') { |
80 | - $wtt_url = 'https://www.writetothem.com/'; |
|
81 | - if ($current_member[HOUSE_TYPE_LORDS]) { |
|
82 | - $wtt_url = $wtt_url . "?person=uk.org.publicwhip/person/$person_id"; |
|
83 | - } elseif ($the_users_mp) { |
|
84 | - $wtt_url = $wtt_url . "?a=WMC&pc=" . _htmlentities(urlencode($user_postcode)); |
|
85 | - } |
|
86 | - ?> |
|
80 | + $wtt_url = 'https://www.writetothem.com/'; |
|
81 | + if ($current_member[HOUSE_TYPE_LORDS]) { |
|
82 | + $wtt_url = $wtt_url . "?person=uk.org.publicwhip/person/$person_id"; |
|
83 | + } elseif ($the_users_mp) { |
|
84 | + $wtt_url = $wtt_url . "?a=WMC&pc=" . _htmlentities(urlencode($user_postcode)); |
|
85 | + } |
|
86 | + ?> |
|
87 | 87 | <a href="<?= $wtt_url ?>" class="button" onclick="trackLinkClick(this, 'link_click', 'WriteToThem', 'Person'); return false;"><?= gettext('Send a message') ?></a> |
88 | 88 | <?php } ?> |
89 | 89 | <?php if ($has_email_alerts) { ?> |
@@ -44,15 +44,15 @@ |
||
44 | 44 | <text font-size="24" font-weight="normal" fill="#000000"> |
45 | 45 | <?php foreach ($lines as $j => $line) { ?> |
46 | 46 | <tspan x="40" y="<?= $stance_y + $stance_padding_top + $stance_baseline_offset + ($stance_lineheight * $j) ?>"><?php |
47 | - if (strpos($line, '*') !== false) { |
|
48 | - echo preg_replace( |
|
49 | - '#(?:^|[*])([^\r\n *][^*\n]*[^\r\n *])(?:$|[*])#i', |
|
50 | - '$1', |
|
51 | - $line |
|
52 | - ); |
|
53 | - } else { |
|
54 | - echo $line; |
|
55 | - } |
|
47 | + if (strpos($line, '*') !== false) { |
|
48 | + echo preg_replace( |
|
49 | + '#(?:^|[*])([^\r\n *][^*\n]*[^\r\n *])(?:$|[*])#i', |
|
50 | + '$1', |
|
51 | + $line |
|
52 | + ); |
|
53 | + } else { |
|
54 | + echo $line; |
|
55 | + } |
|
56 | 56 | ?></tspan> |
57 | 57 | <?php } ?> |
58 | 58 | </text> |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $data = []; |
98 | 98 | foreach ($q as $row) { |
99 | - $data[] = [ |
|
99 | + $data[] = [ |
|
100 | 100 | 'report_id' => $row['report_id'], |
101 | 101 | 'comment_id' => $row['comment_id'], |
102 | 102 | 'firstname' => $row['firstname'], |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ]; |
108 | 108 | } |
109 | 109 | foreach ($r as $row) { |
110 | - $data[] = [ |
|
110 | + $data[] = [ |
|
111 | 111 | 'report_id' => $row['report_id'], |
112 | 112 | 'comment_id' => $row['comment_id'], |
113 | 113 | 'firstname' => $row['firstname'], |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public $token_checked = null; |
41 | 41 | private $alert_id = ""; |
42 | 42 | public $email = ""; |
43 | - public $criteria = ""; // Sets the terms that are used to produce the search results. |
|
43 | + public $criteria = ""; // Sets the terms that are used to produce the search results. |
|
44 | 44 | |
45 | 45 | private $db; |
46 | 46 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $contents = ['criteria' => $row['criteria'], 'count' => $row['cnt']]; |
72 | 72 | $data[] = $contents; |
73 | 73 | } |
74 | - $data = ['alerts' => $data]; |
|
74 | + $data = ['alerts' => $data]; |
|
75 | 75 | return $data; |
76 | 76 | } |
77 | 77 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $data = $q->fetchAll(); |
101 | 101 | $info = "Alert"; |
102 | - $data = ['info' => $info, 'data' => $data]; |
|
102 | + $data = ['info' => $info, 'data' => $data]; |
|
103 | 103 | |
104 | 104 | return $data; |
105 | 105 | } |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | // Arrays we need to send a templated email. |
257 | - $data = [ |
|
257 | + $data = [ |
|
258 | 258 | 'to' => $details['email'], |
259 | 259 | 'template' => 'alert_confirmation', |
260 | 260 | ]; |
261 | 261 | |
262 | - $merge = [ |
|
262 | + $merge = [ |
|
263 | 263 | 'CONFIRMURL' => $confirmurl, |
264 | 264 | 'CRITERIA' => $this->criteria_pretty(), |
265 | 265 | ]; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | public function send_already_signedup_email($details) { |
276 | - $data = [ |
|
276 | + $data = [ |
|
277 | 277 | 'to' => $details['email'], |
278 | 278 | 'template' => 'alert_already_signedup', |
279 | 279 | ]; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details); |
282 | 282 | $this->criteria = $criteria; |
283 | 283 | |
284 | - $merge = [ |
|
284 | + $merge = [ |
|
285 | 285 | 'CRITERIA' => $this->criteria_pretty(), |
286 | 286 | ]; |
287 | 287 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | # All the following only happen if the house to display isn't yet set. |
88 | 88 | # TODO: This relies on interpreting the default value of 0 as a false, which may be error-prone. |
89 | - if (! (bool) $this->house_disp) { |
|
89 | + if (!(bool) $this->house_disp) { |
|
90 | 90 | if ($house == HOUSE_TYPE_LONDON_ASSEMBLY # London Assembly |
91 | 91 | || $house == HOUSE_TYPE_SCOTLAND # MSPs and |
92 | 92 | || $house == HOUSE_TYPE_WALES # MSs and |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $policiesList = new Policies($policyID); |
252 | 252 | } |
253 | 253 | $rel_agreements = $policiesList->all_policy_agreements[$policyID] ?? []; |
254 | - $rel_agreements = array_filter($rel_agreements, function ($agreement) use ($house) { |
|
254 | + $rel_agreements = array_filter($rel_agreements, function($agreement) use ($house) { |
|
255 | 255 | return $this->date_in_memberships($house, $agreement['date']); |
256 | 256 | }); |
257 | 257 | return $rel_agreements; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | } |
527 | 527 | |
528 | 528 | if ($display && array_key_exists('register_member_interests_html', $this->extra_info) && ($this->extra_info['register_member_interests_html'] != '')) { |
529 | - $args = [ |
|
529 | + $args = [ |
|
530 | 530 | "sort" => "regexp_replace", |
531 | 531 | ]; |
532 | 532 | $GLOSSARY = new GLOSSARY($args); |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | include_once INCLUDESPATH . "easyparliament/searchengine.php"; |
25 | 25 | |
26 | 26 | class GLOSSARY { |
27 | - public $num_terms; // how many glossary entries do we have |
|
27 | + public $num_terms; // how many glossary entries do we have |
|
28 | 28 | // (changes depending on how GLOSSARY is called |
29 | - public $hansard_count; // how many times does the phrase appear in hansard? |
|
30 | - public $query; // search term |
|
31 | - public $glossary_id; // if this is set then we only have 1 glossary term |
|
32 | - public $current_term; // will only be set if we have a valid epobject_id |
|
29 | + public $hansard_count; // how many times does the phrase appear in hansard? |
|
30 | + public $query; // search term |
|
31 | + public $glossary_id; // if this is set then we only have 1 glossary term |
|
32 | + public $current_term; // will only be set if we have a valid epobject_id |
|
33 | 33 | public $current_letter; |
34 | 34 | |
35 | 35 | // constructor... |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | // These stop stupid submissions. |
74 | 74 | // everything should be lowercase. |
75 | - $this->stopwords = [ "the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate" ]; |
|
75 | + $this->stopwords = ["the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate"]; |
|
76 | 76 | |
77 | 77 | } |
78 | 78 |
@@ -158,7 +158,7 @@ |
||
158 | 158 | ]; |
159 | 159 | $hansardmajors[104] = $hansardmajors[4]; |
160 | 160 | |
161 | -$parties = [ |
|
161 | +$parties = [ |
|
162 | 162 | 'Bp' => 'Bishop', |
163 | 163 | 'Con' => 'Conservative', |
164 | 164 | 'CWM' => 'Deputy Speaker', |
@@ -13,16 +13,16 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | private function fetch_division_page() { |
16 | - return $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]); |
|
16 | + return $this->fetch_page(['pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | private function fetch_mp_recent_page() { |
20 | - $vars = [ 'pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent' ]; |
|
20 | + $vars = ['pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent']; |
|
21 | 21 | return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/recent.php'); |
22 | 22 | } |
23 | 23 | |
24 | 24 | private function fetch_recent_page() { |
25 | - return $this->base_fetch_page(['url' => '/divisions' ], 'divisions', 'index.php', '/divisions/index.php'); |
|
25 | + return $this->base_fetch_page(['url' => '/divisions'], 'divisions', 'index.php', '/divisions/index.php'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | |
52 | 52 | public function testMPPageContainsAgreement() { |
53 | 53 | // Checks this MP contains a reference to the agreement |
54 | - $page = $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]); |
|
54 | + $page = $this->fetch_page(['pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions']); |
|
55 | 55 | $this->assertStringContainsString('Example Agreement', $page); |
56 | 56 | } |
57 | 57 | |
58 | 58 | public function testMPPageDoesNotContainsAgreement() { |
59 | 59 | // Checks this MP does not contain agreement - should be out of time scope |
60 | - $page = $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 6, 'policy' => 363, 'url' => '/mp/6/test_current-mp/test_westminster_constituency/divisions' ]); |
|
60 | + $page = $this->fetch_page(['pagetype' => 'divisions', 'pid' => 6, 'policy' => 363, 'url' => '/mp/6/test_current-mp/test_westminster_constituency/divisions']); |
|
61 | 61 | $this->assertStringNotContainsString('Example Agreement', $page); |
62 | 62 | $this->assertStringNotContainsString('This person has not voted on this policy', $page); |
63 | 63 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | public function testNotEnoughInfoStatement() { |
124 | - $page = $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]); |
|
124 | + $page = $this->fetch_page(['pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions']); |
|
125 | 125 | $this->assertStringContainsString('We don’t have enough information to calculate Mrs Test Current-MP’s position', $page); |
126 | 126 | } |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | public function testSingleDivision() { |
135 | - $page = $this->base_fetch_page(['url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons' ], 'divisions', 'division.php', '/divisions/division.php'); |
|
135 | + $page = $this->base_fetch_page(['url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons'], 'divisions', 'division.php', '/divisions/division.php'); |
|
136 | 136 | $this->assertStringContainsString('A majority of MPs <b>voted in favour</b> of a thing', $page); |
137 | 137 | $this->assertStringContainsString('Aye: 200', $page); |
138 | 138 | $this->assertStringNotContainsString('No:', $page); # Summary 100, but no actual votes. In reality, summary can only be <= actual. |