Passed
Pull Request — master (#1700)
by Struan
04:54
created
www/includes/easyparliament/templates/html/mp/votes.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                                 $policy_group = $segment['key'];
77 77
 
78 78
                                 if (isset($policy_last_update[$policy_id]) && $policy_last_update[$policy_id] > $most_recent) {
79
-                                  $most_recent = $policy_last_update[$policy_id];
79
+                                    $most_recent = $policy_last_update[$policy_id];
80 80
                                 }
81 81
 
82 82
                                 if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
                                 include '_vote_description.php';
113 113
 
114
-                              } ?>
114
+                                } ?>
115 115
                             </ul>
116 116
 
117 117
                             <div class="share-vote-descriptions">
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                                   $most_recent = $policy_last_update[$policy_id];
80 80
                                 }
81 81
 
82
-                                if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) {
82
+                                if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') {
83 83
                                     $description = ucfirst($key_vote['desc']);
84 84
                                 } else {
85 85
                                     $description = sprintf(
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                                     $party_position = $diff['party_position'];
102 102
                                     $party_score_difference = $diff["score_difference"];
103 103
                                     if ($sorted_diffs[$policy_id]['score_difference'] > $min_diff_score && $party_member_count > 1) {
104
-                                        $party_voting_line = sprintf( 'Comparable %s MPs %s (%s).', $comparison_party, $diff['party_position'], $diff['party_voting_summary']);
104
+                                        $party_voting_line = sprintf('Comparable %s MPs %s (%s).', $comparison_party, $diff['party_position'], $diff['party_voting_summary']);
105 105
                                     }
106 106
                                 } else {
107 107
                                     $party_voting_line = null;
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,13 +146,16 @@
 block discarded – undo
146 146
 
147 147
                         <?php endif; ?>
148 148
 
149
-                    <?php else: ?>
149
+                    <?php else {
150
+    : ?>
150 151
 
151 152
                         <div class="panel">
152 153
                             <p>This person has not voted on any of the key issues which we keep track of.</p>
153 154
                         </div>
154 155
 
155
-                    <?php endif; ?>
156
+                    <?php endif;
157
+}
158
+?>
156 159
 
157 160
                 <?php endif; ?>
158 161
                 <?php include('_covid19_panel.php'); ?>
Please login to merge, or discard this patch.
scripts/alertmailer.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -423,7 +423,7 @@
 block discarded – undo
423 423
 
424 424
     $text .= '====================';
425 425
     $sentemails++;
426
-    mlog("SEND $sentemails : Sending email to $current[email] ... ");
426
+    mlog("send $sentemails : Sending email to $current[email] ... ");
427 427
     $d = array('to' => $current['email'], 'template' => $template);
428 428
     $m = array(
429 429
         'DATA' => $text,
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
     $data = $DEBATELIST->_get_data_by_search($args);
246 246
     $total_results = $data['info']['total_results'];
247 247
     $queries++;
248
-    mlog(", hits " . $total_results . ", time " . (getmicrotime()-$start) . "\n");
248
+    mlog(", hits " . $total_results . ", time " . (getmicrotime() - $start) . "\n");
249 249
 
250 250
     # Divisions
251 251
     if (preg_match('#^speaker:(\d+)$#', $criteria_raw, $m)) {
Please login to merge, or discard this patch.
classes/Divisions.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         $divisions = array();
194 194
         foreach ($q as $row) {
195
-          $divisions[] = $this->getParliamentDivisionDetails($row);
195
+            $divisions[] = $this->getParliamentDivisionDetails($row);
196 196
         }
197 197
 
198 198
         return $divisions;
@@ -247,44 +247,44 @@  discard block
 block discarded – undo
247 247
         );
248 248
 
249 249
         foreach ($q as $row) {
250
-          $policy_id = $row['policy_id'];
250
+            $policy_id = $row['policy_id'];
251 251
 
252
-          if (!array_key_exists($policy_id, $policy_divisions)) {
252
+            if (!array_key_exists($policy_id, $policy_divisions)) {
253 253
             $summary = array(
254
-              'max' => $row['latest'],
255
-              'min' => $row['earliest'],
256
-              'total' => $row['total'],
257
-              'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0
254
+                'max' => $row['latest'],
255
+                'min' => $row['earliest'],
256
+                'total' => $row['total'],
257
+                'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0
258 258
             );
259 259
 
260 260
             $policy_divisions[$policy_id] = $summary;
261
-          }
262
-
263
-          $summary = $policy_divisions[$policy_id];
264
-
265
-          $summary['total'] += $row['total'];
266
-          if ($summary['max'] < $row['latest']) {
267
-              $summary['max'] = $row['latest'];
268
-          }
269
-          if ($summary['min'] > $row['latest']) {
270
-              $summary['min'] = $row['latest'];
271
-          }
272
-
273
-          $vote = $row['vote'];
274
-          $policy_vote = str_replace('3', '', $row['policy_vote']);
275
-          if ( $vote == 'absent' ) {
276
-              $summary['absent'] += $row['total'];
277
-          } else if ( $vote == 'both' ) {
278
-              $summary['both'] += $row['total'];
279
-          } else if ( strpos($vote, 'tell') !== false ) {
280
-              $summary['tell'] += $row['total'];
281
-          } else if ( $policy_vote == $vote ) {
282
-              $summary['for'] += $row['total'];
283
-          } else if ( $policy_vote != $vote ) {
284
-              $summary['against'] += $row['total'];
285
-          }
286
-
287
-          $policy_divisions[$policy_id] = $summary;
261
+            }
262
+
263
+            $summary = $policy_divisions[$policy_id];
264
+
265
+            $summary['total'] += $row['total'];
266
+            if ($summary['max'] < $row['latest']) {
267
+                $summary['max'] = $row['latest'];
268
+            }
269
+            if ($summary['min'] > $row['latest']) {
270
+                $summary['min'] = $row['latest'];
271
+            }
272
+
273
+            $vote = $row['vote'];
274
+            $policy_vote = str_replace('3', '', $row['policy_vote']);
275
+            if ( $vote == 'absent' ) {
276
+                $summary['absent'] += $row['total'];
277
+            } else if ( $vote == 'both' ) {
278
+                $summary['both'] += $row['total'];
279
+            } else if ( strpos($vote, 'tell') !== false ) {
280
+                $summary['tell'] += $row['total'];
281
+            } else if ( $policy_vote == $vote ) {
282
+                $summary['for'] += $row['total'];
283
+            } else if ( $policy_vote != $vote ) {
284
+                $summary['against'] += $row['total'];
285
+            }
286
+
287
+            $policy_divisions[$policy_id] = $summary;
288 288
         }
289 289
 
290 290
         return $policy_divisions;
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
         );
339 339
 
340 340
         $votes = array(
341
-          'yes_votes' => array(),
342
-          'no_votes' => array(),
343
-          'absent_votes' => array(),
344
-          'both_votes' => array()
341
+            'yes_votes' => array(),
342
+            'no_votes' => array(),
343
+            'absent_votes' => array(),
344
+            'both_votes' => array()
345 345
         );
346 346
 
347 347
         $party_breakdown = array(
348
-          'yes_votes' => array(),
349
-          'no_votes' => array(),
350
-          'absent_votes' => array(),
351
-          'both_votes' => array()
348
+            'yes_votes' => array(),
349
+            'no_votes' => array(),
350
+            'absent_votes' => array(),
351
+            'both_votes' => array()
352 352
         );
353 353
 
354 354
         # Sort Lords specially
@@ -359,12 +359,12 @@  discard block
 block discarded – undo
359 359
 
360 360
         foreach ($data as $vote) {
361 361
             $detail = array(
362
-              'person_id' => $vote['person_id'],
363
-              'name' => ucfirst(member_full_name($args['house'], $vote['title'], $vote['given_name'],
362
+                'person_id' => $vote['person_id'],
363
+                'name' => ucfirst(member_full_name($args['house'], $vote['title'], $vote['given_name'],
364 364
                     $vote['family_name'], $vote['lordofname'])),
365
-              'party' => $vote['party'],
366
-              'proxy' => false,
367
-              'teller' => false
365
+                'party' => $vote['party'],
366
+                'proxy' => false,
367
+                'teller' => false
368 368
             );
369 369
 
370 370
             if (strpos($vote['vote'], 'tell') !== false) {
@@ -385,23 +385,23 @@  discard block
 block discarded – undo
385 385
             }
386 386
 
387 387
             if ($vote['vote'] == 'aye' or $vote['vote'] == 'tellaye') {
388
-              $votes['yes_votes'][] = $detail;
389
-              @$party_breakdown['yes_votes'][$detail['party']]++;
388
+                $votes['yes_votes'][] = $detail;
389
+                @$party_breakdown['yes_votes'][$detail['party']]++;
390 390
             } else if ($vote['vote'] == 'no' or $vote['vote'] == 'tellno') {
391
-              $votes['no_votes'][] = $detail;
392
-              @$party_breakdown['no_votes'][$detail['party']]++;
391
+                $votes['no_votes'][] = $detail;
392
+                @$party_breakdown['no_votes'][$detail['party']]++;
393 393
             } else if ($vote['vote'] == 'absent') {
394
-              $votes['absent_votes'][] = $detail;
395
-              @$party_breakdown['absent_votes'][$detail['party']]++;
394
+                $votes['absent_votes'][] = $detail;
395
+                @$party_breakdown['absent_votes'][$detail['party']]++;
396 396
             } else if ($vote['vote'] == 'both') {
397
-              $votes['both_votes'][] = $detail;
398
-              @$party_breakdown['both_votes'][$detail['party']]++;
397
+                $votes['both_votes'][] = $detail;
398
+                @$party_breakdown['both_votes'][$detail['party']]++;
399 399
             }
400 400
         }
401 401
 
402 402
         foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) {
403
-          $votes[$vote . '_by_party'] = $votes[$vote];
404
-          usort($votes[$vote . '_by_party'], function ($a, $b) {
403
+            $votes[$vote . '_by_party'] = $votes[$vote];
404
+            usort($votes[$vote . '_by_party'], function ($a, $b) {
405 405
                 return $a['party']>$b['party'];
406 406
             });
407 407
         }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
             ':count' => $number
69 69
         );
70 70
 
71
-        if ( is_string($houses) ) {
72
-            $houses = array( $houses );
71
+        if (is_string($houses)) {
72
+            $houses = array($houses);
73 73
         }
74 74
 
75
-        if ( is_array($houses) && count($houses) > 0 ) {
75
+        if (is_array($houses) && count($houses) > 0) {
76 76
             $where = 'WHERE house IN ("' . implode('", "', $houses) . '")';
77 77
         } elseif (LANGUAGE == 'cy') {
78 78
             $where = "WHERE divisions.division_id NOT LIKE '%-en-%'";
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $where = "WHERE divisions.division_id NOT LIKE '%-cy-%'";
81 81
         }
82 82
 
83
-        if ( $this->member ) {
83
+        if ($this->member) {
84 84
             $select = "SELECT divisions.*, vote FROM divisions
85 85
                 LEFT JOIN persondivisionvotes ON divisions.division_id=persondivisionvotes.division_id AND person_id=:person_id";
86 86
             $params[':person_id'] = $this->member->person_id;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public function getMemberDivisionsForPolicy($policyID = null) {
220 220
         $where_extra = '';
221 221
         $args = array(':person_id' => $this->member->person_id);
222
-        if ( $policyID ) {
222
+        if ($policyID) {
223 223
             $where_extra = 'AND policy_id = :policy_id';
224 224
             $args[':policy_id'] = $policyID;
225 225
         }
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 
277 277
           $vote = $row['vote'];
278 278
           $policy_vote = str_replace('3', '', $row['policy_vote']);
279
-          if ( $vote == 'absent' ) {
279
+          if ($vote == 'absent') {
280 280
               $summary['absent'] += $row['total'];
281
-          } else if ( $vote == 'both' ) {
281
+          } else if ($vote == 'both') {
282 282
               $summary['both'] += $row['total'];
283
-          } else if ( strpos($vote, 'tell') !== false ) {
283
+          } else if (strpos($vote, 'tell') !== false) {
284 284
               $summary['tell'] += $row['total'];
285
-          } else if ( $policy_vote == $vote ) {
285
+          } else if ($policy_vote == $vote) {
286 286
               $summary['for'] += $row['total'];
287
-          } else if ( $policy_vote != $vote ) {
287
+          } else if ($policy_vote != $vote) {
288 288
               $summary['against'] += $row['total'];
289 289
           }
290 290
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                     FROM person_names AS pn
382 382
                     WHERE person_id = :person_id
383 383
                     AND start_date <= :division_date AND end_date >= :division_date",
384
-                    [ ':person_id' => $vote['proxy'], ':division_date' => $row['division_date'] ]
384
+                    [':person_id' => $vote['proxy'], ':division_date' => $row['division_date']]
385 385
                 )->first();
386 386
                 $detail['proxy'] = ucfirst(member_full_name(
387 387
                     HOUSE_TYPE_COMMONS, $q['title'], $q['given_name'],
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 
406 406
         foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) {
407 407
           $votes[$vote . '_by_party'] = $votes[$vote];
408
-          usort($votes[$vote . '_by_party'], function ($a, $b) {
409
-                return $a['party']>$b['party'];
408
+          usort($votes[$vote . '_by_party'], function($a, $b) {
409
+                return $a['party'] > $b['party'];
410 410
             });
411 411
         }
412 412
 
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
             $votes['against'] . ' ' . make_plural('vote', $votes['against']) . ' against'
461 461
         );
462 462
 
463
-        if ( $votes['both'] ) {
463
+        if ($votes['both']) {
464 464
             $actions[] = $votes['both'] . ' ' . make_plural('abstention', $votes['both']);
465 465
         }
466
-        if ( $votes['absent'] ) {
466
+        if ($votes['absent']) {
467 467
             $actions[] = $votes['absent'] . ' ' . make_plural('absence', $votes['absent']);
468 468
         }
469 469
         if ($max == $min) {
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
     }
521 521
 
522 522
     private function constructYesNoVoteDescription($direction, $title, $short_text) {
523
-        $text = ' ' ;
524
-        if ( $short_text ) {
523
+        $text = ' ';
524
+        if ($short_text) {
525 525
             $text .= sprintf(gettext('voted %s'), $short_text);
526 526
         } else {
527 527
             $text .= sprintf(gettext('voted %s on <em>%s</em>'), $direction, $title);
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
          * votes so we need to generate some text using the title of the division
539 539
          */
540 540
 
541
-        switch ( strtolower($vote) ) {
541
+        switch (strtolower($vote)) {
542 542
             case 'yes':
543 543
             case 'aye':
544 544
                 $description = $this->constructYesNoVoteDescription('yes', $division_title, $yes_text);
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
         if (array_key_exists('direction', $row)) {
588 588
             $division['direction'] = $row['direction'];
589
-            if ( strpos( $row['direction'], 'strong') !== false ) {
589
+            if (strpos($row['direction'], 'strong') !== false) {
590 590
                 $division['strong'] = true;
591 591
             } else {
592 592
                 $division['strong'] = false;
@@ -618,24 +618,24 @@  discard block
 block discarded – undo
618 618
         foreach ($q as $row) {
619 619
             $policy_id = $row['policy_id'];
620 620
 
621
-            if ( !array_key_exists($policy_id, $policies) ) {
621
+            if (!array_key_exists($policy_id, $policies)) {
622 622
                 $policies[$policy_id] = array(
623 623
                     'policy_id' => $policy_id,
624 624
                     'weak_count' => 0,
625 625
                     'divisions' => array()
626 626
                 );
627
-                if ( $this->policies ) {
627
+                if ($this->policies) {
628 628
                     $policies[$policy_id]['desc'] = $this->policies->getPolicies()[$policy_id];
629 629
                     $policies[$policy_id]['header'] = $this->policies->getPolicyDetails($policy_id);
630 630
                 }
631
-                if ( $this->positions ) {
631
+                if ($this->positions) {
632 632
                     $policies[$policy_id]['position'] = $this->positions->positionsById[$policy_id];
633 633
                 }
634 634
             }
635 635
 
636 636
             $division = $this->getDivisionDetails($row);
637 637
 
638
-            if ( !$division['strong'] ) {
638
+            if (!$division['strong']) {
639 639
                 $policies[$policy_id]['weak_count']++;
640 640
             }
641 641
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
         $gid = get_canonical_gid($gid);
652 652
 
653
-        $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array( ':gid' => $gid ))->first();
653
+        $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array(':gid' => $gid))->first();
654 654
         if (!$q) {
655 655
             return '';
656 656
         }
Please login to merge, or discard this patch.
classes/Model/Featured.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         if ($q) {
66 66
             $text = $q['value'];
67
-            if ( trim($text) == '' ) {
67
+            if (trim($text) == '') {
68 68
                 $text = null;
69 69
             }
70 70
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     private function _set($key, $value) {
76
-        if ( trim($value) == '' ) {
76
+        if (trim($value) == '') {
77 77
             $value = null;
78 78
         }
79 79
         $check_q = $this->db->query(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 ':key' => $key
83 83
             )
84 84
         );
85
-        if ( $check_q->rows() ) {
85
+        if ($check_q->rows()) {
86 86
             $set_q = $this->db->query("UPDATE editorial set value = :value WHERE item = :key",
87 87
                 array(
88 88
                     ':key' => $key,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             );
99 99
         }
100 100
 
101
-        if ( $set_q->success() ) {
101
+        if ($set_q->success()) {
102 102
             return true;
103 103
         }
104 104
         return false;
Please login to merge, or discard this patch.
classes/SectionView/SpwransView.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         $this_page = 'spwransfront';
22 22
         $data = array();
23 23
 
24
-        $args = array( 'months' => 1 );
24
+        $args = array('months' => 1);
25 25
         $WRANSLIST = new \SPWRANSLIST;
26 26
 
27 27
         $wrans = array();
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     protected function getSearchSections() {
45 45
         return array(
46
-            array( 'section' => 'spwrans' )
46
+            array('section' => 'spwrans')
47 47
         );
48 48
     }
49 49
 
@@ -54,29 +54,29 @@  discard block
 block discarded – undo
54 54
         $SPWRANSLIST = new \SPWRANSLIST;
55 55
         $gid = $SPWRANSLIST->get_gid_from_spid($spid);
56 56
         if ($gid) {
57
-            if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) {
57
+            if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) {
58 58
                 $URL = new \MySociety\TheyWorkForYou\Url('spwrans');
59 59
                 $URL->reset();
60
-                $URL->insert( array('id' => $m[1]) );
60
+                $URL->insert(array('id' => $m[1]));
61 61
                 $fragment_identifier = '#g' . $m[2];
62 62
                 header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303);
63 63
                 exit;
64
-            } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) {
64
+            } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) {
65 65
                 $URL = new \MySociety\TheyWorkForYou\Url('spdebates');
66 66
                 $URL->reset();
67
-                $URL->insert( array('id' => $m[1]) );
67
+                $URL->insert(array('id' => $m[1]));
68 68
                 $fragment_identifier = '#g' . $m[2];
69 69
                 header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303);
70 70
                 exit;
71 71
             } else {
72
-                $PAGE->error_message ("Strange GID ($gid) for that Scottish Parliament ID.");
72
+                $PAGE->error_message("Strange GID ($gid) for that Scottish Parliament ID.");
73 73
             }
74 74
         }
75
-        $PAGE->error_message ("Couldn't match that Scottish Parliament ID to a GID.");
75
+        $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID.");
76 76
     }
77 77
 
78 78
     protected function get_question_mentions_html($row_data) {
79
-        if( count($row_data) == 0 ) {
79
+        if (count($row_data) == 0) {
80 80
             return '';
81 81
         }
82 82
         $result = '';
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
         // Keep the references until after the history that's in a timeline:
86 86
         $references = array();
87 87
         foreach ($row_data as $row) {
88
-            if( ! $row["date"] ) {
88
+            if (!$row["date"]) {
89 89
                 // If this mention isn't associated with a date, the difference won't be interesting.
90 90
                 $last_date = null;
91 91
             }
92 92
             $description = '';
93 93
             if ($last_date && ($last_date != $row["date"])) {
94 94
                 // Calculate how long the gap was in days:
95
-                $daysdiff = (integer)((strtotime($row["date"]) - strtotime($last_date)) / 86400);
95
+                $daysdiff = (integer) ((strtotime($row["date"]) - strtotime($last_date)) / 86400);
96 96
                 $daysstring = ($daysdiff == 1) ? "day" : "days";
97 97
                 $further = "";
98
-                if( $first_difference_output ) {
98
+                if ($first_difference_output) {
99 99
                     $first_difference_output = false;
100 100
                 } else {
101 101
                     $further = " a further";
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $inner = "BUG: Unknown mention type $row[type]";
107 107
             $date = format_date($row['date'], SHORTDATEFORMAT);
108 108
             $url = $row['url'];
109
-            if ( strpos($url, 'business/businessBulletin') !== false ) {
109
+            if (strpos($url, 'business/businessBulletin') !== false) {
110 110
                 $url = str_replace('www.scottish', 'archive.scottish', $url);
111 111
             }
112 112
             switch ($row["type"]) {
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
                     $inner = "Mentioned in <a class=\"debate-speech__meta__link\" href=\"$url\">tabled written questions on $date</a>";
121 121
                     break;
122 122
                 case 4:
123
-                    if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['gid'],$m) ) {
123
+                    if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['gid'], $m)) {
124 124
                         $URL = new \MySociety\TheyWorkForYou\Url("spwrans");
125
-                        $URL->insert( array('spid' => $m[1]) );
125
+                        $URL->insert(array('spid' => $m[1]));
126 126
                         $relative_url = $URL->generate("none");
127 127
                         $inner = "Given a <a class=\"debate-speech__meta__link\" href=\"$relative_url\">written answer on $date</a>";
128 128
                     }
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
                     $inner = "Given a holding answer on $date";
132 132
                     break;
133 133
                 case 6:
134
-                    if( preg_match('/^uk.org.publicwhip\/spor\/(.*)$/',$row['mentioned_gid'],$m) ) {
134
+                    if (preg_match('/^uk.org.publicwhip\/spor\/(.*)$/', $row['mentioned_gid'], $m)) {
135 135
                         $URL = new \MySociety\TheyWorkForYou\Url("spdebates");
136
-                        $URL->insert( array('id' => $m[1]) );
136
+                        $URL->insert(array('id' => $m[1]));
137 137
                         $relative_url = $URL->generate("none");
138 138
                         $inner = "<a href=\"$relative_url\">Asked in parliament on $date</a>";
139 139
                     }
140 140
                     break;
141 141
                 case 7:
142
-                    if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['mentioned_gid'],$m) ) {
142
+                    if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['mentioned_gid'], $m)) {
143 143
                         $referencing_spid = $m[1];
144 144
                         $URL = new \MySociety\TheyWorkForYou\Url("spwrans");
145
-                        $URL->insert( array('spid' => $referencing_spid) );
145
+                        $URL->insert(array('spid' => $referencing_spid));
146 146
                         $relative_url = $URL->generate("none");
147 147
                         $inner = "Referenced in <a href=\"$relative_url\">question $referencing_spid</a>";
148 148
                         $reference = true;
149 149
                     }
150 150
                     break;
151 151
             }
152
-            if( $reference ) {
152
+            if ($reference) {
153 153
                 $references[] = "\n<li>$inner.";
154 154
             } else {
155 155
                 $result .= "\n<li class=\"link-to-hansard\">$description$inner</span>";
Please login to merge, or discard this patch.
classes/SectionView/NiView.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     protected function getSearchSections() {
34 34
         return array(
35
-            array( 'section' => 'ni' )
35
+            array('section' => 'ni')
36 36
         );
37 37
     }
38 38
 
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 
52 52
         $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none');
53 53
         $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront');
54
-        $MOREURL->insert( array( 'more' => 1 ) );
54
+        $MOREURL->insert(array('more' => 1));
55 55
 
56 56
         // this makes sure that we don't repeat this debate in the list below
57 57
         $random_debate = null;
58
-        if ( isset($debates['data']) && count($debates['data']) ) {
58
+        if (isset($debates['data']) && count($debates['data'])) {
59 59
             $random_debate = $debates['data'][0];
60 60
         }
61 61
 
62 62
         $recent = array();
63
-        if ( isset($debates['data']) && count($debates['data']) ) {
63
+        if (isset($debates['data']) && count($debates['data'])) {
64 64
             // at the start of a session there may be less than 6
65 65
             // debates
66 66
             $max = 6;
67
-            if ( count($debates['data']) < 6 ) {
67
+            if (count($debates['data']) < 6) {
68 68
                 $max = count($debates['data']);
69 69
             }
70
-            for ( $i = 1; $i < $max; $i++ ) {
70
+            for ($i = 1; $i < $max; $i++) {
71 71
                 $debate = $debates['data'][$i];
72 72
                 $debate['desc'] = "Northern Ireland Assembly debates";
73 73
                 $debate['more_url'] = $MOREURL->generate();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         }
77 77
 
78 78
         $featured = array();
79
-        if ( $random_debate ) {
79
+        if ($random_debate) {
80 80
             $featured = $random_debate;
81 81
             $featured['more_url'] = $MOREURL->generate();
82 82
             $featured['desc'] = 'Northern Ireland Assembly debate';
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         $data['featured'] = $featured;
88
-        $data['debates'] = array( 'recent' => $recent);
88
+        $data['debates'] = array('recent' => $recent);
89 89
 
90 90
         $data['regional'] = $this->getMLAList();
91 91
         $data['template'] = 'ni/index';
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.