Passed
Push — master ( bda982...e47a27 )
by Sam
09:19 queued 04:25
created
tests/UserPageTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
      */
9 9
     public function getDataSet()
10 10
     {
11
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/user.xml');
11
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/user.xml');
12 12
     }
13 13
 
14 14
     private function fetch_page($vars)
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
         return $this->base_fetch_page($vars, 'user');
17 17
     }
18 18
 
19
-    private function fetch_user_page( $vars = array(), $page = 'user' )
19
+    private function fetch_user_page($vars = array(), $page = 'user')
20 20
     {
21
-        return $this->base_fetch_page_user( $vars, '1.fbb689a0c092f5534b929d302db2c8a9', $page );
21
+        return $this->base_fetch_page_user($vars, '1.fbb689a0c092f5534b929d302db2c8a9', $page);
22 22
     }
23 23
 
24 24
     public function testLoginPageLoads()
25 25
     {
26
-        $page = $this->base_fetch_page( array(), 'user/login' );
26
+        $page = $this->base_fetch_page(array(), 'user/login');
27 27
         $this->assertContains('Sign in', $page);
28 28
     }
29 29
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             'password' => 'password',
35 35
             'submitted' => 'true',
36 36
         );
37
-        $page = $this->base_fetch_page( $vars, 'user/login' );
37
+        $page = $this->base_fetch_page($vars, 'user/login');
38 38
         # it's a redirect which means we should get nothing
39 39
         # as we're using the cli version of php :(
40 40
         $this->assertEquals('', $page);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function testEditUserInfo()
51 51
     {
52
-        $page = $this->fetch_user_page( array('pg' => 'edit' ) );
52
+        $page = $this->fetch_user_page(array('pg' => 'edit'));
53 53
         $this->assertContains('Edit your details', $page);
54 54
         $this->assertContains('name="pg" value="edit"', $page);
55 55
         $this->assertContains('value="Test"', $page);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             'email' => '[email protected]',
63 63
             'submitted' => 'true',
64 64
         );
65
-        $page = $this->fetch_user_page( $vars );
65
+        $page = $this->fetch_user_page($vars);
66 66
         $this->assertContains('Example User', $page);
67 67
     }
68 68
 }
Please login to merge, or discard this patch.
www/docs/admin/profile-message.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,6 +91,6 @@
 block discarded – undo
91 91
     <span class="formw"><input type="submit" name="submit" value="Update"></span>
92 92
 </div>
93 93
 </form>
94
-EOF;
94
+eof;
95 95
     return $out;
96 96
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         if ($row['constituency']) {
48 48
             $desc .= ', ' . $row['constituency'];
49 49
         }
50
-        $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n";
50
+        $out .= '<option value="' . $p_id . '">' . $desc . '</option>' . "\n";
51 51
     }
52 52
 
53 53
     $out .= ' </select></span> </div> ';
Please login to merge, or discard this patch.
tests/AlertsTest.php 1 patch
Spacing   +4 added lines, -4 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/alerts.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/alerts.xml');
15 15
     }
16 16
 
17 17
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $ALERT = new ALERT();
33 33
 
34
-        $response = $ALERT->fetch(0,0);
34
+        $response = $ALERT->fetch(0, 0);
35 35
 
36 36
         // Make sure we only get one response
37 37
         $this->assertEquals(1, count($response['data']));
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $ALERT = new ALERT();
50 50
 
51
-        $response = $ALERT->fetch(1,0);
51
+        $response = $ALERT->fetch(1, 0);
52 52
 
53 53
         // Make sure we only get two responses
54 54
         $this->assertEquals(2, count($response['data']));
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $ALERT = new ALERT();
67 67
 
68
-        $response = $ALERT->fetch_between(1,0, '2014-02-03', '2014-02-04');
68
+        $response = $ALERT->fetch_between(1, 0, '2014-02-03', '2014-02-04');
69 69
 
70 70
         // Make sure we only get one response
71 71
         $this->assertEquals(1, count($response['alerts']));
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/by-person.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,8 @@
 block discarded – undo
