@@ -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); |
@@ -114,7 +114,10 @@ |
||
| 114 | 114 | <ul> |
| 115 | 115 | <li><span class="appg-property-label">Purpose:</span> <?= $membership->appg->purpose ?></li> |
| 116 | 116 | <li><span class="appg-property-label">Membership Source:</span> <a href="<?= $membership->membership_source_url ?>">Source</a></li> |
| 117 | - <li><span class="appg-property-label">APPG Website:</span> <?php if ($membership->appg->website): ?><a href="<?= $membership->appg->website ?>"><?= $membership->appg->website ?></a><?php else: ?>N/A<?php endif; ?></li> |
|
| 117 | + <li><span class="appg-property-label">APPG Website:</span> <?php if ($membership->appg->website): ?><a href="<?= $membership->appg->website ?>"><?= $membership->appg->website ?></a><?php else { |
|
| 118 | + : ?>N/A<?php endif; |
|
| 119 | +} |
|
| 120 | +?></li> |
|
| 118 | 121 | <li><span class="appg-property-label">APPG register:</span> <a href="<?= $membership->appg->source_url ?>">Parliament website</a></li> |
| 119 | 122 | </ul> |
| 120 | 123 | </div> |
@@ -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"> |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | public $body = ''; |
| 31 | 31 | public $posted = ''; |
| 32 | 32 | public $visible = false; |
| 33 | - public $modflagged = null; // Is a datetime when set. |
|
| 34 | - public $firstname = ''; // Of the person who posted it. |
|
| 33 | + public $modflagged = null; // Is a datetime when set. |
|
| 34 | + public $firstname = ''; // Of the person who posted it. |
|
| 35 | 35 | public $lastname = ''; |
| 36 | 36 | public $url = ''; |
| 37 | 37 | |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | if ($q) { |
| 71 | 71 | |
| 72 | 72 | $this->comment_id = $comment_id; |
| 73 | - $this->user_id = $q['user_id']; |
|
| 73 | + $this->user_id = $q['user_id']; |
|
| 74 | 74 | $this->epobject_id = $q['epobject_id']; |
| 75 | - $this->body = $q['body']; |
|
| 76 | - $this->posted = $q['posted']; |
|
| 77 | - $this->visible = $q['visible']; |
|
| 78 | - $this->modflagged = $q['modflagged']; |
|
| 75 | + $this->body = $q['body']; |
|
| 76 | + $this->posted = $q['posted']; |
|
| 77 | + $this->visible = $q['visible']; |
|
| 78 | + $this->modflagged = $q['modflagged']; |
|
| 79 | 79 | |
| 80 | 80 | // Sets the URL and username for this comment. Duh. |
| 81 | 81 | $this->_set_url(); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (!$THEUSER->is_able_to('addcomment')) { |
| 145 | - $message = [ |
|
| 145 | + $message = [ |
|
| 146 | 146 | 'title' => 'Sorry', |
| 147 | 147 | 'text' => 'You are not allowed to post annotations.', |
| 148 | 148 | ]; |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | if ($q->success()) { |
| 205 | 205 | // Set the object varibales up. |
| 206 | - $this->comment_id = $q->insert_id(); |
|
| 207 | - $this->user_id = $THEUSER->user_id(); |
|
| 208 | - $this->epobject_id = $data['epobject_id']; |
|
| 209 | - $this->body = $data['body']; |
|
| 210 | - $this->posted = $posted; |
|
| 211 | - $this->visible = 1; |
|
| 206 | + $this->comment_id = $q->insert_id(); |
|
| 207 | + $this->user_id = $THEUSER->user_id(); |
|
| 208 | + $this->epobject_id = $data['epobject_id']; |
|
| 209 | + $this->body = $data['body']; |
|
| 210 | + $this->posted = $posted; |
|
| 211 | + $this->visible = 1; |
|
| 212 | 212 | |
| 213 | 213 | return $this->comment_id(); |
| 214 | 214 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | public function display($format = 'html', $template = 'comments') { |
| 222 | - $data['comments'][0] = [ |
|
| 222 | + $data['comments'][0] = [ |
|
| 223 | 223 | 'comment_id' => $this->comment_id, |
| 224 | 224 | 'user_id' => $this->user_id, |
| 225 | 225 | 'epobject_id' => $this->epobject_id, |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $this->modflagged = $date; |
| 268 | 268 | return true; |
| 269 | 269 | } else { |
| 270 | - $message = [ |
|
| 270 | + $message = [ |
|
| 271 | 271 | 'title' => 'Sorry', |
| 272 | 272 | 'text' => "We couldn't update the annotation's modflag.", |
| 273 | 273 | ]; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | if ($q->success()) { |
| 290 | 290 | return true; |
| 291 | 291 | } else { |
| 292 | - $message = [ |
|
| 292 | + $message = [ |
|
| 293 | 293 | 'title' => 'Sorry', |
| 294 | 294 | 'text' => "We were unable to delete the annotation.", |
| 295 | 295 | ]; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | - $message = [ |
|
| 301 | + $message = [ |
|
| 302 | 302 | 'title' => 'Sorry', |
| 303 | 303 | 'text' => "You are not authorised to delete annotations.", |
| 304 | 304 | ]; |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | 'posted' => date('Y-m-d H:i:s', time()), |
| 67 | 67 | 'modflagged' => null, |
| 68 | 68 | 'visible' => 1, |
| 69 | - 'preview' => true, // Extra tag so we know this is just a preview. |
|
| 69 | + 'preview' => true, // Extra tag so we know this is just a preview. |
|
| 70 | 70 | ]; |
| 71 | 71 | |
| 72 | 72 | $COMMENTLIST = new COMMENTLIST(); |
@@ -12,11 +12,14 @@ |
||
| 12 | 12 | <?php $detail = $upper_detail; ?> |
| 13 | 13 | </ul> |
| 14 | 14 | </li> |
| 15 | -<?php else : ?> |
|
| 15 | +<?php else { |
|
| 16 | + : ?> |
|
| 16 | 17 | <li class="interest-detail"> |
| 17 | 18 | <?php if ($detail->has_value()): ?> |
| 18 | 19 | <span class="interest-detail-name"><?= $detail->display_as ?>: </span> |
| 19 | 20 | <span class="interest-detail-value"><?= htmlspecialchars($detail->value) ?></span> |
| 20 | - <?php endif; ?> |
|
| 21 | + <?php endif; |
|
| 22 | +} |
|
| 23 | +?> |
|
| 21 | 24 | </li> |
| 22 | 25 | <?php endif; ?> |
| 23 | 26 | \ No newline at end of file |