@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | <ul class="vote-descriptions"> |
| 133 | 133 | <?php foreach ($sig_diff_policy->policy_pairs as $policy_pair) { |
| 134 | - include '_vote_description.php'; |
|
| 135 | - } ?> |
|
| 134 | + include '_vote_description.php'; |
|
| 135 | + } ?> |
|
| 136 | 136 | </ul> |
| 137 | 137 | |
| 138 | 138 | <?php } ?> |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | <ul class="vote-descriptions"> |
| 166 | 166 | <?php foreach ($segment->policy_pairs as $policy_pair) { |
| 167 | 167 | |
| 168 | - include '_vote_description.php'; |
|
| 168 | + include '_vote_description.php'; |
|
| 169 | 169 | |
| 170 | - } ?> |
|
| 170 | + } ?> |
|
| 171 | 171 | </ul> |
| 172 | 172 | |
| 173 | 173 | <p class="voting-information-provenance"> |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | <nav class="subpage-content-list js-accordion" aria-label="Comparison periods"> |
| 35 | 35 | <h3 class="js-accordion-button">For period: <?= $comparison_period->description ?></h3> |
| 36 | 36 | <ul class="js-accordion-content"> |
| 37 | - <?php foreach($available_periods as $period) { ?> |
|
| 37 | + <?php foreach ($available_periods as $period) { ?> |
|
| 38 | 38 | <li><a href="?comparison_period=<?= $period->lslug() ?>" class="<?= $period->lslug() === $comparison_period->lslug() ? 'active-comparison-period' : '' ?>"><?= $period->description ?></a></li> |
| 39 | 39 | <?php } ?> |
| 40 | 40 | </ul> |
@@ -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 | public $ignore_speaker_votes = 0; |
| 45 | 45 | |
| 46 | 46 | private $db; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $contents = ['criteria' => $row['criteria'], 'count' => $row['cnt']]; |
| 73 | 73 | $data[] = $contents; |
| 74 | 74 | } |
| 75 | - $data = ['alerts' => $data]; |
|
| 75 | + $data = ['alerts' => $data]; |
|
| 76 | 76 | return $data; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $data = $q->fetchAll(); |
| 103 | 103 | $info = "Alert"; |
| 104 | - $data = ['info' => $info, 'data' => $data]; |
|
| 104 | + $data = ['info' => $info, 'data' => $data]; |
|
| 105 | 105 | |
| 106 | 106 | return $data; |
| 107 | 107 | } |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // Arrays we need to send a templated email. |
| 303 | - $data = [ |
|
| 303 | + $data = [ |
|
| 304 | 304 | 'to' => $details['email'], |
| 305 | 305 | 'template' => 'alert_confirmation', |
| 306 | 306 | ]; |
| 307 | 307 | |
| 308 | - $merge = [ |
|
| 308 | + $merge = [ |
|
| 309 | 309 | 'CONFIRMURL' => $confirmurl, |
| 310 | 310 | 'CRITERIA' => $this->criteria_pretty(), |
| 311 | 311 | ]; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | public function send_already_signedup_email($details) { |
| 322 | - $data = [ |
|
| 322 | + $data = [ |
|
| 323 | 323 | 'to' => $details['email'], |
| 324 | 324 | 'template' => 'alert_already_signedup', |
| 325 | 325 | ]; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details); |
| 328 | 328 | $this->criteria = $criteria; |
| 329 | 329 | |
| 330 | - $merge = [ |
|
| 330 | + $merge = [ |
|
| 331 | 331 | 'CRITERIA' => $this->criteria_pretty(), |
| 332 | 332 | ]; |
| 333 | 333 | |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | <?php } elseif ($step !== '') { ?> |
| 131 | 131 | <?php include '_alert_form.php'; |
| 132 | 132 | } elseif ($this_step == '') { |
| 133 | - if( |
|
| 133 | + if ( |
|
| 134 | 134 | !$results && ( |
| 135 | 135 | $members || |
| 136 | 136 | (isset($constituencies) && count($constituencies) > 0) || |
@@ -139,22 +139,22 @@ discard block |
||
| 139 | 139 | </div> |
| 140 | 140 | <?php } elseif ($step !== '') { ?> |
| 141 | 141 | <?php include '_alert_form.php'; |
| 142 | - } elseif ($this_step == '') { |
|
| 143 | - if( |
|
| 144 | - !$results && ( |
|
| 145 | - $members || |
|
| 142 | + } elseif ($this_step == '') { |
|
| 143 | + if( |
|
| 144 | + !$results && ( |
|
| 145 | + $members || |
|
| 146 | 146 | (isset($constituencies) && count($constituencies) > 0) || |
| 147 | 147 | ($alertsearch) |
| 148 | - ) |
|
| 149 | - ) { |
|
| 150 | - /* We need to disambiguate the user's instructions */ |
|
| 151 | - $member_options = false; |
|
| 152 | - ?> |
|
| 148 | + ) |
|
| 149 | + ) { |
|
| 150 | + /* We need to disambiguate the user's instructions */ |
|
| 151 | + $member_options = false; |
|
| 152 | + ?> |
|
| 153 | 153 | <div class="alert-section alert-section--disambiguation"> |
| 154 | 154 | <div class="alert-section__primary"> |
| 155 | 155 | |
| 156 | 156 | <?php if ($members) { |
| 157 | - $member_options = true; ?> |
|
| 157 | + $member_options = true; ?> |
|
| 158 | 158 | <h3><?= sprintf(gettext('Sign up for alerts when people matching <i>%s</i> speaks'), _htmlspecialchars($search_term)) ?></h3> |
| 159 | 159 | <ul> |
| 160 | 160 | <?php |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | <input type="hidden" name="pid" value="<?= $row['person_id'] ?>"> |
| 168 | 168 | <input type="hidden" name="ignore_speaker_votes" value="<?= $ignore_speaker_votes ?>"> |
| 169 | 169 | <?php |
| 170 | - $name = member_full_name($row['house'], $row['title'], $row['given_name'], $row['family_name'], $row['lordofname']); |
|
| 170 | + $name = member_full_name($row['house'], $row['title'], $row['given_name'], $row['family_name'], $row['lordofname']); |
|
| 171 | 171 | if ($row['constituency']) { |
| 172 | 172 | $name .= ' (' . gettext($row['constituency']) . ')'; |
| 173 | 173 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | <?php } ?> |
| 183 | 183 | |
| 184 | 184 | <?php if ($alertsearch) { |
| 185 | - if (!$member_options) { ?> |
|
| 185 | + if (!$member_options) { ?> |
|
| 186 | 186 | <h3><?= gettext('That doesn’t match a person, postcode or constituency. Search again to refine your email alert.') ?></h3> |
| 187 | 187 | <ul> |
| 188 | 188 | <?php if (isset($mistakes['postcode_and'])) { ?> |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | want? You will only get an alert if all of these |
| 194 | 194 | are mentioned in the same debate.') ?> |
| 195 | 195 | <?php if (isset($member_alertsearch)) { |
| 196 | - printf(gettext('Did you mean to get alerts for when your representative mentions something instead? If so maybe you want to subscribe to…')); |
|
| 197 | - } ?> |
|
| 196 | + printf(gettext('Did you mean to get alerts for when your representative mentions something instead? If so maybe you want to subscribe to…')); |
|
| 197 | + } ?> |
|
| 198 | 198 | </em> |
| 199 | 199 | </li> |
| 200 | 200 | <?php } ?> |
@@ -25,37 +25,37 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function testKeywordOnly() { |
| 28 | - $page = $this->fetch_page([ 'alertsearch' => 'elephant']); |
|
| 28 | + $page = $this->fetch_page(['alertsearch' => 'elephant']); |
|
| 29 | 29 | $this->assertStringContainsString('What word or phrase would you like to receive alerts about', $page); |
| 30 | 30 | $this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value="elephant"', $page); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function testSpeakerId() { |
| 34 | - $page = $this->fetch_page([ 'alertsearch' => 'speaker:2']); |
|
| 34 | + $page = $this->fetch_page(['alertsearch' => 'speaker:2']); |
|
| 35 | 35 | $this->assertStringContainsString('Mrs Test Current-MP', $page); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function testPostCodeOnly() { |
| 39 | - $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE']); |
|
| 39 | + $page = $this->fetch_page(['alertsearch' => 'SE17 3HE']); |
|
| 40 | 40 | $this->assertStringContainsString('Mrs Test Current-MP', $page); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function testPostCodeWithKeyWord() { |
| 44 | - $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE elephant']); |
|
| 44 | + $page = $this->fetch_page(['alertsearch' => 'SE17 3HE elephant']); |
|
| 45 | 45 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
| 46 | 46 | $this->assertStringContainsString('Mentions of [elephant] by your MP, Mrs Test Current-MP', $page); |
| 47 | 47 | $this->assertStringNotContainsString('by your MSP', $page); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function testScottishPostcodeWithKeyword() { |
| 51 | - $page = $this->fetch_page([ 'alertsearch' => 'PH6 2DB elephant']); |
|
| 51 | + $page = $this->fetch_page(['alertsearch' => 'PH6 2DB elephant']); |
|
| 52 | 52 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
| 53 | 53 | $this->assertStringContainsString('Mentions of [elephant] by your MP, Mr Test2 Current-MP', $page); |
| 54 | 54 | $this->assertStringContainsString('Mentions of [elephant] by your MSP, Mrs Test Current-MSP', $page); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function testPostcodeAndKeywordWithNoSittingMP() { |
| 58 | - $page = $this->fetch_page([ 'alertsearch' => 'OX1 4LF elephant']); |
|
| 58 | + $page = $this->fetch_page(['alertsearch' => 'OX1 4LF elephant']); |
|
| 59 | 59 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
| 60 | 60 | $this->assertStringNotContainsString('Did you mean to get alerts for when your MP', $page); |
| 61 | 61 | } |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | * @group xapian |
| 65 | 65 | */ |
| 66 | 66 | public function testBasicKeyWordAlertsCreation() { |
| 67 | - $page = $this->fetch_page([ 'step' => 'define']); |
|
| 67 | + $page = $this->fetch_page(['step' => 'define']); |
|
| 68 | 68 | $this->assertStringContainsString('What word or phrase would you like to receive alerts about', $page); |
| 69 | 69 | $this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value=""', $page); |
| 70 | 70 | |
| 71 | - $page = $this->fetch_page([ 'step' => 'review', 'email' => '[email protected]', 'words[]' => 'fish']); |
|
| 71 | + $page = $this->fetch_page(['step' => 'review', 'email' => '[email protected]', 'words[]' => 'fish']); |
|
| 72 | 72 | $this->assertStringContainsString('Review Your Alert', $page); |
| 73 | 73 | $this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); |
| 74 | 74 | |
| 75 | - $page = $this->fetch_page([ 'step' => 'confirm', 'email' => '[email protected]', 'words[]' => 'fish']); |
|
| 75 | + $page = $this->fetch_page(['step' => 'confirm', 'email' => '[email protected]', 'words[]' => 'fish']); |
|
| 76 | 76 | $this->assertStringContainsString('We’re nearly done', $page); |
| 77 | 77 | $this->assertStringContainsString('You should receive an email shortly', $page); |
| 78 | 78 | } |
@@ -81,16 +81,16 @@ discard block |
||
| 81 | 81 | * @group xapian |
| 82 | 82 | */ |
| 83 | 83 | public function testMultipleKeyWordAlertsCreation() { |
| 84 | - $page = $this->fetch_page([ 'step' => 'define']); |
|
| 84 | + $page = $this->fetch_page(['step' => 'define']); |
|
| 85 | 85 | $this->assertStringContainsString('What word or phrase would you like to receive alerts about', $page); |
| 86 | 86 | $this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value=""', $page); |
| 87 | 87 | |
| 88 | - $page = $this->fetch_page([ 'step' => 'review', 'email' => '[email protected]', 'words[]' => ['fish', 'salmon']]); |
|
| 88 | + $page = $this->fetch_page(['step' => 'review', 'email' => '[email protected]', 'words[]' => ['fish', 'salmon']]); |
|
| 89 | 89 | $this->assertStringContainsString('Review Your Alert', $page); |
| 90 | 90 | $this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); |
| 91 | 91 | $this->assertStringContainsString('<input type="hidden" name="words[]" value="salmon"', $page); |
| 92 | 92 | |
| 93 | - $page = $this->fetch_page([ 'step' => 'confirm', 'email' => '[email protected]', 'words[]' => ['fish', 'salmon']]); |
|
| 93 | + $page = $this->fetch_page(['step' => 'confirm', 'email' => '[email protected]', 'words[]' => ['fish', 'salmon']]); |
|
| 94 | 94 | $this->assertStringContainsString('You should receive an email shortly', $page); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | $this->assertStringContainsString('What word or phrase would you like to receive alerts about', $page); |
| 103 | 103 | $this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value=""', $page); |
| 104 | 104 | |
| 105 | - $page = $this->get_page([ 'step' => 'review', 'words[]' => ['fish', 'salmon']]); |
|
| 105 | + $page = $this->get_page(['step' => 'review', 'words[]' => ['fish', 'salmon']]); |
|
| 106 | 106 | $this->assertStringContainsString('Review Your Alert', $page); |
| 107 | 107 | $this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); |
| 108 | 108 | $this->assertStringContainsString('<input type="hidden" name="words[]" value="salmon"', $page); |
| 109 | 109 | |
| 110 | - $page = $this->get_page([ 'step' => 'confirm', 'words[]' => ['fish', 'salmon']]); |
|
| 110 | + $page = $this->get_page(['step' => 'confirm', 'words[]' => ['fish', 'salmon']]); |
|
| 111 | 111 | $this->assertStringContainsString('You will now receive email alerts on any day when [fish salmon] is mentioned in parliament', $page); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); |
| 141 | 141 | $this->assertStringContainsString('<input type="hidden" name="representative" value="Mrs Test Current-MP"', $page); |
| 142 | 142 | |
| 143 | - $page = $this->get_page([ 'step' => 'confirm', 'words[]' => 'fish', 'representative' => 'Mrs Test Current-MP']); |
|
| 143 | + $page = $this->get_page(['step' => 'confirm', 'words[]' => 'fish', 'representative' => 'Mrs Test Current-MP']); |
|
| 144 | 144 | $this->assertStringContainsString('You will now receive email alerts on any day when Mrs Test Current-MP mentions [fish] in parliament', $page); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | private function fetch_mp_recent_page() { |
| 16 | - $vars = [ 'pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent' ]; |
|
| 16 | + $vars = ['pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent']; |
|
| 17 | 17 | return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/recent.php'); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | private function fetch_recent_page() { |
| 21 | - return $this->base_fetch_page(['url' => '/divisions' ], 'divisions', 'index.php', '/divisions/index.php'); |
|
| 21 | + return $this->base_fetch_page(['url' => '/divisions'], 'divisions', 'index.php', '/divisions/index.php'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function testSingleDivision() { |
| 57 | - $page = $this->base_fetch_page(['url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons' ], 'divisions', 'division.php', '/divisions/division.php'); |
|
| 57 | + $page = $this->base_fetch_page(['url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons'], 'divisions', 'division.php', '/divisions/division.php'); |
|
| 58 | 58 | $this->assertStringContainsString('A majority of MPs <b>voted in favour</b> of a thing', $page); |
| 59 | 59 | $this->assertStringContainsString('Aye: 200', $page); |
| 60 | 60 | $this->assertStringNotContainsString('No:', $page); # Summary 100, but no actual votes. In reality, summary can only be <= actual. |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $og_image_parl = $extra_vars['_social_image_parliament'] ?? 'uk'; |
| 32 | 32 | $og_image_url = \MySociety\TheyWorkForYou\Url::generateSocialImageUrl($og_image_title, $og_image_subtitle, $og_image_parl); |
| 33 | 33 | |
| 34 | - $html = preg_replace_callback('/<h([1-3])>([^<]+)<\/h[1-3]>/i', function ($matches) { |
|
| 34 | + $html = preg_replace_callback('/<h([1-3])>([^<]+)<\/h[1-3]>/i', function($matches) { |
|
| 35 | 35 | $level = $matches[1]; |
| 36 | 36 | $htitle = $matches[2]; |
| 37 | 37 | $slug = slugify($htitle); |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $group_name = $policies->getSetDescriptions()[$set_slug]; |
| 88 | 88 | $group_slug = $set_slug; |
| 89 | 89 | $comparison_period_slug = $period_slug; |
| 90 | - $policy_pairs = array_filter($pairs, function ($pair) use ($policy_ids) { |
|
| 90 | + $policy_pairs = array_filter($pairs, function($pair) use ($policy_ids) { |
|
| 91 | 91 | $is_policy_valid = in_array($pair->getPolicyID(), $policy_ids); |
| 92 | 92 | $has_own_distribution = $pair->member_distribution !== null && !$pair->member_distribution->noDataAvailable(); |
| 93 | 93 | return $is_policy_valid && $has_own_distribution; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | private function getMemberFromPersonId($person_id) { |
| 111 | - return new MySociety\TheyWorkForYou\Member([ "person_id" => $person_id ]); |
|
| 111 | + return new MySociety\TheyWorkForYou\Member(["person_id" => $person_id]); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function testMPPartyPolicyTextWhenDiffersVotes() { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // this is a single person party i think - so no party comparison? |
| 138 | 138 | // need to check what votes would actually produce |
| 139 | 139 | |
| 140 | - $page = $this->fetch_page(['pid' => 4, 'pagetype' => 'votes','url' => '/mp/4/test_mp_d/test_westminster_constituency/votes']); |
|
| 140 | + $page = $this->fetch_page(['pid' => 4, 'pagetype' => 'votes', 'url' => '/mp/4/test_mp_d/test_westminster_constituency/votes']); |
|
| 141 | 141 | $this->assertStringContainsString('Test MP D', $page); |
| 142 | 142 | $this->assertStringContainsString('<li class="vote-description"', $page); |
| 143 | 143 | $this->assertStringNotContainsString('comparable B Party MPs voted', $page); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // this is just a boring, person aligned with party example |
| 150 | 150 | |
| 151 | - $page = $this->fetch_page(['pagetype' => 'votes', 'pid' => 16, 'url' => '/mp/16/test_mp_g_party_2/test_westminster_constituency/votes']); |
|
| 151 | + $page = $this->fetch_page(['pagetype' => 'votes', 'pid' => 16, 'url' => '/mp/16/test_mp_g_party_2/test_westminster_constituency/votes']); |
|
| 152 | 152 | $this->assertStringContainsString('Test MP G Party 2', $page); |
| 153 | 153 | |
| 154 | 154 | $this->assertStringNotContainsString('sometimes differs from their party colleagues', $page); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | </div> |
| 15 | 15 | <?php endif; ?> |
| 16 | 16 | |
| 17 | - <?php $vote_count = isset($divisions) ? count($divisions) : 0;?> |
|
| 17 | + <?php $vote_count = isset($divisions) ? count($divisions) : 0; ?> |
|
| 18 | 18 | |
| 19 | 19 | <div class="panel"> |
| 20 | 20 | <div class="policy-votes-intro"> |