Passed
Pull Request — master (#1601)
by Sam
06:27
created
www/docs/admin/featured.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $out = '';
13 13
 if (get_http_var('preview')) {
14 14
     preview_featured();
15
-} else if ( get_http_var('confirm') ) {
15
+} else if (get_http_var('confirm')) {
16 16
     $out = update_featured();
17 17
 }
18 18
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 print '</div>';
24 24
 
25 25
 function gid_to_url($gid) {
26
-    if ( !$gid ) {
26
+    if (!$gid) {
27 27
         return '';
28 28
     }
29 29
     global $hansardmajors;
30 30
     global $db;
31 31
 
32
-    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ))->first();
32
+    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid))->first();
33 33
     $url_gid = fix_gid_from_db($gid);
34 34
     $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']);
35 35
     $url->insert(array('id' => $url_gid));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     $related = $featured->get_related();
44 44
     $context = $featured->get_context();
45 45
 
46
-    if ( get_http_var('url') ) {
46
+    if (get_http_var('url')) {
47 47
         $url = get_http_var('url');
48 48
         $title = get_http_var('title');
49 49
         $context = get_http_var('context');
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
     $related_gid3 = $related3 ? get_gid_from_url($related3) : null;
114 114
 
115 115
     print "<h2>Preview Content</h2>";
116
-    if ( $gid !== null ) {
116
+    if ($gid !== null) {
117 117
         $h = new MySociety\TheyWorkForYou\Homepage;
118
-        $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 ));
118
+        $featured = $h->getFeaturedDebate($gid, $title, $context, array($related_gid1, $related_gid2, $related_gid3));
119 119
 
120 120
         include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php';
121 121
     } else {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     $parts = parse_url($url);
158 158
     parse_str($parts['query'], $query);
159 159
 
160
-    if ( $query['id'] ) {
160
+    if ($query['id']) {
161 161
         if (strpos($parts['path'], 'lords') !== false) {
162 162
             $gid = 'uk.org.publicwhip/lords/';
163 163
         } elseif (strpos($parts['path'], 'whall') !== false) {
Please login to merge, or discard this patch.
www/docs/admin/edittopic.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,34 +11,34 @@  discard block
 block discarded – undo
11 11
 
12 12
 $slug = get_http_var('id');
13 13
 if ($slug) {
14
-  $topic = $topics->getTopic($slug);
14
+    $topic = $topics->getTopic($slug);
15 15
 } else {
16
-  $topic = new \MySociety\TheyWorkForYou\Topic();
16
+    $topic = new \MySociety\TheyWorkForYou\Topic();
17 17
 }
18 18
 
19 19
 $action = get_http_var('action');
20 20
 switch ($action) {
21 21
     case 'add':
22 22
       $success = add_topic($topic);
23
-      break;
23
+        break;
24 24
     case 'update':
25 25
       $success = update_topic($topic);
26
-      break;
26
+        break;
27 27
     case 'setimage':
28 28
       $success = add_image($topic);
29
-      break;
29
+        break;
30 30
     case 'addcontent':
31 31
       $success = add_content($topic);
32
-      break;
32
+        break;
33 33
     case 'deletecontent':
34 34
       $success = delete_content($topic);
35
-      break;
35
+        break;
36 36
     case 'addpolicysets':
37 37
       $success = add_policy_sets($topic);
38
-      break;
38
+        break;
39 39
     case 'addpolicies':
40 40
       $success = add_policies($topic);
41
-      break;
41
+        break;
42 42
     default:
43 43
       $success = null;
44 44
 }
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
             <select name="sets[]" multiple>
126 126
               <option value="">None</option>
127 127
             <?php
128
-              $policies = new \MySociety\TheyWorkForYou\Policies;
129
-              $set_descriptions = $policies->getSetDescriptions();
130
-              $related_sets = $topic->getPolicySets();
131
-              foreach ($set_descriptions as $set => $description) { ?>
128
+                $policies = new \MySociety\TheyWorkForYou\Policies;
129
+                $set_descriptions = $policies->getSetDescriptions();
130
+                $related_sets = $topic->getPolicySets();
131
+                foreach ($set_descriptions as $set => $description) { ?>
132 132
               <option value="<?= $set ?>" <?= in_array($set, $related_sets) ? 'selected' : '' ?>><?= $description ?></option>
133 133
             <?php } ?>
134 134
             <input type="submit" value="Update">
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
             <select name="policies[]" multiple>
144 144
               <option value="">None</option>
145 145
             <?php
146
-              $policies = new \MySociety\TheyWorkForYou\Policies;
147
-              $all_policies = $policies->getPolicies();
148
-              $related_policies = $topic->getPolicies();
149
-              foreach ($all_policies as $number => $description) { ?>
146
+                $policies = new \MySociety\TheyWorkForYou\Policies;
147
+                $all_policies = $policies->getPolicies();
148
+                $related_policies = $topic->getPolicies();
149
+                foreach ($all_policies as $number => $description) { ?>
150 150
               <option value="<?= $number ?>" <?= in_array($number, $related_policies) ? 'selected' : '' ?>><?= $description ?></option>
151 151
             <?php } ?>
152 152
 
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
             $file_info['tmp_name'],
215 215
             $topic->image_path()
216 216
         );
217
-     } catch (ErrorException $e) {
217
+        } catch (ErrorException $e) {
218 218
         return false;
219
-     }
219
+        }
220 220
 
221 221
     if ($image_saved) {
222 222
         return $topic->save();
Please login to merge, or discard this patch.
www/docs/email/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 <?php
51 51
 } else {
52 52
     $rep_name = $MEMBER->full_name();
53
-    if ($MEMBER->house_disp==1) {
53
+    if ($MEMBER->house_disp == 1) {
54 54
         $rep_name .= ' MP';
55
-    } elseif ($MEMBER->house_disp==3) {
55
+    } elseif ($MEMBER->house_disp == 3) {
56 56
         $rep_name .= ' MLA';
57 57
     }
58
-    $data = array (
58
+    $data = array(
59 59
         'template'      => 'email_a_friend',
60 60
         'to'            => $recipient_email,
61 61
         'subject'       => 'Find out all about ' . $rep_name
62 62
     );
63 63
     $url = $MEMBER->url(true);
64
-    $merge = array (
64
+    $merge = array(
65 65
         'NAME' => $sender_name,
66 66
         'EMAIL' => $sender_email,
67 67
         'REP_NAME' => $rep_name,
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     $success = send_template_email($data, $merge);
72 72
     if ($success) {
73
-        print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to ".$MEMBER->full_name()."'s page</a></p>";
73
+        print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to " . $MEMBER->full_name() . "'s page</a></p>";
74 74
     } else {
75 75
         print "<p>Sorry, something went wrong trying to send an email. Please wait a few minutes and try again.</p>";
76 76
     }
Please login to merge, or discard this patch.
www/docs/glossary/index.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 }
7 7
 
8 8
 include_once '../../includes/easyparliament/init.php';
9
-include_once INCLUDESPATH."easyparliament/glossary.php";
9
+include_once INCLUDESPATH . "easyparliament/glossary.php";
10 10
 
11 11
 $args = array(
12 12
     'sort'				=> "regexp_replace",
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 if ($term) {
50
-    $DATA->set_page_metadata($this_page, 'title', $term['title'].': Glossary item');
50
+    $DATA->set_page_metadata($this_page, 'title', $term['title'] . ': Glossary item');
51 51
     $DATA->set_page_metadata($this_page, 'heading', $term['title']);
52 52
 } else {
53
-    $DATA->set_page_metadata ($this_page, 'title', $GLOSSARY->current_letter.': Glossary index');
54
-    $DATA->set_page_metadata ($this_page, 'heading', 'Glossary index');
53
+    $DATA->set_page_metadata($this_page, 'title', $GLOSSARY->current_letter . ': Glossary index');
54
+    $DATA->set_page_metadata($this_page, 'heading', 'Glossary index');
55 55
 }
56 56
 
57 57
 $PAGE->page_start();
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
     $URL->update(array("gl" => $GLOSSARY->next_term['glossary_id']));
71 71
     $next_link = $URL->generate('url');
72 72
 
73
-    $nextprev = array (
74
-        'next'	=> array (
73
+    $nextprev = array(
74
+        'next'	=> array(
75 75
             'url'	=> $next_link,
76 76
             'title'	=> 'Next term',
77 77
             'body'	=> $GLOSSARY->next_term['title']
78 78
         ),
79
-        'prev'	=> array (
79
+        'prev'	=> array(
80 80
             'url'	=> $previous_link,
81 81
             'title'	=> 'Previous term',
82 82
             'body'	=> $GLOSSARY->previous_term['title']
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     }
110 110
 }
111 111
 
112
-$PAGE->stripe_end(array (
113
-    array (
112
+$PAGE->stripe_end(array(
113
+    array(
114 114
         'type'		=> 'nextprev',
115 115
         'content'	=> ''
116 116
     )
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/recent.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
                 if ( isset($divisions) && $divisions ) {
34 34
                     if ($has_voting_record) {
35 35
                         foreach ($divisions as $division) {
36
-                          $displayed_votes = true;
36
+                            $displayed_votes = true;
37 37
 
38
-                          if ($current_date != $division['date']) {
38
+                            if ($current_date != $division['date']) {
39 39
                             if ($current_date != '' ) {
40
-                              print('</ul></div>');
40
+                                print('</ul></div>');
41 41
                             }
42 42
                             $current_date = $division['date'];
43 43
                             $sidebar_links[] = $division['date'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                             <h2><?= strftime('%e %b %Y', strtotime($division['date'])) ?></h2>
47 47
                              <ul class="vote-descriptions policy-votes">
48 48
                           <?php }
49
-                          include('_division_description.php');
49
+                            include('_division_description.php');
50 50
                         }
51 51
                         echo('</div>');
52 52
                     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
                 $current_date = '';
31 31
                 $sidebar_links = array();
32 32
 
33
-                if ( isset($divisions) && $divisions ) {
33
+                if (isset($divisions) && $divisions) {
34 34
                     if ($has_voting_record) {
35 35
                         foreach ($divisions as $division) {
36 36
                           $displayed_votes = true;
37 37
 
38 38
                           if ($current_date != $division['date']) {
39
-                            if ($current_date != '' ) {
39
+                            if ($current_date != '') {
40 40
                               print('</ul></div>');
41 41
                             }
42 42
                             $current_date = $division['date'];
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
             <div class="sidebar__unit in-page-nav">
64 64
                 <ul>
65
-                  <?php foreach($sidebar_links as $date) { ?>
65
+                  <?php foreach ($sidebar_links as $date) { ?>
66 66
                     <li>
67 67
                         <a href="#<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
68 68
                             <?= strftime('%e %b %Y', strtotime($date)) ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/divisions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         </div>
16 16
         <div class="person-panels">
17 17
             <div class="sidebar__unit in-page-nav">
18
-                <?php if ( isset($policydivisions) && $policydivisions && count($policydivisions) == 1 ) { ?>
18
+                <?php if (isset($policydivisions) && $policydivisions && count($policydivisions) == 1) { ?>
19 19
                 <p class="policy-votes-intro">
20 20
                     How <?= $full_name ?> voted on <?= $policydivisions[array_keys($policydivisions)[0]]['desc'] ?>.
21 21
                 </p>
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
                 <?php endif; ?>
35 35
 
36 36
                 <?php $displayed_votes = false; ?>
37
-                <?php if ( isset($policydivisions) && $policydivisions ) { ?>
37
+                <?php if (isset($policydivisions) && $policydivisions) { ?>
38 38
 
39 39
                     <?php if ($has_voting_record) { ?>
40 40
 
41 41
                         <?php foreach ($policydivisions as $policy) { ?>
42 42
                             <?php
43 43
                                 $show_all = false;
44
-                                if ( $policy['weak_count'] == 0 || $policy['weak_count'] == count($policy['divisions']) ) {
44
+                                if ($policy['weak_count'] == 0 || $policy['weak_count'] == count($policy['divisions'])) {
45 45
                                     $show_all = true;
46 46
                                 }
47 47
                             ?>
48 48
 
49
-                            <?php if ( isset($policy['header']) ) { ?>
49
+                            <?php if (isset($policy['header'])) { ?>
50 50
                                 <div class="panel policy-votes-hero" style="background-image: url('<?php echo $policy['header']['image']; ?>');">
51 51
                                     <h2><?php echo $policy['header']['title']; ?></h2>
52 52
                                     <p><?php echo $policy['header']['description']; ?>.</p>
53
-                                    <?php if ( $policy['header']['image_source'] ) { ?>
53
+                                    <?php if ($policy['header']['image_source']) { ?>
54 54
                                     <span class="policy-votes-hero__image-attribution">
55 55
                                         Photo:
56 56
                                         <a href="<?php echo $policy['header']['image_source']; ?>">
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
                             <?php } ?>
66 66
 
67 67
 
68
-                            <?php if ( isset($policy['position']) ) { ?>
68
+                            <?php if (isset($policy['position'])) { ?>
69 69
                                 <div class="panel">
70
-                                    <?php if ( $policy['position']['has_strong'] ) { ?>
70
+                                    <?php if ($policy['position']['has_strong']) { ?>
71 71
                                         <h3 class="policy-vote-overall-stance">
72 72
                                             <?= $full_name . ' ' . $policy['position']['desc'] ?>
73 73
                                         </h3>
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                                     </ul>
101 101
 
102 102
                                     <div class="policy-votes-list-footer">
103
-                                      <?php if ( !$show_all && $policy['weak_count'] > 0 ) { ?>
103
+                                      <?php if (!$show_all && $policy['weak_count'] > 0) { ?>
104 104
                                         <p><button class="button secondary-button small js-show-all-votes">Show all votes, including <?= $policy['weak_count'] ?> less important <?= $policy['weak_count'] == 1 ? 'vote' : 'votes' ?></button></p>
105 105
                                       <?php } ?>
106 106
                                         <p class="voting-information-provenance">
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/comments_recent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $date = format_date($date, SHORTDATEFORMAT);
36 36
         $time = format_time($time, TIMEFORMAT);
37 37
 
38
-        $count = $n+1;
38
+        $count = $n + 1;
39 39
 
40 40
         $USERURL->insert(array('u'=>$comment['user_id']));
41 41
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     if ($this_page == 'home') {
50 50
         $MOREURL = new \MySociety\TheyWorkForYou\Url('comments_recent');
51 51
         ?>
52
-                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
52
+                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments']) + 1; ?>">See more annotations posted recently</a></p>
53 53
 <?php
54 54
     }
55 55
     if ($this_page != 'home') {
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/divisions/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
           </div>
8 8
           <div class="business-section__primary">
9 9
                <?php
10
-                if ( isset($divisions) && $divisions ) {
10
+                if (isset($divisions) && $divisions) {
11 11
                     $current_date = '';
12 12
                 ?>
13 13
                <ul class="business-list">
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/section/_calendar_section.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
             <?php
2 2
             foreach ($calendar as $year => $months) {
3 3
                 foreach ($months as $month => $dates) {
4
-                     include '_calendar.php';
4
+                        include '_calendar.php';
5 5
                 }
6 6
             } ?>
Please login to merge, or discard this patch.