Passed
Pull Request — master (#1700)
by Struan
04:54
created
www/includes/easyparliament/searchlog.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@
 block discarded – undo
36 36
     public function add($searchlogdata) {
37 37
 
38 38
         $ip = getenv('REMOTE_ADDR');
39
-        if (preg_match('#66\.249\.(6[4-9]|[78]\d|9[0-5])\.#', $ip)) { # Googlebot
39
+        if (preg_match('#66\.249\.(6[4-9]|[78]\d|9[0-5])\.#', $ip)) {
40
+# Googlebot
40 41
             return;
41 42
         }
42 43
         if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('#simplepie|bot#i', $_SERVER['HTTP_USER_AGENT'])) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     // Select popular queries
72 72
     public function popular_recent($count, $max_chars = null) {
73 73
 
74
-        $q =  $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log
74
+        $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log
75 75
                 WHERE count_hits != 0 AND query_string != 'twat'
76 76
            AND query_string != 'suffragettes' AND page_number=1
77 77
                 AND query_time > date_sub(NOW(), INTERVAL 1 DAY)
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $rowarray['query'] = $query;
125 125
         $rowarray['visible_name'] = $visible_name;
126 126
         $rowarray['url'] = $url;
127
-        $rowarray['display'] = '<a href="' . $url . '">' . ($htmlescape ? _htmlentities($visible_name) : $visible_name). '</a>';
127
+        $rowarray['display'] = '<a href="' . $url . '">' . ($htmlescape ? _htmlentities($visible_name) : $visible_name) . '</a>';
128 128
 
129 129
         return $rowarray;
130 130
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
     public function admin_popular_searches($count) {
145 145
 
146
-        $q =  $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log
146
+        $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log
147 147
                 WHERE count_hits != 0 AND query_string NOT LIKE '%speaker:%'
148 148
                 AND query_time > date_sub(NOW(), INTERVAL 30 DAY)
149 149
                 GROUP BY query_string ORDER BY c desc LIMIT $count;");
Please login to merge, or discard this patch.
www/docs/user/prompt/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 $anchor = '#addcomment';
21 21
 
22 22
 $URL = new \MySociety\TheyWorkForYou\Url('userjoin');
23
-$URL->insert(array('ret'=>$returl.$anchor));
23
+$URL->insert(array('ret'=>$returl . $anchor));
24 24
 $joinurl = $URL->generate();
25 25
 
26 26
 
Please login to merge, or discard this patch.
www/docs/index-election.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 $HANSARDURL = new \MySociety\TheyWorkForYou\Url('hansard');
73 73
 $MPURL = new \MySociety\TheyWorkForYou\Url('yourmp');
74 74
 
75
-$PAGE->block_start(array ('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:'));
75
+$PAGE->block_start(array('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:'));
76 76
 ?>
77 77
                         <ol>
78 78
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     } else {
90 90
         $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc');
91 91
     }
92
-    $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1));
92
+    $MEMBER = new MEMBER(array('postcode'=>$THEUSER->postcode(), 'house'=>1));
93 93
     $mpname = $MEMBER->full_name();
94 94
     ?>
95 95
       <p><a href="<?php echo $MPURL->generate(); ?>"><strong>Find out more about how <?php echo $mpname; ?>, your ex-MP, represented you over the last parliament</strong></a><br>
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 //$PAGE->block_end();
186 186
 
187 187
 $PAGE->stripe_end(array(
188
-    array (
188
+    array(
189 189
         'type' => 'include',
190 190
         'content' => 'whatisthissite'
191 191
     ),
192
-    array (
192
+    array(
193 193
         'type' => 'include',
194 194
         'content' => 'sitenews_recent'
195 195
     )
Please login to merge, or discard this patch.
classes/Renderer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $user = new Renderer\User();
44 44
         $data = array_merge($user->data, $data);
45 45
 
46
-        if ( isset($page_errors) ) {
46
+        if (isset($page_errors)) {
47 47
             $data['page_errors'] = $page_errors;
48 48
         }
49 49
 
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 
96 96
     private static function addCommonURLs($data) {
97 97
         $urls = array();
98
-        if ( isset($data['urls']) ) {
98
+        if (isset($data['urls'])) {
99 99
             $urls = $data['urls'];
100 100
         }
101 101
 
102 102
         $common_urls = array('search', 'alert');
103 103
 
104
-        foreach ( $common_urls as $path ) {
105
-            if (!isset($urls[$path]) ) {
104
+        foreach ($common_urls as $path) {
105
+            if (!isset($urls[$path])) {
106 106
                 $url = new Url($path);
107 107
                 $urls[$path] = $url->generate();
108 108
             }
Please login to merge, or discard this patch.
classes/Url.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         // These stores an associative array of key/value pairs that
44 44
         // we'll want passed on to other pages.
45
-        $this->session_vars = array ();
45
+        $this->session_vars = array();
46 46
 
47 47
         // Prevent things using $DATA running if it hasn't been set, ie in testing
48 48
         if (isset($DATA)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function reset() {
95 95
         // Call this to remove all the session_vars.
96
-        $this->session_vars = array ();
96
+        $this->session_vars = array();
97 97
     }
98 98
 
99 99
     /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
      *                            override just one or two of them.
163 163
      */
164 164
 
165
-    public function generate($encode = "html", $overrideVars=array()) {
165
+    public function generate($encode = "html", $overrideVars = array()) {
166 166
 
167 167
         global $DATA;
168 168
 
169
-        $url_args = array ();
169
+        $url_args = array();
170 170
 
171 171
         foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) {
172 172
             if (is_array($var)) {
Please login to merge, or discard this patch.
classes/GlossaryEditQueue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
             // the new epobject id and approval details.
62 62
             $q = $this->db->query("UPDATE editqueue
63 63
                             SET
64
-                            glossary_id='" .  $this->current_epobject_id. "',
64
+                            glossary_id='" .  $this->current_epobject_id . "',
65 65
                             editor_id='" . addslashes($THEUSER->user_id()) . "',
66 66
                             approved='1',
67 67
                             decided='" . $timestamp . "'
Please login to merge, or discard this patch.
classes/Policies.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -366,14 +366,12 @@
 block discarded – undo
366 366
     public function limitToSet($set) {
367 367
 
368 368
         // Sanity check the set exists
369
-        if (isset($this->sets[$set]))
370
-        {
369
+        if (isset($this->sets[$set])) {
371 370
             $out = array();
372 371
             // Reassemble the new policies list based on the set.
373 372
             foreach ($this->sets[$set] as $set_policy)
374 373
             {
375
-                if (isset($this->policies[$set_policy]))
376
-                {
374
+                if (isset($this->policies[$set_policy])) {
377 375
                     $out[$set_policy] = $this->policies[$set_policy];
378 376
                 } else {
379 377
                     // if we've limited the policies to a single one then we only
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -397,18 +397,18 @@
 block discarded – undo
397 397
     }
398 398
 
399 399
     public function limitToArray($policies) {
400
-          $out = array();
401
-          // Reassemble the new policies list based on the set.
402
-          foreach ($policies as $policy) {
403
-              if (isset($this->policies[$policy])) {
404
-                  $out[$policy] = $this->policies[$policy];
405
-              }
406
-          }
407
-
408
-          $new_policies = new self();
409
-          $new_policies->policies = $out;
410
-
411
-          return $new_policies;
400
+            $out = array();
401
+            // Reassemble the new policies list based on the set.
402
+            foreach ($policies as $policy) {
403
+                if (isset($this->policies[$policy])) {
404
+                    $out[$policy] = $this->policies[$policy];
405
+                }
406
+            }
407
+
408
+            $new_policies = new self();
409
+            $new_policies->policies = $out;
410
+
411
+            return $new_policies;
412 412
     }
413 413
 
414 414
     public function getPolicyDetails($policyID) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     public function __construct($policy_id = null) {
303 303
         $this->db = new \ParlDB;
304 304
 
305
-        if ( $policy_id ) {
305
+        if ($policy_id) {
306 306
             $this->policy_id = $policy_id;
307 307
             $this->policies = array(
308 308
                 $policy_id => $this->policies[$policy_id]
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                     // want to complain here if we're looking for that policy and
381 381
                     // it does not exist. Otherwise, if the single policy isn't in
382 382
                     // the set we want to return an empty set
383
-                    if ( !isset($this->policy_id) || $set_policy == $this->policy_id ) {
383
+                    if (!isset($this->policy_id) || $set_policy == $this->policy_id) {
384 384
                         throw new \Exception ('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.');
385 385
                     }
386 386
                 }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
         $image = $q['image'];
435 435
 
436
-        if ( $image && file_exists(BASEDIR . '/' . $image)) {
436
+        if ($image && file_exists(BASEDIR . '/' . $image)) {
437 437
             $props['image'] = $image;
438 438
             $props['image_license'] = $q['image_license'];
439 439
             $props['image_attribution'] = $q['image_attrib'];
Please login to merge, or discard this patch.
classes/Renderer/Header.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         if (isset($nextprev[$linktype]) && isset($nextprev[$linktype]['url'])) {
136 136
 
137 137
             if (isset($nextprev[$linktype]['body'])) {
138
-                $linktitle = _htmlentities( trim_characters($nextprev[$linktype]['body'], 0, 40) );
138
+                $linktitle = _htmlentities(trim_characters($nextprev[$linktype]['body'], 0, 40));
139 139
                 if (isset($nextprev[$linktype]['speaker']) &&
140 140
                     count($nextprev[$linktype]['speaker']) > 0) {
141 141
                     $linktitle = $nextprev[$linktype]['speaker']['name'] . ': ' . $linktitle;
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
         if ($nextprev) {
164 164
             // Four different kinds of back/forth links we might build.
165
-            $links = array ("first", "prev", "up", "next", "last");
165
+            $links = array("first", "prev", "up", "next", "last");
166 166
 
167 167
             foreach ($links as $type) {
168
-                if ( $link = $this->generate_next_prev_link( $nextprev, $type ) ) {
168
+                if ($link = $this->generate_next_prev_link($nextprev, $type)) {
169 169
 
170 170
                     $this->data['header_links'][] = $link;
171 171
                 }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         // Page names mapping to those in metadata.php.
259 259
         // Links in the top menu, and the sublinks we see if
260 260
         // we're within that section.
261
-        $nav_items = array (
261
+        $nav_items = array(
262 262
             array('home'),
263 263
             array('hansard', 'mps', 'peers', 'alldebatesfront', 'wranswmsfront', 'pbc_front', 'divisions_recent', 'calendar_summary'),
264 264
             array('sp_home', 'spoverview', 'msps', 'spdebatesfront', 'spwransfront'),
Please login to merge, or discard this patch.
classes/Renderer/User.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $menudata   = $this->pagedata->page_metadata('userviewself', 'menu');
48 48
         $edittitle  = $menudata['title'];
49 49
         $EDITURL    = new \MySociety\TheyWorkForYou\Url('userviewself');
50
-        if ($this->page == 'userviewself' || $this->page == 'useredit' ) {
50
+        if ($this->page == 'userviewself' || $this->page == 'useredit') {
51 51
             $editclass = 'on';
52 52
         } else {
53 53
             $editclass = '';
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         // The 'Log out' link.
57 57
         $menudata   = $this->pagedata->page_metadata('userlogout', 'menu');
58 58
         $logouttext = $menudata['text'];
59
-        $logouttitle= $menudata['title'];
59
+        $logouttitle = $menudata['title'];
60 60
 
61 61
         $LOGOUTURL  = new \MySociety\TheyWorkForYou\Url('userlogout');
62 62
         if ($this->page != 'userlogout') {
Please login to merge, or discard this patch.