Completed
Pull Request — master (#1325)
by Nick
05:34
created
www/includes/easyparliament/templates/html/glossary.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $USERURL->insert(array('u'=>$comment['user_id']));
78 78
         ?>
79 79
         <div class="comment">
80
-            <p><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) .' '. _htmlentities($comment['lastname']); ?></strong></a><br>
80
+            <p><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) . ' ' . _htmlentities($comment['lastname']); ?></strong></a><br>
81 81
 <?php
82 82
         // Make URLs into links and do <br>s.
83 83
         $body = prepare_comment_for_display($comment['body']); // In utility.php
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         if (($this_page != 'commentreport' &&
108
-            $this_page != 'addcomment'  &&
108
+            $this_page != 'addcomment' &&
109 109
             $this_page != 'admin_commentreport')
110 110
             && $THEUSER->is_able_to('reportcomment')
111 111
             && !$comment['modflagged']
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/api/comments.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         // COMMENT REPORTING LINK.
83 83
 
84 84
         if (($this_page != 'commentreport' &&
85
-            $this_page != 'addcomment'  &&
85
+            $this_page != 'addcomment' &&
86 86
             $this_page != 'admin_commentreport')
87 87
             && $THEUSER->is_able_to('reportcomment')
88 88
             && $THEUSER->user_id() != $comment['user_id']
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $date = format_date($date, SHORTDATEFORMAT);
118 118
         $time = format_time($time, TIMEFORMAT);
119 119
         ?>
120
-                    <p class="credit"><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) .' '. _htmlentities($comment['lastname']); ?></strong></a><br>
120
+                    <p class="credit"><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) . ' ' . _htmlentities($comment['lastname']); ?></strong></a><br>
121 121
                     <small>Posted on <?php echo $date;
122 122
 
123 123
         if (isset($comment['url'])) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         } else {
127 127
             // There won't be a URL when we're just previewing a comment.
128
-            print ' '.$time;
128
+            print ' ' . $time;
129 129
         }
130 130
         ?> <?php echo $reporthtml; ?></small></p>
131 131
 
Please login to merge, or discard this patch.
www/includes/easyparliament/sidebars/mps.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     'body'=>''));
10 10
 ?>
11 11
 <p>
12
-    Vacher Dods charge <a href="http://www.dodonline.co.uk/engine.asp?showPage=article&id=2564"> 95 pounds </a> for this list of MPs names. We think democracy should be free. Click <?php echo '<a href="'.$csvurl.'">here</a>'; ?> to download a CSV (Comma Separated Values) file that you can load into Excel.
12
+    Vacher Dods charge <a href="http://www.dodonline.co.uk/engine.asp?showPage=article&id=2564"> 95 pounds </a> for this list of MPs names. We think democracy should be free. Click <?php echo '<a href="' . $csvurl . '">here</a>'; ?> to download a CSV (Comma Separated Values) file that you can load into Excel.
13 13
 </p>
14 14
 <?php
15 15
 $this->block_end();
Please login to merge, or discard this patch.
www/includes/easyparliament/sidebars/calendar_future.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 list($firstyear, $firstmonth, $day) = explode('-', $min_future_date);
34 34
 list($finalyear, $finalmonth, $day) = explode('-', $max_future_date);
35 35
 