111 111
                                 <?php if ( $house !=  HOUSE_TYPE_LORDS) { ?>
112 112
                                   <?= isset($speaker['office']) ? ' - ' . join('; ', $speaker['office']) : '' ?>
113 113
                                 <?php } ?>
114
-                              <?php } else { // no $pid ?>
114
+                              <?php } else {
115
+// no $pid ?>
115 116
                                 <?= $speaker['name'] ?>
116 117
                               <?php } ?>
117 118
                             </td>
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
             <div class="search-page__section__primary">
10 10
                 <h2>Who says <em class="current-search-term"><?= _htmlentities($searchstring) ?></em> the most?</h2>
11 11
 
12
-              <?php if ( isset($error) ) { ?>
13
-                <?php if ( $error == 'No results' && isset( $house ) && $house != HOUSE_TYPE_ROYAL ) { ?>
12
+              <?php if (isset($error)) { ?>
13
+                <?php if ($error == 'No results' && isset($house) && $house != HOUSE_TYPE_ROYAL) { ?>
14 14
                   <ul class="search-result-display-options">
15 15
                       <li>
16
-                        <?php if ( $house ==  HOUSE_TYPE_COMMONS) { ?>
16
+                        <?php if ($house == HOUSE_TYPE_COMMONS) { ?>
17 17
                           No results for MPs only
18
-                        <?php } else if ( $house ==  HOUSE_TYPE_LORDS) { ?>
18
+                        <?php } else if ($house == HOUSE_TYPE_LORDS) { ?>
19 19
                           No results for Peers only
20
-                        <?php } else if ( $house == HOUSE_TYPE_SCOTLAND) { ?>
20
+                        <?php } else if ($house == HOUSE_TYPE_SCOTLAND) { ?>
21 21
                           No results for MSPs only
22
-                        <?php } else if ( $house ==  HOUSE_TYPE_NI) { ?>
22
+                        <?php } else if ($house == HOUSE_TYPE_NI) { ?>
23 23
                           No results for MLAs only
24 24
                         <?php } ?>
25 25
                           |
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 <?php } ?>
32 32
               <?php } ?>
33 33
 
34
-              <?php if ( $wtt ) { ?>
34
+              <?php if ($wtt) { ?>
35 35
                 <p><strong>Now, try reading what a couple of these Lords are saying,
36 36
                 to help you find someone appropriate. When you've found someone,
37 37
                 follow the "I want to write to (name of lord)" link on their results page
@@ -39,37 +39,37 @@  discard block
 block discarded – undo
39 39
                 </strong></p>
40 40
               <?php } ?>
41 41
 
42
-              <?php if ( isset($speakers) && count($speakers) ) { ?>
42
+              <?php if (isset($speakers) && count($speakers)) { ?>
43 43
 
44
-                  <?php if ( !$wtt ) { ?>
44
+                  <?php if (!$wtt) { ?>
45 45
                     <ul class="search-result-display-options">
46 46
                         <li>Results grouped by person</li>
47 47
                         <li>
48
-                          <?php if ( $house ==  HOUSE_TYPE_ROYAL) { ?>
48
+                          <?php if ($house == HOUSE_TYPE_ROYAL) { ?>
49 49
                             Show All
50 50
                           <?php } else { ?>
51 51
                             <a href="<?= $this_url->generate('html') ?>">Show All</a>
52 52
                           <?php } ?>
53 53
                             |
54
-                          <?php if ( $house ==  HOUSE_TYPE_COMMONS) { ?>
54
+                          <?php if ($house == HOUSE_TYPE_COMMONS) { ?>
55 55
                             MPs only
56 56
                           <?php } else { ?>
57 57
                             <a href="<?= $this_url->generate('html', array('house'=>1)) ?>">MPs only</a>
58 58
                           <?php } ?>
59 59
                             |
60
-                          <?php if ( $house ==  HOUSE_TYPE_LORDS) { ?>
60
+                          <?php if ($house == HOUSE_TYPE_LORDS) { ?>
61 61
                             Peers only
62 62
                           <?php } else { ?>
63 63
                             <a href="<?= $this_url->generate('html', array('house'=>2)) ?>">Lords only</a>
64 64
                           <?php } ?>
65 65
                             |
66
-                          <?php if ( $house ==  HOUSE_TYPE_SCOTLAND) { ?>
66
+                          <?php if ($house == HOUSE_TYPE_SCOTLAND) { ?>
67 67
                             MSPs only
68 68
                           <?php } else { ?>
69 69
                             <a href="<?= $this_url->generate('html', array('house'=>4)) ?>">MSPs only</a>
70 70
                           <?php } ?>
71 71
                             |
72
-                          <?php if ( $house ==  HOUSE_TYPE_NI) { ?>
72
+                          <?php if ($house == HOUSE_TYPE_NI) { ?>
73 73
                             MLAs only
74 74
                           <?php } else { ?>
75 75
                             <a href="<?= $this_url->generate('html', array('house'=>HOUSE_TYPE_NI)) ?>">MLAs only</a>
@@ -90,25 +90,25 @@  discard block
 block discarded – undo
90 90
                         </tr>
91 91
                     </thead>
92 92
                     <tbody>
93
-                      <?php foreach ( $speakers as $pid => $speaker ) { ?>
93
+                      <?php foreach ($speakers as $pid => $speaker) { ?>
94 94
 
95
-                        <?php if ( $wtt && $pid == 0 ) { continue; } // skip heading count for WTT lords list ?>
95
+                        <?php if ($wtt && $pid == 0) { continue; } // skip heading count for WTT lords list ?>
96 96
 
97 97
                         <tr>
98 98
                             <td><?= $speaker['count'] ?></td>
99 99
                             <td>
100
-                              <?php if ( $pid ) { ?>
101
-                                <?php if ( !$wtt || $speaker['left'] == '9999-12-31' ) { ?>
100
+                              <?php if ($pid) { ?>
101
+                                <?php if (!$wtt || $speaker['left'] == '9999-12-31') { ?>
102 102
                                   <a href="/search/?q=<?= _htmlentities($searchstring) ?>&amp;pid=<?= $pid ?><?= isset($wtt) && $speaker['left'] == '9999-12-31' ? '&amp;wtt=2' : '' ?>">
103 103
                                 <?php } ?>
104 104
                                 <?= isset($speaker['name']) ? $speaker['name'] : 'N/A' ?>
105
-                                <?php if ( !$wtt || $speaker['left'] == '9999-12-31' ) { ?>
105
+                                <?php if (!$wtt || $speaker['left'] == '9999-12-31') { ?>
106 106
                                   </a>
107 107
                                 <?php } ?>
108
-                                <?php if ( isset($speaker['party']) ) { ?>
108
+                                <?php if (isset($speaker['party'])) { ?>
109 109
                                   <span class="search-results-grouped__speaker-party">(<?= $speaker['party'] ?>)</span>
110 110
                                 <?php } ?>
111
-                                <?php if ( $house !=  HOUSE_TYPE_LORDS) { ?>
111
+                                <?php if ($house != HOUSE_TYPE_LORDS) { ?>
112 112
                                   <?= isset($speaker['office']) ? ' - ' . join('; ', $speaker['office']) : '' ?>
113 113
                                 <?php } ?>
114 114
                               <?php } else { // no $pid ?>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                               <?php } ?>
117 117
                             </td>
118 118
                             <td>
119
-                              <?php if ( format_date($speaker['pmindate'], 'M Y') == format_date($speaker['pmaxdate'], 'M Y') ) { ?>
119
+                              <?php if (format_date($speaker['pmindate'], 'M Y') == format_date($speaker['pmaxdate'], 'M Y')) { ?>
120 120
                                 <?= format_date($speaker['pmindate'], 'M Y') ?>
121 121
                               <?php } else { ?>
122 122
                                 <?= format_date($speaker['pmindate'], 'M Y') ?>&nbsp;&ndash;&nbsp;<?= format_date($speaker['pmaxdate'], 'M Y') ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/header.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
                 } else if ($the_users_mp) {
56 56
                     $wtt_url = $wtt_url . "?a=WMC&amp;pc=" . _htmlentities(urlencode($user_postcode));
57 57
                 }
58
-              ?>
58
+                ?>
59 59
                 <a href="<?= $wtt_url ?>" class="button" onclick="trackLinkClick(this, 'Links', 'WriteToThem', 'Person'); return false;">Send a message</a>
60 60
               <?php } ?>
61 61
               <?php if ($has_email_alerts) { ?>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <div class="person-header <?= $current_member_anywhere ? '' : 'person-header--historical'; ?>">
2 2
     <div class="full-page__row">
3 3
         <div class="full-page__unit">
4
-          <?php if ( $image ) { ?>
4
+          <?php if ($image) { ?>
5 5
             <div class="person-header__image <?= $image['size'] == 'S' ? 'person-header__image--small' : '' ?>">
6
-              <?php if ( $image['size'] == 'S' ) { ?>
6
+              <?php if ($image['size'] == 'S') { ?>
7 7
                 <span style="background-image: url('<?= $image['url'] ?>');"></span>
8 8
               <?php } ?>
9 9
                 <img src="<?= $image['url'] ?>">
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
           <?php } ?>
12 12
             <div class="person-header__about">
13 13
                 <h1 class="person-header__about__name"><?= ucfirst($full_name) ?></h1>
14
-              <?php if ( $known_for ) { ?>
14
+              <?php if ($known_for) { ?>
15 15
                 <p class="person-header__about__known-for">
16 16
                     <?= $known_for ?>
17 17
                 </p>
18 18
               <?php } ?>
19
-              <?php if ( $latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL ) { ?>
19
+              <?php if ($latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL) { ?>
20 20
                 <p class="person-header__about__position">
21 21
                     <span class="person-header__about__position__role">
22 22
                         <?= $latest_membership['current'] ? '' : 'Former' ?>
23 23
                         <?= $latest_membership['party'] == 'Bishop' ? '' : $latest_membership['party'] ?>
24 24
                         <?= $latest_membership['rep_name'] ?>
25 25
                     </span>
26
-                  <?php if ( $latest_membership['constituency'] ) { ?>
26
+                  <?php if ($latest_membership['constituency']) { ?>
27 27
                     for
28 28
                     <span class="person-header__about__position__constituency">
29 29
                         <?= $latest_membership['constituency'] ?>
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
               <?php } ?>
34 34
               <?php if (count($social_links) > 0) { ?>
35 35
                 <p class="person-header__about__media">
36
-                  <?php foreach ($social_links as $link){ ?>
36
+                  <?php foreach ($social_links as $link) { ?>
37 37
                       <a href="<?= $link['href'] ?>" onclick="trackLinkClick(this, 'Social-Link', '<?= $link['type'] ?>', '<?= $link['text'] ?>'); return false;"><?= $link['text'] ?></a>
38 38
                   <?php } ?>
39 39
                 </p>
Please login to merge, or discard this patch.
www/docs/user/index.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -107,10 +107,10 @@
 block discarded – undo
107 107
 
108 108
 // if data has been submitted then handle that
109 109
 if (
110
-      get_http_var("submitted") == "true" && (
110
+        get_http_var("submitted") == "true" && (
111 111
         $this_page == 'useredit' || $this_page == 'otheruseredit' || $this_page == 'userjoin'
112
-      )
113
-   ) {
112
+        )
113
+    ) {
114 114
     // Put all the user-submitted data in an array.
115 115
     $data = $user->getUpdateDetails($this_page, $THEUSER);
116 116
     $data['ret'] = get_http_var("ret");
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         // We need a user_id. So make sure that exists.
31 31
         // And make sure the user is allowed to do this!
32 32
         $template = 'user/form';
33
-        if (is_numeric( get_http_var("u") ) && $THEUSER->is_able_to("edituser")) {
33
+        if (is_numeric(get_http_var("u")) && $THEUSER->is_able_to("edituser")) {
34 34
 
35 35
             $data = $user->getUserDetails(get_http_var('u'));
36 36
             $data['showall'] = true;
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/user/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
           <div class="row">
39 39
             <span class="label">Website</span>
40
-            <span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span>
40
+            <span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">' . _htmlentities($website) . '</a>' ?></span>
41 41
           </div>
42 42
 
43 43
           <?php if ($facebook_user) { ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/user/view_user.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
                 <div class="row">
10 10
                 <span class="label">Website</span>
11
-                <span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">'. _htmlentities($website) . '</a>' ?></span>
11
+                <span class="formw"><?= $website == '' ? 'none' : '<a rel="nofollow" href="' . _htmlentities($website) . '">' . _htmlentities($website) . '</a>' ?></span>
12 12
                 </div>
13 13
 
14 14
                 <div class="row">
Please login to merge, or discard this patch.
classes/User.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $data['url'] = $user->url();
33 33
         $data['email'] = $user->email();
34 34
         $data['optin'] = $user->optin() == true ? "Yes" : "No";
35
-        $data['postcode']	= $user->postcode();
35
+        $data['postcode'] = $user->postcode();
36 36
         $data['website']	= $user->url();
37
-        $data['registrationtime']	= $user->registrationtime();
38
-        $data['status']= $user->status();
37
+        $data['registrationtime'] = $user->registrationtime();
38
+        $data['status'] = $user->status();
39 39
         $data["deleted"] = $user->deleted();
40 40
         $data["confirmed"] = $user->confirmed();
41 41
         $data["status"] = $user->status();
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
         // Who are we updating? $THEUSER or someone else?
243 243
         if ($this_page == "otheruseredit") {
244 244
             $who = 'the user&rsquo;s';
245
-            $success = $THEUSER->update_other_user ( $details );
245
+            $success = $THEUSER->update_other_user($details);
246 246
         } else {
247 247
             $who = 'your';
248
-            $success = $THEUSER->update_self ( $details );
248
+            $success = $THEUSER->update_self($details);
249 249
         }
250 250
 
251 251
 
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
         // If this goes well, the user will have their data
278 278
         // added to the database and a confirmation email
279 279
         // will be sent to them.
280
-        $success = $THEUSER->add ( $details );
280
+        $success = $THEUSER->add($details);
281 281
 
282 282
         $errors = array();
283 283
 
284 284
         if (!$success) {
285
-            $errors["db"] = "Sorry, we were unable to create an account for you. Please <a href=\"mailto:". str_replace('@', '&#64;', CONTACTEMAIL) . "\">let us know</a>. Thanks.";
285
+            $errors["db"] = "Sorry, we were unable to create an account for you. Please <a href=\"mailto:" . str_replace('@', '&#64;', CONTACTEMAIL) . "\">let us know</a>. Thanks.";
286 286
         }
287 287
 
288 288
         return $errors;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 
291 291
     public function getRep($cons_type, $mp_house) {
292 292
         global $THEUSER;
293
-        if ( !$THEUSER->has_postcode() ) {
293
+        if (!$THEUSER->has_postcode()) {
294 294
             return array();
295 295
         }
296 296
 
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
         // Scottish homepage
304 304
         try {
305 305
             $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($THEUSER->postcode());
306
-            if ( isset($constituencies[$cons_type]) ) {
306
+            if (isset($constituencies[$cons_type])) {
307 307
                 $constituency = $constituencies[$cons_type];
308 308
                 $MEMBER = new Member(array('constituency'=>$constituency, 'house'=> $mp_house));
309 309
             }
310
-        } catch ( MemberException $e ) {
310
+        } catch (MemberException $e) {
311 311
             return array();
312 312
         }
313 313
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $mreg = array();
345 345
         if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) {
346 346
             $reps = \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, $mp_house, $cons_type);
347
-            foreach ( $reps as $rep ) {
347
+            foreach ($reps as $rep) {
348 348
                 $member = new \MySociety\TheyWorkForYou\Member(array('person_id' => $rep['person_id']));
349 349
                 $mreg[$rep['person_id']] = $this->constructMPData($member, $THEUSER, $mp_house);
350 350
             }
Please login to merge, or discard this patch.