Passed
Pull Request — master (#1601)
by Sam
06:27
created
classes/AlertView/Simple.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     public function display() {
8 8
         $data = array();
9 9
         $data['recent_election'] = false;
10
-        if ( $this->user->loggedin() ) {
10
+        if ($this->user->loggedin()) {
11 11
             $data['user_signed_in'] = true;
12 12
         }
13 13
 
@@ -17,21 +17,21 @@  discard block
 block discarded – undo
17 17
             $data['postcode'] = get_http_var('postcode');
18 18
 
19 19
             $result = $this->createAlertForPostCode($data['email'], $data['postcode']);
20
-            $data = array_merge( $data, $result );
20
+            $data = array_merge($data, $result);
21 21
         } elseif (get_http_var('update')) {
22 22
             $result = $this->getNewMP(get_http_var('update'));
23
-            $data = array_merge( $data, $result );
23
+            $data = array_merge($data, $result);
24 24
         } elseif (get_http_var('update-alert')) {
25
-            $success = $this->replaceAlert( get_http_var('confirmation') );
25
+            $success = $this->replaceAlert(get_http_var('confirmation'));
26 26
             $data['confirmation_received'] = $success;
27 27
         } elseif (get_http_var('confirmed')) {
28
-            $success = $this->confirmAlert( get_http_var('confirmed') );
28
+            $success = $this->confirmAlert(get_http_var('confirmed'));
29 29
             $data['confirmation_received'] = $success;
30 30
         } else {
31 31
             $data['email'] = $this->user->email() ? $this->user->email() : '';
32 32
             $data['postcode'] = $this->user->postcode_is_set() ? $this->user->postcode() : '';
33 33
 
34
-            if ( $this->isEmailSignedUpForPostCode( $data['email'], $data['postcode'] ) ) {
34
+            if ($this->isEmailSignedUpForPostCode($data['email'], $data['postcode'])) {
35 35
                 $data['already_signed_up'] = true;
36 36
                 $mp = $this->getPersonFromPostcode($data['postcode']);
37 37
                 $data['mp_name'] = $mp->full_name();
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
     }
67 67
 
68 68
     private function createAlertForPostCode($email, $postcode) {
69
-        if ( !$this->validateDetails($email, $postcode) ) {
69
+        if (!$this->validateDetails($email, $postcode)) {
70 70
             return array('invalid-postcode-or-email' => true);
71 71
         }
72 72
 
73 73
         try {
74 74
             $person = $this->getPersonFromPostcode($postcode);
75
-        } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
75
+        } catch (\MySociety\TheyWorkForYou\MemberException $e) {
76 76
             return array('bad-constituency' => true);
77 77
         }
78 78
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
         switch ($result) {
91 91
             case self::ALERT_EXISTS:
92
-                if ( $not_logged_in ) {
92
+                if ($not_logged_in) {
93 93
                     // no logged in user so send them an email to let them
94 94
                     // know someone tried to create an alert
95 95
                     $this->alert->send_already_signedup_email($details);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 $data['error'] = true;
103 103
                 break;
104 104
             default: // alert created
105
-                if ( $not_logged_in ) {
105
+                if ($not_logged_in) {
106 106
                     $data['confirmation_sent'] = true;
107 107
                 } else {
108 108
                     $data['signedup_no_confirm'] = true;
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
         $existing = $this->alert->fetch_by_token($confirmation);
117 117
         preg_match('/speaker:(\d+)/', $existing['criteria'], $matches);
118 118
         $old_mp_id = $matches[1];
119
-        $old_mp = new \MySociety\TheyWorkForYou\Member(array( 'person_id' => $old_mp_id ) );
120
-        $new_mp = new \MySociety\TheyWorkForYou\Member(array( 'constituency' => $old_mp->constituency, 'house' => 1 ));
119
+        $old_mp = new \MySociety\TheyWorkForYou\Member(array('person_id' => $old_mp_id));
120
+        $new_mp = new \MySociety\TheyWorkForYou\Member(array('constituency' => $old_mp->constituency, 'house' => 1));
121 121
 
122 122
         $q = $this->db->query(
123 123
             "SELECT alert_id, criteria, registrationtoken FROM alerts
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 'pid' => $new_mp->person_id,
142 142
                 'pc' => '',
143 143
             );
144
-            if ( $other_criteria ) {
144
+            if ($other_criteria) {
145 145
                 $details['keyword'] = $other_criteria;
146 146
             }
147 147
 
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
     private function isEmailSignedUpForPostCode($email, $postcode) {
159 159
         $is_signed_up = false;
160 160
 
161
-        if ( $email && $postcode ) {
161
+        if ($email && $postcode) {
162 162
             try {
163 163
                 $person = $this->getPersonFromPostcode($postcode);
164 164
                 $is_signed_up = $this->alert->fetch_by_mp($email, $person->person_id);
165
-            } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
165
+            } catch (\MySociety\TheyWorkForYou\MemberException $e) {
166 166
                 $is_signed_up = false;
167 167
             }
168 168
         }
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
         preg_match('/speaker:(\d+)/', $existing['criteria'], $matches);
179 179
         $criteria = $matches[1];
180 180
 
181
-        $old_mp = new \MySociety\TheyWorkForYou\Member(array( 'person_id' => $criteria ) );
182
-        $new_mp = new \MySociety\TheyWorkForYou\Member(array( 'constituency' => $old_mp->constituency, 'house' => 1 ));
181
+        $old_mp = new \MySociety\TheyWorkForYou\Member(array('person_id' => $criteria));
182
+        $new_mp = new \MySociety\TheyWorkForYou\Member(array('constituency' => $old_mp->constituency, 'house' => 1));
183 183
 
184
-        if ( $this->alert->fetch_by_mp( $existing['email'], $new_mp->person_id) ) {
184
+        if ($this->alert->fetch_by_mp($existing['email'], $new_mp->person_id)) {
185 185
             $data = array(
186 186
                 'already_signed_up' => true,
187 187
                 'old_mp' => $old_mp->full_name(),
Please login to merge, or discard this patch.
classes/Office.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
             if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') {
71 71
                 $output .= 'before ';
72 72
             }
73
-            $output .= format_date($this->from_date,SHORTDATEFORMAT) . ' ';
73
+            $output .= format_date($this->from_date, SHORTDATEFORMAT) . ' ';
74 74
         }
75 75
 
76 76
         $output .= 'to ';
Please login to merge, or discard this patch.
classes/FacebookLogin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 
44 44
         try {
45 45
             $accessToken = $helper->getAccessToken();
46
-        } catch(\Facebook\Exceptions\FacebookResponseException $e) {
46
+        } catch (\Facebook\Exceptions\FacebookResponseException $e) {
47 47
             $data['error'] = 'Graph returned an error: ' . $e->getMessage();
48 48
             return $data;
49
-        } catch(\Facebook\Exceptions\FacebookSDKException $e) {
49
+        } catch (\Facebook\Exceptions\FacebookSDKException $e) {
50 50
             $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage();
51 51
             return $data;
52 52
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             return false;
68 68
         }
69 69
 
70
-        if (! $accessToken->isLongLived()) {
70
+        if (!$accessToken->isLongLived()) {
71 71
             $oAuth2Client = $this->getFacebookObject()->getOAuth2Client();
72 72
             try {
73 73
                 $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
Please login to merge, or discard this patch.
classes/Utility/Wikipedia.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -145,59 +145,59 @@
 block discarded – undo
145 145
 
146 146
     public static function antiTagInTag($content = '', $format = 'htmlhead')
147 147
     {
148
-      $tagend = -1;
149
-      for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) )
148
+        $tagend = -1;
149
+        for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) )
150 150
         {
151
-          // got the start of a tag.  Now find the proper end!
152
-          $walker = $tagstart + 1;
153
-          $open = 1;
154
-          while( $open != 0 && $walker < strlen( $content ) )
151
+            // got the start of a tag.  Now find the proper end!
152
+            $walker = $tagstart + 1;
153
+            $open = 1;
154
+            while( $open != 0 && $walker < strlen( $content ) )
155 155
         {
156
-          $nextopen = strpos( $content, '<', $walker );
157
-          $nextclose = strpos( $content, '>', $walker );
158
-          if( $nextclose === false ) {
159
-              // ERROR! Open waka without close waka!
160
-              // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
161
-              return $content;
162
-          }
163
-          if( $nextopen === false || $nextopen > $nextclose ) {
164
-              // No more opens, but there was a close; or, a close happens before the next open.
165
-              // walker goes to the close+1, and open decrements
166
-              $open --;
167
-              $walker = $nextclose + 1;
168
-          } elseif( $nextopen < $nextclose ) {
169
-              // an open before the next close
170
-              $open ++;
171
-              $walker = $nextopen + 1;
172
-          }
156
+            $nextopen = strpos( $content, '<', $walker );
157
+            $nextclose = strpos( $content, '>', $walker );
158
+            if( $nextclose === false ) {
159
+                // ERROR! Open waka without close waka!
160
+                // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
161
+                return $content;
162
+            }
163
+            if( $nextopen === false || $nextopen > $nextclose ) {
164
+                // No more opens, but there was a close; or, a close happens before the next open.
165
+                // walker goes to the close+1, and open decrements
166
+                $open --;
167
+                $walker = $nextclose + 1;
168
+            } elseif( $nextopen < $nextclose ) {
169
+                // an open before the next close
170
+                $open ++;
171
+                $walker = $nextopen + 1;
172
+            }
173 173
         }
174
-          $tagend = $walker;
175
-          if( $tagend > strlen( $content ) ) {
176
-              $tagend = strlen( $content );
177
-          } else {
178
-              $tagend --;
179
-              $tagstart ++;
180
-          }
181
-          $tag = substr( $content, $tagstart, $tagend - $tagstart );
182
-          $tags[] = '<' . $tag . '>';
183
-
184
-          if (function_exists('format_to_output')) {
174
+            $tagend = $walker;
175
+            if( $tagend > strlen( $content ) ) {
176
+                $tagend = strlen( $content );
177
+            } else {
178
+                $tagend --;
179
+                $tagstart ++;
180
+            }
181
+            $tag = substr( $content, $tagstart, $tagend - $tagstart );
182
+            $tags[] = '<' . $tag . '>';
183
+
184
+            if (function_exists('format_to_output')) {
185 185
             $newtag = format_to_output($tag, $format);
186
-          } else {
186
+            } else {
187 187
             $newtag = strip_tags($tag);
188
-          }
188
+            }
189 189
 
190
-          $newtags[] = '<' . $newtag . '>';
190
+            $newtags[] = '<' . $newtag . '>';
191 191
 
192
-          if (function_exists('format_to_output')) {
192
+            if (function_exists('format_to_output')) {
193 193
             $newtag = format_to_output($tag, $format);
194
-          } else {
194
+            } else {
195 195
             $newtag = strip_tags($tag);
196
-          }
196
+            }
197
+        }
198
+        if (isset($tags)&&isset($newtags)) {
199
+        $content = str_replace($tags, $newtags, $content);
197 200
         }
198
-      if (isset($tags)&&isset($newtags)) {
199
-      $content = str_replace($tags, $newtags, $content);
200
-      }
201 201
 
202 202
     return $content;
203 203
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
             twfy_debug("WIKIPEDIA", "Matched '$phrase'");
115 115
             # 1 means only replace one match for phrase per paragraph
116
-            $source = preg_replace ('{
116
+            $source = preg_replace('{
117 117
             \b(' . $phrase_re . ')\b # Match the phrase itself
118 118
             (?!                      # Match as long as the following does *not* apply:
119 119
                 (?:                  #   Match, possessively, as many strings of:
@@ -146,39 +146,39 @@  discard block
 block discarded – undo
146 146
     public static function antiTagInTag($content = '', $format = 'htmlhead')
147 147
     {
148 148
       $tagend = -1;
149
-      for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) )
149
+      for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend))
150 150
         {
151 151
           // got the start of a tag.  Now find the proper end!
152 152
           $walker = $tagstart + 1;
153 153
           $open = 1;
154
-          while( $open != 0 && $walker < strlen( $content ) )
154
+          while ($open != 0 && $walker < strlen($content))
155 155
         {
156
-          $nextopen = strpos( $content, '<', $walker );
157
-          $nextclose = strpos( $content, '>', $walker );
158
-          if( $nextclose === false ) {
156
+          $nextopen = strpos($content, '<', $walker);
157
+          $nextclose = strpos($content, '>', $walker);
158
+          if ($nextclose === false) {
159 159
               // ERROR! Open waka without close waka!
160 160
               // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
161 161
               return $content;
162 162
           }
163
-          if( $nextopen === false || $nextopen > $nextclose ) {
163
+          if ($nextopen === false || $nextopen > $nextclose) {
164 164
               // No more opens, but there was a close; or, a close happens before the next open.
165 165
               // walker goes to the close+1, and open decrements
166
-              $open --;
166
+              $open--;
167 167
               $walker = $nextclose + 1;
168
-          } elseif( $nextopen < $nextclose ) {
168
+          } elseif ($nextopen < $nextclose) {
169 169
               // an open before the next close
170
-              $open ++;
170
+              $open++;
171 171
               $walker = $nextopen + 1;
172 172
           }
173 173
         }
174 174
           $tagend = $walker;
175
-          if( $tagend > strlen( $content ) ) {
176
-              $tagend = strlen( $content );
175
+          if ($tagend > strlen($content)) {
176
+              $tagend = strlen($content);
177 177
           } else {
178
-              $tagend --;
179
-              $tagstart ++;
178
+              $tagend--;
179
+              $tagstart++;
180 180
           }
181
-          $tag = substr( $content, $tagstart, $tagend - $tagstart );
181
+          $tag = substr($content, $tagstart, $tagend - $tagstart);
182 182
           $tags[] = '<' . $tag . '>';
183 183
 
184 184
           if (function_exists('format_to_output')) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $newtag = strip_tags($tag);
196 196
           }
197 197
         }
198
-      if (isset($tags)&&isset($newtags)) {
198
+      if (isset($tags) && isset($newtags)) {
199 199
       $content = str_replace($tags, $newtags, $content);
200 200
       }
201 201
 
Please login to merge, or discard this patch.
classes/Utility/Search.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
                     $speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept);
90 90
                 }
91 91
                 if (!isset($speakers[$pid]['name'])) {
92
-                    $speakers[$pid]['name'] = $full_name . ($house==1?' MP':'');
92
+                    $speakers[$pid]['name'] = $full_name . ($house == 1 ? ' MP' : '');
93 93
                 }
94
-                if ( !isset($speakers[$pid]['party']) && $party ) {
94
+                if (!isset($speakers[$pid]['party']) && $party) {
95 95
                     $speakers[$pid]['party'] = $party;
96 96
                 }
97 97
             }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * Return query result from looking for MPs
145 145
      */
146 146
 
147
-    public static function searchMemberDbLookup($searchstring, $current_only=false) {
147
+    public static function searchMemberDbLookup($searchstring, $current_only = false) {
148 148
         if (!$searchstring) {
149 149
             return array();
150 150
         }
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
             // And here we're assuming the user's put the names in the right order.
159 159
             $params[':like_0'] = '%' . $searchwords[0] . '%';
160 160
             $params[':like_1'] = '%' . $searchwords[1] . '%';
161
-            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%';
162
-            $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-'. $searchwords[1] . '%';
161
+            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%';
162
+            $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-' . $searchwords[1] . '%';
163 163
             $where = "(given_name LIKE :like_0 AND family_name LIKE :like_1)";
164 164
             $where .= " OR (given_name LIKE :like_1 AND family_name LIKE :like_0)";
165 165
             $where .= " OR (title LIKE :like_0 AND family_name LIKE :like_1)";
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
             $params[':like_0'] = '%' . $searchwords[0] . '%';
175 175
             $params[':like_1'] = '%' . $searchwords[1] . '%';
176 176
             $params[':like_2'] = '%' . $searchwords[2] . '%';
177
-            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%';
178
-            $params[':like_1_and_2'] = '%' . $searchwords[1] . ' '. $searchwords[2] . '%';
179
-            $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-'. $searchwords[2] . '%';
177
+            $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%';
178
+            $params[':like_1_and_2'] = '%' . $searchwords[1] . ' ' . $searchwords[2] . '%';
179
+            $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-' . $searchwords[2] . '%';
180 180
             $where = "(given_name LIKE :like_0_and_1 AND family_name LIKE :like_2)";
181 181
             $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2)";
182 182
             $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2_hyphen)";
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         return array_unique($pids);
206 206
     }
207 207
 
208
-    public static function searchMemberDbLookupWithNames($searchstring, $current_only=false) {
208
+    public static function searchMemberDbLookupWithNames($searchstring, $current_only = false) {
209 209
         $pids = self::searchMemberDbLookup($searchstring, $current_only);
210 210
 
211 211
         if (!count($pids)) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             // Looks like a postcode - can we find the constituency?
255 255
             $constituency = Postcode::postcodeToConstituency($searchterm);
256 256
             if ($constituency) {
257
-                return array( array($constituency), true );
257
+                return array(array($constituency), true);
258 258
             }
259 259
         }
260 260
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             $constituencies[] = $row['name'];
273 273
         }
274 274
 
275
-        return array( $constituencies, false );
275
+        return array($constituencies, false);
276 276
     }
277 277
 
278 278
     /**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $speakers = [];
289 289
 
290 290
         foreach ($criteria as $c) {
291
-            if (preg_match('#^speaker:(\d+)#',$c,$m)) {
291
+            if (preg_match('#^speaker:(\d+)#', $c, $m)) {
292 292
                 $MEMBER = new \MEMBER(array('person_id'=>$m[1]));
293 293
                 $speakers[$m[1]] = $MEMBER->full_name();
294 294
             }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     public static function speakerIDsToNames($searchstring) {
308 308
         $speakers = self::speakerNamesForIDs($searchstring);
309 309
 
310
-        foreach ( $speakers as $id => $name ) {
310
+        foreach ($speakers as $id => $name) {
311 311
             $searchstring = str_replace('speaker:' . $id, "speaker:$name", $searchstring);
312 312
         }
313 313
 
Please login to merge, or discard this patch.
classes/PolicyPositions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param int $limit The number of results to limit the output to.
84 84
      */
85 85
 
86
-    private function getMemberPolicyPositions ($limit = null) {
86
+    private function getMemberPolicyPositions($limit = null) {
87 87
 
88 88
         // Make sure member info has actually been set.
89 89
         if (count($this->member->extra_info) === 0) {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
             // don't return votes where they haven't voted on a strong division
131 131
             // if we're limiting the number of votes
132
-            if ( $limit && !empty($dream_info) && !$dream_info['has_strong'] ) {
132
+            if ($limit && !empty($dream_info) && !$dream_info['has_strong']) {
133 133
                 continue;
134 134
             }
135 135
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 $has_strong = 1;
209 209
             }
210 210
             $full_sentence = $consistency . ' ' . $policy_description;
211
-            $out = array( 'full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong );
211
+            $out = array('full_sentence' => $full_sentence, 'score' => $dmpscore, 'position' => $consistency, 'has_strong' => $has_strong);
212 212
         }
213 213
 
214 214
         return $out;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             # If not current MP/Lord, but current MLA/MSP, need to say voting record is when MP
240 240
             if (!$current_member[HOUSE_TYPE_COMMONS] and
241 241
                 !$current_member[HOUSE_TYPE_LORDS] and
242
-                ( $current_member[HOUSE_TYPE_SCOTLAND] or $current_member[HOUSE_TYPE_NI] )
242
+                ($current_member[HOUSE_TYPE_SCOTLAND] or $current_member[HOUSE_TYPE_NI])
243 243
             ) {
244 244
                 $since .= ' whilst an MP';
245 245
             }
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
                 '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
261 261
         }
262 262
         if (
263
-            ( isset($extra_info['public_whip_division_attendance']) and
264
-            $extra_info['public_whip_division_attendance'] != 'n/a' )
263
+            (isset($extra_info['public_whip_division_attendance']) and
264
+            $extra_info['public_whip_division_attendance'] != 'n/a')
265 265
             or
266
-            ( isset($extra_info['Lpublic_whip_division_attendance']) and
267
-            $extra_info['Lpublic_whip_division_attendance'] != 'n/a' )
266
+            (isset($extra_info['Lpublic_whip_division_attendance']) and
267
+            $extra_info['Lpublic_whip_division_attendance'] != 'n/a')
268 268
         ) {
269 269
             $record[] = '<a href="https://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' .
270 270
                 $this->member->member_id() .
Please login to merge, or discard this patch.
www/docs/video/stamps.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     exit;
22 22
 }
23 23
 
24
-$start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT'));
24
+$start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT'));
25 25
 $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
26 26
 
27 27
 $q = $db->query("select video_timestamps.gid, adate, atime, time_to_sec(timediff(atime, '$start')) as timediff,
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
         continue;
42 42
     }
43 43
     $timetoend = $row['timetoend'] - $file_offset;
44
-    if ($timetoend>0) {
44
+    if ($timetoend > 0) {
45 45
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $row['adate'], $row['atime']);
46
-        $new_start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT'));
46
+        $new_start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT'));
47 47
         $file_offset += timediff($new_start, $start);
48 48
         $start = $new_start;
49 49
         $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
50 50
     }
51 51
     $timediff = $row['timediff'] - $file_offset;
52
-    if ($timediff>=0) {
52
+    if ($timediff >= 0) {
53 53
         print "<stamp><gid>$gid</gid><file>$video[id]</file><time>$timediff</time></stamp>\n";
54 54
     }
55 55
     $gids[$gid] = true;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 print '</stamps>';
58 58
 
59 59
 function timediff($a, $b) {
60
-    return substr($a, 0, 2)*3600 + substr($a, 3, 2)*60 + substr($a, 6, 2)
61
-        - substr($b, 0, 2)*3600 - substr($b, 3, 2)*60 - substr($b, 6, 2);
60
+    return substr($a, 0, 2) * 3600 + substr($a, 3, 2) * 60 + substr($a, 6, 2)
61
+        - substr($b, 0, 2) * 3600 - substr($b, 3, 2) * 60 - substr($b, 6, 2);
62 62
 
63 63
 }
Please login to merge, or discard this patch.
www/docs/video/next.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     $major = 1;
10 10
 }
11 11
 
12
-if ($action == 'next' || $action=='nextneeded') {
12
+if ($action == 'next' || $action == 'nextneeded') {
13 13
     $gid = get_http_var('gid');
14 14
     $file = intval(get_http_var('file'));
15 15
     $time = intval(get_http_var('time'));
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     $q = $db->query("select gid, hpos from hansard
30 30
         where hpos>$hpos and hdate='$hdate' and major=$major
31 31
         and htype IN (12,13,14) "
32
-        . ($action=='nextneeded'?'and video_status in (1,3)':'') . "
32
+        . ($action == 'nextneeded' ? 'and video_status in (1,3)' : '') . "
33 33
         ORDER BY hpos LIMIT 1")->first();
34 34
     if (!$q) {
35 35
         $PAGE->page_start();
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     } else {
44 44
         $new_gid = $q['gid'];
45 45
         $new_hpos = $q['hpos'];
46
-        if ($action=='nextneeded') {
46
+        if ($action == 'nextneeded') {
47 47
             $q = $db->query("select adate, atime from hansard, video_timestamps
48 48
                 where hansard.gid = video_timestamps.gid and deleted=0
49 49
                     and hpos<$new_hpos and hdate='$hdate' and major=$major
Please login to merge, or discard this patch.
www/docs/departments/index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@
 block discarded – undo
26 26
 
27 27
 print '<ul>';
28 28
 foreach ($data as $body => $arr) {
29
-    $link = strtolower(str_replace(' ','_',$body));
29
+    $link = strtolower(str_replace(' ', '_', $body));
30 30
     print '<li>';
31 31
     print $body;
32 32
     print ' &mdash; ';
33 33
     if (isset($arr[3])) {
34
-        print '<a href="'.$link.'/questions">Written Questions</a>';
34
+        print '<a href="' . $link . '/questions">Written Questions</a>';
35 35
     }
36
-    if (count($arr)==2) {
36
+    if (count($arr) == 2) {
37 37
         print ' | ';
38 38
     }
39 39
     if (isset($arr[4])) {
40
-        print '<a href="'.$link.'/statements">Written Ministerial Statements</a>';
40
+        print '<a href="' . $link . '/statements">Written Ministerial Statements</a>';
41 41
     }
42 42
     print '</li>';
43 43
 }
Please login to merge, or discard this patch.