36
-$q =  $db->query("SELECT DISTINCT(event_date) AS event_date FROM future
36
+$q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future
37 37
     WHERE event_date >= :firstdate
38 38
     AND event_date <= :finaldate
39 39
     AND deleted = 0
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 if ($q->rows() > 0) {
47 47
     $years = array();
48
-    for ($row=0; $row<$q->rows(); $row++) {
48
+    for ($row = 0; $row < $q->rows(); $row++) {
49 49
         list($year, $month, $day) = explode('-', $q->field($row, 'event_date'));
50 50
         $month = intval($month);
51 51
         $years[$year][$month][] = intval($day);
Please login to merge, or discard this patch.
www/includes/easyparliament/sidebars/minisurvey.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 if ($hide_question) {
34 34
     $always_ask = 0;
35 35
     $show_survey_qn = $current_question;
36
-    setcookie('survey', $current_question, time()+60*60*24*365, '/');
36
+    setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
37 37
 } elseif ($has_answered_question == $current_question && !$always_ask) {
38 38
     $show_survey_qn = $current_question;
39
-    setcookie('survey', $current_question, time()+60*60*24*365, '/');
39
+    setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
40 40
 } elseif (isset($_COOKIE['survey'])) {
41 41
     $show_survey_qn = $_COOKIE['survey'];
42 42
 }
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
 if ($show_survey_qn < $current_question && !$has_answered_question) {
50 50
     $page_url = '';
51 51
     $hide_url = '';
52
-    if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) {
52
+    if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) {
53 53
         global $MEMBER;
54 54
         $page_url = $MEMBER->url(true) . "?answered_survey=$current_question";
55 55
         $hide_url = $MEMBER->url() . "?hide_survey=$current_question";
56 56
     } else {
57 57
         $URL = new URL($this_page);
58
-        $URL->insert(array('answered_survey' => $current_question ));
58
+        $URL->insert(array('answered_survey' => $current_question));
59 59
         $page_url = 'https://' . DOMAIN . $URL->generate();
60 60
         $URL = new URL($this_page);
61
-        $URL->insert(array('hide_survey' => $current_question ));
61
+        $URL->insert(array('hide_survey' => $current_question));
62 62
         $hide_url = $URL->generate();
63 63
     }
64 64
 
Please login to merge, or discard this patch.
www/includes/easyparliament/commentreportlist.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         // available for editing, it's accurate.
25 25
         $this->_update_locked();
26 26
 
27
-        $data = $this->_get_data_by_recent ();
27
+        $data = $this->_get_data_by_recent();
28 28
 
29 29
         $this->render($data);
30 30
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 
100 100
         if ($q->rows() > 0) {
101 101
 
102
-            for ($n=0; $n<$q->rows(); $n++) {
102
+            for ($n = 0; $n < $q->rows(); $n++) {
103 103
 
104
-                $data[] = array (
105
-                    'report_id'		=> $q->field($n,'report_id'),
106
-                    'comment_id' 	=> $q->field($n,'comment_id'),
104
+                $data[] = array(
105
+                    'report_id'		=> $q->field($n, 'report_id'),
106
+                    'comment_id' 	=> $q->field($n, 'comment_id'),
107 107
                     'firstname'		=> $q->field($n, 'firstname'),
108 108
                     'lastname'		=> $q->field($n, 'lastname'),
109 109
                     'body'			=> $q->field($n, 'body'),
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 
115 115
         }
116 116
         if ($r->rows() > 0) {
117
-            for ($n=0; $n<$r->rows(); $n++) {
118
-                $data[] = array (
119
-                    'report_id'		=> $r->field($n,'report_id'),
120
-                    'comment_id' 	=> $r->field($n,'comment_id'),
117
+            for ($n = 0; $n < $r->rows(); $n++) {
118
+                $data[] = array(
119
+                    'report_id'		=> $r->field($n, 'report_id'),
120
+                    'comment_id' 	=> $r->field($n, 'comment_id'),
121 121
                     'firstname'		=> $r->field($n, 'firstname'),
122 122
                     'lastname'		=> $r->field($n, 'lastname'),
123 123
                     'body'			=> $r->field($n, 'body'),
Please login to merge, or discard this patch.
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('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.
tests/FetchPageTestCase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     protected function base_fetch_page($vars, $dir, $page = 'index.php', $req_uri = '')
10 10
     {
11 11
         foreach ($vars as $k => $v) {
12
-            $vars[$k] =  $k . '=' . urlencode($v);
12
+            $vars[$k] = $k . '=' . urlencode($v);
13 13
         }
14 14
 
15 15
         if (!$req_uri) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     protected function base_fetch_page_user($vars, $cookie, $dir, $page = 'index.php', $req_uri = '')
27 27
     {
28 28
         foreach ($vars as $k => $v) {
29
-            $vars[$k] =  $k . '=' . urlencode($v);
29
+            $vars[$k] = $k . '=' . urlencode($v);
30 30
         }
31 31
 
32 32
         if (!$req_uri) {
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/search/results.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
         <div class="search-page__section search-page__section--results">
10 10
             <div class="search-page__section__primary">
11 11
               <?php
12
-              # XXX Hack
13
-              if (preg_match('#budget#', $searchstring)) { ?>
12
+                # XXX Hack
13
+                if (preg_match('#budget#', $searchstring)) { ?>
14 14
                 <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3>
15 15
               <?php } ?>
16 16
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <div class="full-page">
2
-    <div class="full-page__row search-page <?php if ( !$searchstring ) { ?>search-page--blank<?php } ?>">
2
+    <div class="full-page__row search-page <?php if (!$searchstring) { ?>search-page--blank<?php } ?>">
3 3
 
4 4
         <form class="js-search-form-without-options">
5 5
             <?php include 'form_main.php'; ?>
6 6
         </form>
7 7
 
8
-      <?php if ( $searchstring && !isset($warnings) ) { ?>
8
+      <?php if ($searchstring && !isset($warnings)) { ?>
9 9
         <div class="search-page__section search-page__section--results">
10 10
             <div class="search-page__section__primary">
11 11
               <?php
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
                 <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3>
15 15
               <?php } ?>
16 16
 
17
-              <?php if ( $cons ) { ?>
18
-                <?php if ( count($cons) > 1 ) {
17
+              <?php if ($cons) { ?>
18
+                <?php if (count($cons) > 1) {
19 19
                     $types = array();
20
-                    if ( $mp_types['mp'] > 0 ) {
20
+                    if ($mp_types['mp'] > 0) {
21 21
                         $types[] = 'MPs';
22 22
                     }
23
-                    if ( $mp_types['former'] > 0 ) {
23
+                    if ($mp_types['former'] > 0) {
24 24
                         $types[] = 'former MPs';
25 25
                     }
26 26
                     $desc = ucfirst(implode(' and ', $types));
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
                 <?php } else { // count($cons) <= 1 ?>
30 30
                   <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2>
31 31
                 <?php } ?>
32
-                <?php foreach ( $cons as $member ) { ?>
32
+                <?php foreach ($cons as $member) { ?>
33 33
                   <?php include('person.php'); ?>
34 34
                 <?php } ?>
35 35
               <?php } ?>
36 36
 
37
-              <?php if ( $members ) { ?>
37
+              <?php if ($members) { ?>
38 38
                 <h2>People matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2>
39
-                <?php foreach ( $members as $member ) { ?>
39
+                <?php foreach ($members as $member) { ?>
40 40
                     <?php include('person.php'); ?>
41 41
                 <?php } ?>
42 42
                 <hr>
@@ -44,25 +44,25 @@  discard block
 block discarded – undo
44 44
 
45 45
               <?php if ($glossary) { ?>
46 46
                 <h2>Glossary items matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2>
47
-                <?php foreach ( $glossary as $item ) { ?>
47
+                <?php foreach ($glossary as $item) { ?>
48 48
                     <?php include('glossary.php'); ?>
49 49
                 <?php } ?>
50 50
                 <hr>
51 51
               <?php } ?>
52 52
 
53
-              <?php if ( isset($pid) && $wtt == 2 ) { ?>
53
+              <?php if (isset($pid) && $wtt == 2) { ?>
54 54
                 <p>I want to <a href="https://www.writetothem.com/lords/?pid=<?= $pid ?>">write to <?= $wtt_lord_name ?></a></p>
55 55
               <?php } ?>
56 56
 
57
-              <?php if ( isset($error) ) { ?>
57
+              <?php if (isset($error)) { ?>
58 58
                 There was an error &ndash; <?= $error ?> &ndash; searching for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em>.
59 59
               <?php } else { ?>
60 60
                 <h2>
61
-                  <?php if ( $pagination_links ) { ?>
61
+                  <?php if ($pagination_links) { ?>
62 62
                     Results <?= $pagination_links['first_result'] ?>&ndash;<?= $pagination_links['last_result'] ?> of <?= $info['total_results'] ?>
63
-                  <?php } else if ( $info['total_results'] == 1 ) { ?>
63
+                  <?php } else if ($info['total_results'] == 1) { ?>
64 64
                     The only result
65
-                  <?php } else if ( $info['total_results'] == 0 ) { ?>
65
+                  <?php } else if ($info['total_results'] == 0) { ?>
66 66
                     There were no results
67 67
                   <?php } else { ?>
68 68
                     All <?= $info['total_results'] ?> results
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
                     for <em class="current-search-term"><?= _htmlentities($searchdescription) ?></em>
71 71
                 </h2>
72 72
 
73
-                  <?php if ( $info['spelling_correction'] ) { ?>
74
-                    <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities( $info['spelling_correction_display'] ) ?></a>?</p>
73
+                  <?php if ($info['spelling_correction']) { ?>
74
+                    <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities($info['spelling_correction_display']) ?></a>?</p>
75 75
                   <?php } ?>
76 76
 
77
-                  <?php if ( $info['total_results'] ) { ?>
77
+                  <?php if ($info['total_results']) { ?>
78 78
                     <ul class="search-result-display-options">
79
-                      <?php if ( $sort_order == 'relevance' ) { ?>
79
+                      <?php if ($sort_order == 'relevance') { ?>
80 80
                         <li>Sorted by relevance</li>
81 81
                         <li>Sort by date: <a href="<?= $urls['newest'] ?>">newest</a> / <a href="<?= $urls['oldest'] ?>">oldest</a></li>
82
-                      <?php } else if ( $sort_order == 'oldest' ) { ?>
82
+                      <?php } else if ($sort_order == 'oldest') { ?>
83 83
                         <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li>
84 84
                         <li>Sorted by date: <a href="<?= $urls['newest'] ?>">newest</a> / oldest</li>
85 85
                       <?php } else { ?>
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                     </ul>
91 91
                   <?php } ?>
92 92
 
93
-                  <?php foreach ( $rows as $result ) { ?>
93
+                  <?php foreach ($rows as $result) { ?>
94 94
                     <div class="search-result search-result--generic">
95 95
                         <h3 class="search-result__title"><a href="<?= $result['listurl'] ?>"><?= $result['parent']['body'] ?></a> (<?= format_date($result['hdate'], SHORTDATEFORMAT) ?>)</h3>
96 96
                         <p class="search-result__description"><?= isset($result['speaker']) ? $result['speaker']['name'] . ': ' : '' ?><?= $result['extract'] ?></p>
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
 
100 100
                 <hr>
101 101
 
102
-                  <?php if ( $pagination_links ) { ?>
102
+                  <?php if ($pagination_links) { ?>
103 103
                     <div class="search-result-pagination">
104
-                      <?php if ( isset($pagination_links['prev']) ) { ?>
104
+                      <?php if (isset($pagination_links['prev'])) { ?>
105 105
                         <a href="<?= $pagination_links['firstpage']['url'] ?>" title="First page">&lt;&lt;</a>
106 106
                         <a href="<?= $pagination_links['prev']['url'] ?>" title="Previous page">&lt;</a>
107 107
                       <?php } ?>
108
-                      <?php foreach ( $pagination_links['nums'] as $link ) { ?>
108
+                      <?php foreach ($pagination_links['nums'] as $link) { ?>
109 109
                         <a href="<?= $link['url'] ?>"<?= $link['current'] ? ' class="search-result-pagination__current-page"' : '' ?>><?= $link['page'] ?></a>
110 110
                       <?php } ?>
111
-                      <?php if ( isset($pagination_links['next']) ) { ?>
111
+                      <?php if (isset($pagination_links['next'])) { ?>
112 112
                         <a href="<?= $pagination_links['next']['url'] ?>" title="Next page">&gt;</a>
113 113
                         <a href="<?= $pagination_links['lastpage']['url'] ?>" title="Final page">&gt;&gt;</a>
114 114
                       <?php } ?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@
 block discarded – undo
26 26
                     $desc = ucfirst(implode(' and ', $types));
27 27
                 ?>
28 28
                   <h2><?= $desc ?> in constituencies matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2>
29
-                <?php } else { // count($cons) <= 1 ?>
29
+                <?php } else {
30
+// count($cons) <= 1 ?>
30 31
                   <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2>
31 32
                 <?php } ?>
32 33
                 <?php foreach ( $cons as $member ) { ?>
Please login to merge, or discard this patch.