Completed
Pull Request — master (#1450)
by Nick
06:22
created
www/docs/admin/users.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/person.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
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); ?>)
Please login to merge, or discard this patch.
www/docs/api/api_getConstituencies.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
classes/MiniSurvey.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tests/PageTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&eacute;in MPs do not take their seats in Parliament.', $page);
52 52
     }
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
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&eacute;in MPs do not take their seats in Parliament.', $page);
61 61
     }
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/divisions/_vote_summary.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
scripts/alertmailer.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -339,7 +339,7 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@
 block discarded – undo
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];
Please login to merge, or discard this patch.
www/includes/easyparliament/alert.php 3 patches
Braces   +30 added lines, -13 removed lines patch added patch discarded remove patch
@@ -340,17 +340,20 @@  discard block
 block discarded – undo
340 340
     }
341 341
 
342 342
     public function check_token($token) {
343
-        if (!is_null($this->token_checked))
344
-            return $this->token_checked;
343
+        if (!is_null($this->token_checked)) {
344
+                    return $this->token_checked;
345
+        }
345 346
 
346 347
         $arg = strstr($token, '::') ? '::' : '-';
347 348
         $token_parts = explode($arg, $token);
348
-        if (count($token_parts) != 2)
349
-            return false;
349
+        if (count($token_parts) != 2) {
350
+                    return false;
351
+        }
350 352
 
351 353
         list($alert_id, $registrationtoken) = $token_parts;
352
-        if (!is_numeric($alert_id) || !$registrationtoken)
353
-            return false;
354
+        if (!is_numeric($alert_id) || !$registrationtoken) {
355
+                    return false;
356
+        }
354 357
 
355 358
         $q = $this->db->query("SELECT alert_id, email, criteria
356 359
                         FROM alerts
@@ -398,7 +401,9 @@  discard block
 block discarded – undo
398 401
     // If all goes well the alert will be confirmed.
399 402
     // The alert will be active when scripts run each day to send the actual emails.
400 403
     public function confirm($token) {
401
-        if (!($alert = $this->check_token($token))) return false;
404
+        if (!($alert = $this->check_token($token))) {
405
+            return false;
406
+        }
402 407
         $this->criteria = $alert['criteria'];
403 408
         $this->email = $alert['email'];
404 409
         $r = $this->db->query("UPDATE alerts SET confirmed = 1, deleted = 0 WHERE alert_id = :alert_id", array(
@@ -412,7 +417,9 @@  discard block
 block discarded – undo
412 417
     // and the deletion page has passed the token from the URL to here.
413 418
     // If all goes well the alert will be deleted.
414 419
     public function delete($token) {
415
-        if (!($alert = $this->check_token($token))) return false;
420
+        if (!($alert = $this->check_token($token))) {
421
+            return false;
422
+        }
416 423
         $r = $this->db->query("DELETE FROM alerts WHERE alert_id = :alert_id", array(
417 424
             ':alert_id' => $alert['id']
418 425
             ));
@@ -421,7 +428,9 @@  discard block
 block discarded – undo
421 428
     }
422 429
 
423 430
     public function delete_all($token) {
424
-        if (!($alert = $this->check_token($token))) return false;
431
+        if (!($alert = $this->check_token($token))) {
432
+            return false;
433
+        }
425 434
         $r = $this->db->query("DELETE FROM alerts WHERE email = :email", array(
426 435
             ':email' => $alert['email']
427 436
             ));
@@ -430,7 +439,9 @@  discard block
 block discarded – undo
430 439
     }
431 440
 
432 441
     public function suspend($token) {
433
-        if (!($alert = $this->check_token($token))) return false;
442
+        if (!($alert = $this->check_token($token))) {
443
+            return false;
444
+        }
434 445
         $r = $this->db->query("UPDATE alerts SET deleted = 2 WHERE alert_id = :alert_id", array(
435 446
             ':alert_id' => $alert['id']
436 447
             ));
@@ -439,7 +450,9 @@  discard block
 block discarded – undo
439 450
     }
440 451
 
441 452
     public function resume($token) {
442
-        if (!($alert = $this->check_token($token))) return false;
453
+        if (!($alert = $this->check_token($token))) {
454
+            return false;
455
+        }
443 456
         $r = $this->db->query("UPDATE alerts SET deleted = 0 WHERE alert_id = :alert_id", array(
444 457
             ':alert_id' => $alert['id']
445 458
             ));
@@ -460,8 +473,12 @@  discard block
 block discarded – undo
460 473
             }
461 474
         }
462 475
         $criteria = '';
463
-        if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
464
-        if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
476
+        if (count($words)) {
477
+            $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
478
+        }
479
+        if ($spokenby) {
480
+            $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
481
+        }
465 482
         return $criteria;
466 483
     }
467 484
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@
 block discarded – undo
52 52
 // FUNCTION: fetch_between
53 53
 
54 54
     public function fetch_between($confirmed, $deleted, $start_date, $end_date) {
55
-      // Return summary data on all the alerts that were created between $start_date
56
-      // and $end_date (inclusive) and whose confirmed and deleted values match the booleans
57
-      // passed in $confirmed and $deleted
55
+        // Return summary data on all the alerts that were created between $start_date
56
+        // and $end_date (inclusive) and whose confirmed and deleted values match the booleans
57
+        // passed in $confirmed and $deleted
58 58
         $q = $this->db->query("SELECT   criteria, count(*) as cnt
59 59
             FROM     alerts
60 60
             WHERE    confirmed = :confirmed
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public $token_checked = null;
42 42
     private $alert_id = "";
43 43
     public $email = "";
44
-    public $criteria = "";		// Sets the terms that are used to produce the search results.
44
+    public $criteria = ""; // Sets the terms that are used to produce the search results.
45 45
 
46 46
     private $db;
47 47
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             $contents = array('criteria' => $row['criteria'], 'count' => $row['cnt']);
73 73
             $data[] = $contents;
74 74
         }
75
-        $data = array ('alerts' => $data);
75
+        $data = array('alerts' => $data);
76 76
         return $data;
77 77
     }
78 78
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
             $data[] = $contents;
112 112
         }
113 113
         $info = "Alert";
114
-        $data = array ('info' => $info, 'data' => $data);
114
+        $data = array('info' => $info, 'data' => $data);
115 115
 
116 116
         return $data;
117 117
     }
118 118
 
119
-    public function add($details, $confirmation_email=false, $instantly_confirm=true) {
119
+    public function add($details, $confirmation_email = false, $instantly_confirm = true) {
120 120
 
121 121
         // Adds a new alert's info into the database.
122 122
         // Then calls another function to send them a confirmation email.
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             // This gives a code for their email address which is then joined
180 180
             // to the timestamp so as to provide a unique ID for each alert.
181 181
 
182
-            $token = substr( password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16 );
182
+            $token = substr(password_hash($details["email"] . microtime(), PASSWORD_BCRYPT), 29, 16);
183 183
 
184 184
             // Full stops don't work well at the end of URLs in emails,
185 185
             // so replace them. We won't be doing anything clever with the hash
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
 
253 253
         $urltoken = $this->alert_id . '-' . $this->registrationtoken;
254 254
 
255
-        if ( isset($details['confirm_base']) && $details['confirm_base'] !== '' ) {
255
+        if (isset($details['confirm_base']) && $details['confirm_base'] !== '') {
256 256
             $confirmurl = $details['confirm_base'] . $urltoken;
257 257
         } else {
258 258
             $confirmurl = 'https://' . DOMAIN . '/A/' . $urltoken;
259 259
         }
260 260
 
261 261
         // Arrays we need to send a templated email.
262
-        $data = array (
262
+        $data = array(
263 263
             'to' 		=> $details['email'],
264 264
             'template' 	=> 'alert_confirmation'
265 265
         );
266 266
 
267
-        $merge = array (
267
+        $merge = array(
268 268
             'FIRSTNAME' 	=> 'THEY WORK FOR YOU',
269 269
             'LASTNAME' 		=> ' ALERT CONFIRMATION',
270 270
             'CONFIRMURL'	=> $confirmurl,
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     }
281 281
 
282 282
     public function send_already_signedup_email($details) {
283
-        $data = array (
283
+        $data = array(
284 284
             'to' 		=> $details['email'],
285 285
             'template' 	=> 'alert_already_signedup'
286 286
         );
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details);
289 289
         $this->criteria = $criteria;
290 290
 
291
-        $merge = array (
291
+        $merge = array(
292 292
             'FIRSTNAME' 	=> 'THEY WORK FOR YOU',
293 293
             'LASTNAME' 		=> ' ALERT ALREADY SIGNED UP',
294 294
             'CRITERIA'	=> $this->criteria_pretty()
@@ -448,17 +448,17 @@  discard block
 block discarded – undo
448 448
     public function email() { return $this->email; }
449 449
     public function criteria() { return $this->criteria; }
450 450
     public function criteria_pretty($html = false) {
451
-        $criteria = explode(' ',$this->criteria);
451
+        $criteria = explode(' ', $this->criteria);
452 452
         $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($this->criteria));
453 453
         $words = array();
454 454
         foreach ($criteria as $c) {
455
-            if (!preg_match('#^speaker:(\d+)#',$c,$m)) {
455
+            if (!preg_match('#^speaker:(\d+)#', $c, $m)) {
456 456
                 $words[] = $c;
457 457
             }
458 458
         }
459 459
         $criteria = '';
460
-        if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html?'</li>':'') . "\n";
461
-        if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Things by " . implode(' or ', $spokenby) . ($html?'</li>':'') . "\n";
460
+        if (count($words)) $criteria .= ($html ? '<li>' : '* ') . 'Mentions of [' . implode(' ', $words) . ']' . ($html ? '</li>' : '') . "\n";
461
+        if ($spokenby) $criteria .= ($html ? '<li>' : '* ') . "Things by " . implode(' or ', $spokenby) . ($html ? '</li>' : '') . "\n";
462 462
         return $criteria;
463 463
     }
464 464
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/people/index.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                           Based on postcode <strong><?= $mp_data['postcode'] ?></strong>
27 27
                           <a href="<?= $mp_data['change_url'] ?>">(Change postcode)</a>
28 28
                       </p>
29
-                    <?php if ( isset( $mp_data ) && $type != 'mlas' ) { ?>
29
+                    <?php if (isset($mp_data) && $type != 'mlas') { ?>
30 30
                       <h3>Your <?= $mp_data['former'] ? $mp_data['former'] . ' ' : '' ?><?= $rep_name ?> is</h3>
31 31
                     </div>
32 32
                     <a href="<?= $mp_data['mp_url'] ?>" class="people-list__person">
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
                         </p>
39 39
                     </a>
40 40
                     <?php }
41
-                    if ( isset($reps) ) {
42
-                        if ( isset($mp_data) && $type != 'mlas' ) { ?>
41
+                    if (isset($reps)) {
42
+                        if (isset($mp_data) && $type != 'mlas') { ?>
43 43
                     <div class="people-list__your-mp__replist-header">
44 44
                         <?php } ?>
45 45
                       <h3>Your <?=$former ?> <?= $rep_plural == 'MSPs' ? 'regional ' : '' ?><?= $rep_plural ?> are</h3>
46 46
                     </div>
47
-                        <?php foreach ( $reps as $rep ) { ?>
47
+                        <?php foreach ($reps as $rep) { ?>
48 48
                     <a href="<?= $rep['mp_url'] ?>" class="people-list__person">
49 49
                     <img class="people-list__person__image" src="<?= $rep['image'] ?>">
50 50
                         <h2 class="people-list__person__name"><?= $rep['name'] ?></h2>
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             <div class="search-page__section search-page__section--search">
66 66
                 <div class="search-page__section__primary">
67 67
                     <p class="search-page-main-inputs">
68
-                    <?php if ( $type == 'peers' ) { ?>
68
+                    <?php if ($type == 'peers') { ?>
69 69
                         <label for="find-mp-by-name-or-postcode">Find <?= $rep_plural ?> by name:</label>
70
-                    <?php } elseif ( $type == 'mlas' || $type == 'msps' ) { ?>
70
+                    <?php } elseif ($type == 'mlas' || $type == 'msps') { ?>
71 71
                         <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by postcode:</label>
72 72
                     <?php } else { ?>
73 73
                         <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by name or postcode:</label>
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
             <div class="search-page__section__primary">
109 109
             <h2>All <?= $rep_plural ?></h2>
110 110
 
111
-                <?php if ( $type != 'peers' ) { ?>
111
+                <?php if ($type != 'peers') { ?>
112 112
                 <ul class="search-result-display-options">
113
-                    <?php if ( $order == 'given_name' ) { ?>
113
+                    <?php if ($order == 'given_name') { ?>
114 114
                     <li><strong>Sorted by</strong> First name</li>
115 115
                     <li>Sort by <a href="<?= $urls['by_last'] ?>">Last name</a> / <a href="<?= $urls['by_party'] ?>">Party</a></li>
116
-                    <?php } else if ( $order == 'party' ) { ?>
116
+                    <?php } else if ($order == 'party') { ?>
117 117
                     <li><strong>Sorted by</strong> Party</li>
118 118
                     <li>Sort by <a href="<?= $urls['by_first'] ?>">First name</a> / <a href="<?= $urls['by_last'] ?>">Last name</a></li>
119 119
                     <?php } else { ?>
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 </ul>
124 124
                 <?php } else { ?>
125 125
                 <ul class="search-result-display-options">
126
-                    <?php if ( $order == 'party' ) { ?>
126
+                    <?php if ($order == 'party') { ?>
127 127
                     <li><strong>Sorted by</strong> Party</li>
128 128
                     <li>Sort by <a href="<?= $urls['by_name'] ?>">Name</a></li>
129 129
                     <?php } else { ?>
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
                     }
174 174
                 }
175 175
                 $initial_link = '';
176
-                foreach ( $data as $person ) {
176
+                foreach ($data as $person) {
177 177
                     if ($order != 'party') {
178
-                        $initial = substr( strtoupper($person[$a_to_z_key]), 0, 1);
179
-                        if ( $initial != $current_initial ) {
178
+                        $initial = substr(strtoupper($person[$a_to_z_key]), 0, 1);
179
+                        if ($initial != $current_initial) {
180 180
                             $current_initial = $initial;
181 181
                             $initial_link = "name=\"$initial\" ";
182 182
                         } else {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 <img class="people-list__person__image" src="<?= $person['image'] ?>">
189 189
                         <h2 class="people-list__person__name"><?= ucfirst($person['name']) ?></h2>
190 190
                         <p class="people-list__person__memberships">
191
-                        <?php if ( $person['constituency'] ) { ?>
191
+                        <?php if ($person['constituency']) { ?>
192 192
                         <span class="people-list__person__constituency"><?= $person['constituency'] ?></span>
193 193
                         <?php } ?>
194 194
                         <span class="people-list__person__party <?= slugify($person['party']) ?>"><?= $person['party'] ?></span>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 <a href="<?= $urls['by_csv'] ?>">Download this list as a CSV</a>
207 207
                     suitable for Excel
208 208
                 </p>
209
-                <?php if ( $type == 'mps' ) { ?>
209
+                <?php if ($type == 'mps') { ?>
210 210
                 <form method="get" action="<?= $urls['plain'] ?>" class="sidebar-item-with-icon sidebar-item-with-icon--date">
211 211
                     <p>
212 212
                         Or view a past list
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                   })
259 259
                 });
260 260
                 </script>
261
-                <?php } else if ( $type == 'msps' ) { ?>
261
+                <?php } else if ($type == 'msps') { ?>
262 262
                     <p class="past-list-dates" id="past-list-dates">
263 263
                         <a href="<?= $urls['plain'] ?>?date=2011-05-05">MSPs at 2011 election</a>
264 264
                         <a href="<?= $urls['plain'] ?>?date=2007-05-03">MSPs at 2007 election</a>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                     </p>
273 273
                 <?php } ?>
274 274
 
275
-                <?php include( dirname(__FILE__) . '/../sidebar/looking_for.php' ) ?>
275
+                <?php include(dirname(__FILE__) . '/../sidebar/looking_for.php') ?>
276 276
             </div>
277 277
         </div>
278 278
 
Please login to merge, or discard this patch.