Failed Conditions
Pull Request — master (#965)
by Nick
34:10
created
www/docs/mp/index.php 3 patches
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -731,26 +731,26 @@
 block discarded – undo
731 731
 function person_error_page($message) {
732 732
     global $this_page;
733 733
     switch($this_page) {
734
-    case 'mla':
735
-        $rep = 'MLA';
736
-        $SEARCHURL = '/postcode/';
737
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('mlas');
738
-        break;
739
-    case 'msp':
740
-        $rep = 'MSP';
741
-        $SEARCHURL = '/postcode/';
742
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('msps');
743
-        break;
744
-    case 'peer':
745
-        $rep = 'Lord';
746
-        $SEARCHURL = '';
747
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('peers');
748
-        break;
749
-    default:
750
-        $rep = 'MP';
751
-        $SEARCHURL = new \MySociety\TheyWorkForYou\Url('mp');
752
-        $SEARCHURL = $SEARCHURL->generate();
753
-        $MPSURL = new \MySociety\TheyWorkForYou\Url('mps');
734
+        case 'mla':
735
+            $rep = 'MLA';
736
+            $SEARCHURL = '/postcode/';
737
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('mlas');
738
+            break;
739
+        case 'msp':
740
+            $rep = 'MSP';
741
+            $SEARCHURL = '/postcode/';
742
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('msps');
743
+            break;
744
+        case 'peer':
745
+            $rep = 'Lord';
746
+            $SEARCHURL = '';
747
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('peers');
748
+            break;
749
+        default:
750
+            $rep = 'MP';
751
+            $SEARCHURL = new \MySociety\TheyWorkForYou\Url('mp');
752
+            $SEARCHURL = $SEARCHURL->generate();
753
+            $MPSURL = new \MySociety\TheyWorkForYou\Url('mps');
754 754
     }
755 755
 
756 756
     $data = array(
Please login to merge, or discard this patch.
Spacing   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 
34 34
 // Include all the things this page needs.
35 35
 include_once '../../includes/easyparliament/init.php';
36
-include_once INCLUDESPATH . 'easyparliament/member.php';
37
-include_once INCLUDESPATH . 'technorati.php';
38
-include_once INCLUDESPATH . '../../commonlib/phplib/random.php';
39
-include_once INCLUDESPATH . '../../commonlib/phplib/auth.php';
36
+include_once INCLUDESPATH.'easyparliament/member.php';
37
+include_once INCLUDESPATH.'technorati.php';
38
+include_once INCLUDESPATH.'../../commonlib/phplib/random.php';
39
+include_once INCLUDESPATH.'../../commonlib/phplib/auth.php';
40 40
 include_once '../api/api_getGeometry.php';
41 41
 include_once '../api/api_getConstituencies.php';
42 42
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
     }
119 119
     if ($pid) {
120 120
         $URL = new \MySociety\TheyWorkForYou\Url('search');
121
-        $URL->insert( array('pid'=>$pid, 'pop'=>1) );
122
-        header('Location: ' . $URL->generate('none'));
121
+        $URL->insert(array('pid'=>$pid, 'pop'=>1));
122
+        header('Location: '.$URL->generate('none'));
123 123
         exit;
124 124
     }
125 125
 }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     } elseif ($THEUSER->postcode_is_set()) {
150 150
         get_mp_by_user_postcode($THEUSER->postcode());
151 151
     } else {
152
-        twfy_debug ('MP', "We don't have any way of telling what MP to display");
152
+        twfy_debug('MP', "We don't have any way of telling what MP to display");
153 153
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, but we can’t tell which representative to display.');
154 154
     }
155 155
     if (!isset($MEMBER) || !$MEMBER->valid) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $title .= ', former';
189 189
     }
190 190
     $title .= ' MP';
191
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
191
+    if ($MEMBER->constituency()) $title .= ', '.$MEMBER->constituency();
192 192
 }
193 193
 
194 194
 // Enhance title if this is a member of NIA
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $title .= ', former';
203 203
     }
204 204
     $title .= ' MLA';
205
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
205
+    if ($MEMBER->constituency()) $title .= ', '.$MEMBER->constituency();
206 206
 }
207 207
 
208 208
 // Enhance title if this is a member of Scottish Parliament
@@ -224,21 +224,21 @@  discard block
 block discarded – undo
224 224
 // Position if this is a member of the Commons
225 225
 if ($MEMBER->house(HOUSE_TYPE_COMMONS)) {
226 226
     $position = $MEMBER->current_member(HOUSE_TYPE_COMMONS) ? 'MP' : 'Former MP';
227
-    if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency();
227
+    if ($MEMBER->constituency()) $position .= ', '.$MEMBER->constituency();
228 228
     $positions[] = $position;
229 229
 }
230 230
 
231 231
 // Position if this is a member of NIA
232 232
 if ($MEMBER->house(HOUSE_TYPE_NI)) {
233 233
     $position = $MEMBER->current_member(HOUSE_TYPE_NI) ? 'MLA' : 'Former MLA';
234
-    if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency();
234
+    if ($MEMBER->constituency()) $position .= ', '.$MEMBER->constituency();
235 235
     $positions[] = $position;
236 236
 }
237 237
 
238 238
 // Position if this is a member of Scottish Parliament
239 239
 if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) {
240 240
     $position = $MEMBER->current_member(HOUSE_TYPE_SCOTLAND) ? 'MSP' : 'Former MSP';
241
-    $position .= ', ' . $MEMBER->constituency();
241
+    $position .= ', '.$MEMBER->constituency();
242 242
     $positions[] = $position;
243 243
 }
244 244
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 // Finally, if this is a Votes page, replace the page description with
256 256
 // something more descriptive of the actual data on the page.
257 257
 if ($pagetype == 'votes') {
258
-  $title = "Voting record - " . $title;
259
-  $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
258
+  $title = "Voting record - ".$title;
259
+  $desc = 'See how '.$member_name.' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
260 260
 }
261 261
 
262 262
 // Set page metadata
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 $DATA->set_page_metadata($this_page, 'meta_description', $desc);
265 265
 
266 266
 // Build the RSS link and add it to page data.
267
-$feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf';
268
-if (file_exists(BASEDIR . '/' . $feedurl))
267
+$feedurl = $DATA->page_metadata('mp_rss', 'url').$MEMBER->person_id().'.rdf';
268
+if (file_exists(BASEDIR.'/'.$feedurl))
269 269
     $DATA->set_page_metadata($this_page, 'rss', $feedurl);
270 270
 
271 271
 // Prepare data for the template
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 $data['eu_stance'] = $MEMBER->getEUStance();
311 311
 
312 312
 # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs
313
-$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) );
313
+$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS));
314 314
 # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs
315 315
 $data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'Sinn Féin' && !$MEMBER->current_member(HOUSE_TYPE_NI)));
316 316
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 
337 337
 $data['this_page'] = $this_page;
338 338
 $data['current_assembly'] = 'westminster';
339
-if ( $this_page == 'msp' || $this_page == 'yourmsp' ) {
339
+if ($this_page == 'msp' || $this_page == 'yourmsp') {
340 340
     $data['current_assembly'] = 'scotland';
341
-} else if ( $this_page == 'mla' || $this_page == 'yourmla' ) {
341
+} else if ($this_page == 'mla' || $this_page == 'yourmla') {
342 342
     $data['current_assembly'] = 'ni';
343 343
 }
344 344
 
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
355 355
         $policySummaries = $divisions->getMemberDivisionDetails();
356 356
 
357
-        $policyOptions = array( 'summaries' => $policySummaries);
357
+        $policyOptions = array('summaries' => $policySummaries);
358 358
 
359 359
         // Generate voting segments
360 360
         $set_descriptions = $policiesList->getSetDescriptions();
361
-        if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) {
361
+        if ($policy_set && array_key_exists($policy_set, $set_descriptions)) {
362 362
           $data['key_votes_segments'] = array(
363 363
               array(
364 364
                   'key' => $policy_set,
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
                   )
369 369
               )
370 370
           );
371
-          $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set;
372
-          $data['page_title'] = $policiesList->getSetDescriptions()[$policy_set] . ' ' . $title . ' - TheyWorkForYou';
373
-          $data['meta_description'] = 'See how ' . $data['full_name'] . ' voted on ' . $policiesList->getSetDescriptions()[$policy_set];
371
+          $data['og_image'] = $MEMBER->url(true)."/policy_set_png?policy_set=".$policy_set;
372
+          $data['page_title'] = $policiesList->getSetDescriptions()[$policy_set].' '.$title.' - TheyWorkForYou';
373
+          $data['meta_description'] = 'See how '.$data['full_name'].' voted on '.$policiesList->getSetDescriptions()[$policy_set];
374 374
           $data['single_policy_page'] = true;
375 375
         } else {
376 376
             $data['single_policy_page'] = false;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 
477 477
     case 'recent':
478 478
         $policiesList = new MySociety\TheyWorkForYou\Policies;
479
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
479
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
480 480
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList);
481 481
 
482 482
         $data['divisions'] = $divisions->getRecentMemberDivisions();
@@ -487,15 +487,15 @@  discard block
 block discarded – undo
487 487
 
488 488
     case 'divisions':
489 489
         $policyID = get_http_var('policy');
490
-        if ( $policyID ) {
491
-            $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID );
490
+        if ($policyID) {
491
+            $policiesList = new MySociety\TheyWorkForYou\Policies($policyID);
492 492
         } else {
493 493
             $policiesList = new MySociety\TheyWorkForYou\Policies;
494 494
         }
495
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
495
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
496 496
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList);
497 497
 
498
-        if ( $policyID ) {
498
+        if ($policyID) {
499 499
             $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID);
500 500
         } else {
501 501
             $data['policydivisions'] = $divisions->getAllMemberDivisionsByPolicy();
@@ -542,15 +542,15 @@  discard block
 block discarded – undo
542 542
         $im = new Imagick();
543 543
         $policiesList = new MySociety\TheyWorkForYou\Policies;
544 544
 
545
-        $url = $MEMBER->url(true) . "/policy_set_svg?policy_set=" . $policy_set;
545
+        $url = $MEMBER->url(true)."/policy_set_svg?policy_set=".$policy_set;
546 546
         $svg = file_get_contents($url);
547 547
         $im->setOption('-antialias', true);
548 548
         $im->readImageBlob($svg);
549 549
         $im->setImageFormat("png24");
550 550
 
551
-        $filename = strtolower(str_replace(' ', '_', $MEMBER->full_name() . "_" . $policiesList->getSetDescriptions()[$policy_set] . ".png"));
551
+        $filename = strtolower(str_replace(' ', '_', $MEMBER->full_name()."_".$policiesList->getSetDescriptions()[$policy_set].".png"));
552 552
         header("Content-type: image/png");
553
-        header('Content-Disposition: filename="' . $filename . '"');
553
+        header('Content-Disposition: filename="'.$filename.'"');
554 554
         print $im->getImageBlob();
555 555
 
556 556
         $im->clear();
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
         // generate party policy diffs
574 574
         $party = new MySociety\TheyWorkForYou\Party($MEMBER->party());
575
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
575
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
576 576
         $party_positions = $party->getAllPolicyPositions($policiesList);
577 577
         $policy_diffs = $MEMBER->getPartyPolicyDiffs($party, $policiesList, $positions, true);
578 578
 
@@ -626,16 +626,16 @@  discard block
 block discarded – undo
626 626
     global $THEUSER;
627 627
     $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
628 628
     if (!validate_postcode($pc)) {
629
-        twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
630
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn’t a valid postcode');
629
+        twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
630
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc).' isn’t a valid postcode');
631 631
     }
632
-    twfy_debug ('MP', "MP lookup by postcode");
632
+    twfy_debug('MP', "MP lookup by postcode");
633 633
     $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
634 634
     if ($constituency == "connection_timed_out") {
635 635
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, we couldn’t check your postcode right now, as our postcode lookup server is under quite a lot of load.');
636 636
     } elseif ($constituency == "") {
637
-        twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
638
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn’t a known postcode');
637
+        twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
638
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc).' isn’t a known postcode');
639 639
     } else {
640 640
         // Redirect to the canonical MP page, with a person id.
641 641
         $MEMBER = new MySociety\TheyWorkForYou\Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS));
@@ -647,11 +647,11 @@  discard block
 block discarded – undo
647 647
     }
648 648
 }
649 649
 
650
-function get_person_by_name($name, $const='') {
650
+function get_person_by_name($name, $const = '') {
651 651
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const));
652 652
     // Edge case, only attempt further detection if this isn't the Queen.
653 653
     if ($name !== 'elizabeth the second' || $const) {
654
-        twfy_debug ('MP', 'Redirecting for MP found by name/constituency');
654
+        twfy_debug('MP', 'Redirecting for MP found by name/constituency');
655 655
         member_redirect($MEMBER);
656 656
     }
657 657
     return $MEMBER;
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
  * Redirect to the canonical page for a member.
686 686
  */
687 687
 
688
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
688
+function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) {
689 689
     // We come here after creating a MEMBER object by various methods.
690 690
     // Now we redirect to the canonical MP page, with a person_id.
691 691
     if ($MEMBER->person_id()) {
@@ -696,13 +696,13 @@  discard block
 block discarded – undo
696 696
                 $params[] = "$key=$value";
697 697
         }
698 698
         if (count($params))
699
-            $url .= '?' . join('&', $params);
699
+            $url .= '?'.join('&', $params);
700 700
         if ($pagetype) {
701
-            $pagetype = '/' . $pagetype;
701
+            $pagetype = '/'.$pagetype;
702 702
         } else {
703 703
             $pagetype = '';
704 704
         }
705
-        header('Location: ' . $url . $pagetype, true, $code );
705
+        header('Location: '.$url.$pagetype, true, $code);
706 706
         exit;
707 707
     }
708 708
 }
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
     $data = array('mps' => array());
718 718
     foreach ($ids as $id => $constituency) {
719 719
         $data['mps'][] = array(
720
-            'url'  => WEBPATH . 'mp/?pid=' . $id,
721
-            'name' => ucwords(strtolower($name)) . ', ' . $constituency,
720
+            'url'  => WEBPATH.'mp/?pid='.$id,
721
+            'name' => ucwords(strtolower($name)).', '.$constituency,
722 722
         );
723 723
     }
724 724
     $MPSURL = new \MySociety\TheyWorkForYou\Url('mps');
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
 function person_error_page($message) {
732 732
     global $this_page;
733
-    switch($this_page) {
733
+    switch ($this_page) {
734 734
     case 'mla':
735 735
         $rep = 'MLA';
736 736
         $SEARCHURL = '/postcode/';
@@ -768,18 +768,18 @@  discard block
 block discarded – undo
768 768
  * Generate the summary of this person's held positions.
769 769
  */
770 770
 
771
-function person_summary_description ($MEMBER) {
771
+function person_summary_description($MEMBER) {
772 772
     $entered_house = $MEMBER->entered_house();
773 773
     $current_member = $MEMBER->current_member();
774 774
     $left_house = $MEMBER->left_house();
775 775
 
776 776
     if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) { # Royal short-circuit
777
-        return '<strong>Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
777
+        return '<strong>Acceded on '.$entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
778 778
             . '<br>Coronated on 2 June 1953</strong></li>';
779 779
     }
780 780
     $desc = '';
781 781
     foreach ($MEMBER->houses() as $house) {
782
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
782
+        if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
783 783
             continue; # Same info is printed further down
784 784
 
785 785
         if (!$current_member[$house]) $desc .= 'Former ';
@@ -797,20 +797,20 @@  discard block
 block discarded – undo
797 797
             # XXX: Might go horribly wrong if something odd happens
798 798
             if ($party == 'Deputy Speaker') {
799 799
                 $last = end($MEMBER->other_parties);
800
-                $desc .= $last['from'] . ' ';
800
+                $desc .= $last['from'].' ';
801 801
             }
802 802
         }
803
-        if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
803
+        if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) {
804 804
             $desc .= ' ';
805
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
806
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
807
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
805
+            if ($house == HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
806
+            if ($house == HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
807
+            if ($house == HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
808 808
             if ($party_br) {
809 809
                 $desc .= " ($party_br)";
810 810
             }
811
-            $desc .= ' for ' . $left_house[$house]['constituency'];
811
+            $desc .= ' for '.$left_house[$house]['constituency'];
812 812
         }
813
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
813
+        if ($house == HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
814 814
         $desc .= ', ';
815 815
     }
816 816
     $desc = preg_replace('#, $#', '', $desc);
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
  * @return string A HTML summary of this person's rebellion rate.
828 828
  */
829 829
 
830
-function person_rebellion_rate ($member) {
830
+function person_rebellion_rate($member) {
831 831
 
832 832
     // Rebellion string may be empty.
833 833
     $rebellion_string = '';
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
         $displayed_stuff = 1;
837 837
         $rebels_term = 'rebelled';
838 838
 
839
-        $rebellion_string = 'has <a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member->member_id() . '#divisions" title="See more details at Public Whip"><strong>' . _htmlentities($member->extra_info['public_whip_rebel_description']) . ' ' . $rebels_term . '</strong></a> against their party';
839
+        $rebellion_string = 'has <a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/'.$member->member_id().'#divisions" title="See more details at Public Whip"><strong>'._htmlentities($member->extra_info['public_whip_rebel_description']).' '.$rebels_term.'</strong></a> against their party';
840 840
 
841 841
         if (isset($member->extra_info['public_whip_rebelrank'])) {
842 842
             if ($member->extra_info['public_whip_data_date'] == 'complete') {
@@ -866,10 +866,10 @@  discard block
 block discarded – undo
866 866
     // benefit unfortunately.
867 867
     twfy_debug_timestamp();
868 868
 
869
-    $person_id= $member->person_id();
869
+    $person_id = $member->person_id();
870 870
 
871 871
     $memcache = new MySociety\TheyWorkForYou\Memcache;
872
-    $recent = $memcache->get('recent_appear:' . $person_id);
872
+    $recent = $memcache->get('recent_appear:'.$person_id);
873 873
 
874 874
     if (!$recent) {
875 875
         // Initialise the search engine
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
         $SEARCHENGINE = new \SEARCHENGINE($searchstring);
878 878
 
879 879
         $hansard = new MySociety\TheyWorkForYou\Hansard();
880
-        $args = array (
880
+        $args = array(
881 881
             's' => $searchstring,
882 882
             'p' => 1,
883 883
             'num' => 3,
@@ -886,21 +886,21 @@  discard block
 block discarded – undo
886 886
         );
887 887
         $results = $hansard->search($searchstring, $args);
888 888
         $recent = serialize($results['rows']);
889
-        $memcache->set('recent_appear:' . $person_id, $recent);
889
+        $memcache->set('recent_appear:'.$person_id, $recent);
890 890
     }
891 891
     $out['appearances'] = unserialize($recent);
892 892
     twfy_debug_timestamp();
893 893
 
894 894
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
895
-    $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) );
895
+    $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1));
896 896
 
897
-    $out['more_href'] = $MOREURL->generate() . '#n4';
898
-    $out['more_text'] = 'More of ' . ucfirst($member->full_name()) . '&rsquo;s recent appearances';
897
+    $out['more_href'] = $MOREURL->generate().'#n4';
898
+    $out['more_text'] = 'More of '.ucfirst($member->full_name()).'&rsquo;s recent appearances';
899 899
 
900 900
     if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
901 901
         // If we set an RSS feed for this page.
902 902
         $HELPURL = new \MySociety\TheyWorkForYou\Url('help');
903
-        $out['additional_links'] = '<a href="' . WEBPATH . $rssurl . '" title="XML version of this person&rsquo;s recent appearances">RSS feed</a> (<a href="' . $HELPURL->generate() . '#rss" title="An explanation of what RSS feeds are for">?</a>)';
903
+        $out['additional_links'] = '<a href="'.WEBPATH.$rssurl.'" title="XML version of this person&rsquo;s recent appearances">RSS feed</a> (<a href="'.$HELPURL->generate().'#rss" title="An explanation of what RSS feeds are for">?</a>)';
904 904
     }
905 905
 
906 906
     return $out;
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
     if (isset($links['maiden_speech'])) {
917 917
         $maiden_speech = fix_gid_from_db($links['maiden_speech']);
918 918
         $out[] = array(
919
-                'href' => WEBPATH . 'debate/?id=' . $maiden_speech,
919
+                'href' => WEBPATH.'debate/?id='.$maiden_speech,
920 920
                 'text' => 'Maiden speech'
921 921
         );
922 922
     }
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 
961 961
     if ($member->house(HOUSE_TYPE_COMMONS)) {
962 962
         $out[] = array(
963
-                'href' => 'http://www.edms.org.uk/mps/' . $member->person_id(),
963
+                'href' => 'http://www.edms.org.uk/mps/'.$member->person_id(),
964 964
                 'text' => 'Early Day Motions signed by this MP'
965 965
         );
966 966
     }
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
 
984 984
     if (isset($links['twitter_username'])) {
985 985
         $out[] = array(
986
-                'href' => 'https://twitter.com/' . _htmlentities($links['twitter_username']),
987
-                'text' => '@' . _htmlentities($links['twitter_username']),
986
+                'href' => 'https://twitter.com/'._htmlentities($links['twitter_username']),
987
+                'text' => '@'._htmlentities($links['twitter_username']),
988 988
                 'type' => 'twitter'
989 989
         );
990 990
     }
@@ -1049,11 +1049,11 @@  discard block
 block discarded – undo
1049 1049
             if ($arr['chairman']) {
1050 1050
                 $text .= 'Chairman, ';
1051 1051
             }
1052
-            $text .= $arr['title'] . ' Committee';
1052
+            $text .= $arr['title'].' Committee';
1053 1053
             $out['data'][] = array(
1054
-                'href'      => '/pbc/' . $arr['session'] . '/' . urlencode($arr['title']),
1054
+                'href'      => '/pbc/'.$arr['session'].'/'.urlencode($arr['title']),
1055 1055
                 'text'      => $text,
1056
-                'attending' => $arr['attending'] . ' out of ' . $arr['outof']
1056
+                'attending' => $arr['attending'].' out of '.$arr['outof']
1057 1057
             );
1058 1058
         }
1059 1059
     }
@@ -1082,8 +1082,8 @@  discard block
 block discarded – undo
1082 1082
     $section = 'section:debates section:whall section:lords section:ni';
1083 1083
     $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>$section, 'pop'=>1));
1084 1084
     if ($member->party() != 'Sinn Féin') {
1085
-        if (display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in ', 'debate', ' ' . $since_text, ' <a href="' . $MOREURL->generate() . '">See all ' . $member->full_name() . '&rsquo;s speeches</a>', $extra_info)) {
1086
-            $out[] = display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in ', 'debate', ' ' . $since_text, ' <a href="' . $MOREURL->generate() . '">See all ' . $member->full_name() . '&rsquo;s speeches</a>', $extra_info);
1085
+        if (display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in ', 'debate', ' '.$since_text, ' <a href="'.$MOREURL->generate().'">See all '.$member->full_name().'&rsquo;s speeches</a>', $extra_info)) {
1086
+            $out[] = display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in ', 'debate', ' '.$since_text, ' <a href="'.$MOREURL->generate().'">See all '.$member->full_name().'&rsquo;s speeches</a>', $extra_info);
1087 1087
         }
1088 1088
 
1089 1089
         $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1));
@@ -1096,12 +1096,12 @@  discard block
 block discarded – undo
1096 1096
         if ($member->party() == 'SPK' || $member->party() == 'CWM' || $member->party() == 'DCWM') {
1097 1097
             $minister = 2;
1098 1098
         }
1099
-        if (display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="' . $MOREURL->generate() . '">', 'written question', '</a> ' . $since_text, '', $extra_info, $minister, $Lminister)) {
1100
-            $out[] = display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="' . $MOREURL->generate() . '">', 'written question', '</a> ' . $since_text, '', $extra_info, $minister, $Lminister);
1099
+        if (display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="'.$MOREURL->generate().'">', 'written question', '</a> '.$since_text, '', $extra_info, $minister, $Lminister)) {
1100
+            $out[] = display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="'.$MOREURL->generate().'">', 'written question', '</a> '.$since_text, '', $extra_info, $minister, $Lminister);
1101 1101
         }
1102 1102
     }
1103 1103
 
1104
-    foreach ( $wtt_stats_years as $year ) {
1104
+    foreach ($wtt_stats_years as $year) {
1105 1105
         $wtt_displayed = display_writetothem_numbers($year, $extra_info);
1106 1106
         if ($wtt_displayed) {
1107 1107
             $out[] = $wtt_displayed;
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
         if ($member->house_disp == HOUSE_TYPE_LORDS) {
1122 1122
             $when = 'in this House with this affiliation up to the 2015 general election';
1123 1123
         }
1124
-        $div_attend = display_stats_line('public_whip_division_attendance', 'Has voted in <a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member->member_id() . '&amp;showall=yes#divisions" title="See more details at Public Whip">', 'of vote', '</a> ' . $when, $after_stuff, $extra_info);
1124
+        $div_attend = display_stats_line('public_whip_division_attendance', 'Has voted in <a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/'.$member->member_id().'&amp;showall=yes#divisions" title="See more details at Public Whip">', 'of vote', '</a> '.$when, $after_stuff, $extra_info);
1125 1125
         if ($div_attend) {
1126 1126
             $out[] = $div_attend;
1127 1127
         }
@@ -1131,33 +1131,33 @@  discard block
 block discarded – undo
1131 1131
         }
1132 1132
         */
1133 1133
 
1134
-        if (display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid='.$member->person_id().'">', 'annotation', "</a> on this MP&rsquo;s speeches", '', $extra_info)) {
1135
-            $out[] = display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid='.$member->person_id().'">', 'annotation', "</a> on this MP&rsquo;s speeches", '', $extra_info);
1134
+        if (display_stats_line('comments_on_speeches', 'People have made <a href="'.WEBPATH.'comments/recent/?pid='.$member->person_id().'">', 'annotation', "</a> on this MP&rsquo;s speeches", '', $extra_info)) {
1135
+            $out[] = display_stats_line('comments_on_speeches', 'People have made <a href="'.WEBPATH.'comments/recent/?pid='.$member->person_id().'">', 'annotation', "</a> on this MP&rsquo;s speeches", '', $extra_info);
1136 1136
         }
1137 1137
         if (display_stats_line('reading_age', 'This MP&rsquo;s speeches, in Hansard, are readable by an average ', '', ' year old, going by the <a href="https://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info)) {
1138 1138
             $out[] = display_stats_line('reading_age', 'This MP&rsquo;s speeches, in Hansard, are readable by an average ', '', ' year old, going by the <a href="https://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info);
1139 1139
         }
1140 1140
     }
1141 1141
 
1142
-    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1143
-        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1142
+    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts'] > 0 || $has_email_alerts)) {
1143
+        $line = '<strong>'._htmlentities($extra_info['number_of_alerts']).'</strong> '.($extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are').' tracking ';
1144 1144
         if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1145 1145
         elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1146 1146
         elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1147 1147
         elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1148 1148
         elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1149 1149
         if ($has_email_alerts) {
1150
-            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1150
+            $line .= ' &mdash; <a href="'.WEBPATH.'alert/?pid='.$member->person_id().'">email me updates on '.$member->full_name().'&rsquo;s activity</a>';
1151 1151
         }
1152 1152
 
1153 1153
         $out[] = $line;
1154 1154
     }
1155 1155
 
1156 1156
     if ($member->party() != 'Sinn Féin') {
1157
-        if (display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="' . WEBPATH . 'help/#numbers">Why is this here?</a>)</small>', $extra_info)) {
1158
-            $line = display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="' . WEBPATH . 'help/#numbers">Why is this here?</a>)</small>', $extra_info);
1157
+        if (display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="'.WEBPATH.'help/#numbers">Why is this here?</a>)</small>', $extra_info)) {
1158
+            $line = display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="'.WEBPATH.'help/#numbers">Why is this here?</a>)</small>', $extra_info);
1159 1159
             if (isset($extra_info['three_word_alliteration_content'])) {
1160
-                $line .= "\n<!-- " . $extra_info['three_word_alliteration_content'] . " -->\n";
1160
+                $line .= "\n<!-- ".$extra_info['three_word_alliteration_content']." -->\n";
1161 1161
             }
1162 1162
             $out[] = $line;
1163 1163
         }
@@ -1177,28 +1177,28 @@  discard block
 block discarded – undo
1177 1177
 }
1178 1178
 
1179 1179
 function display_stats_line_house($house, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff) {
1180
-    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category =='comments_on_speeches' ||
1181
-        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category =='Lcomments_on_speeches') {
1182
-        if ($extra_info[$category]==0) {
1180
+    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category == 'comments_on_speeches' ||
1181
+        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category == 'Lcomments_on_speeches') {
1182
+        if ($extra_info[$category] == 0) {
1183 1183
             $blurb = preg_replace('#<a.*?>#', '', $blurb);
1184 1184
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1185 1185
         }
1186 1186
     }
1187
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1187
+    if ($house == HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1188 1188
     $line = $blurb;
1189
-    $line .= '<strong>' . $extra_info[$category];
1190
-    if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1189
+    $line .= '<strong>'.$extra_info[$category];
1190
+    if ($type) $line .= ' '.make_plural($type, $extra_info[$category]);
1191 1191
     $line .= '</strong>';
1192 1192
     $line .= $inwhat;
1193
-    if ($minister===2) {
1193
+    if ($minister === 2) {
1194 1194
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1195 1195
     } elseif ($minister)
1196 1196
         $line .= ' &#8212; Ministers do not ask written questions';
1197 1197
     else {
1198
-        $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1199
-        if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1198
+        $type = ($house == HOUSE_TYPE_COMMONS ? 'MP' : ($house == HOUSE_TYPE_LORDS ? 'Lord' : 'MLA'));
1199
+        if (!get_http_var('rem') && isset($extra_info[$category.'_quintile'])) {
1200 1200
             $line .= ' &#8212; ';
1201
-            $q = $extra_info[$category . '_quintile'];
1201
+            $q = $extra_info[$category.'_quintile'];
1202 1202
             if ($q == 0) {
1203 1203
                 $line .= 'well above average';
1204 1204
             } elseif ($q == 1) {
@@ -1213,13 +1213,13 @@  discard block
 block discarded – undo
1213 1213
                 $line .= '[Impossible quintile!]';
1214 1214
             }
1215 1215
             $line .= ' amongst ';
1216
-            $line .= $type . 's';
1217
-        } elseif (!get_http_var('rem') && isset($extra_info[$category . '_rank'])) {
1216
+            $line .= $type.'s';
1217
+        } elseif (!get_http_var('rem') && isset($extra_info[$category.'_rank'])) {
1218 1218
             $line .= ' &#8212; ';
1219 1219
             #if (isset($extra_info[$category . '_rank_joint']))
1220 1220
             #   print 'joint ';
1221
-            $line .= make_ranking($extra_info[$category . '_rank']) . ' out of ' . $extra_info[$category . '_rank_outof'];
1222
-            $line .= ' ' . $type . 's';
1221
+            $line .= make_ranking($extra_info[$category.'_rank']).' out of '.$extra_info[$category.'_rank_outof'];
1222
+            $line .= ' '.$type.'s';
1223 1223
         }
1224 1224
     }
1225 1225
     $line .= ".$afterstuff";
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 
1229 1229
 function display_writetothem_numbers($year, $extra_info) {
1230 1230
     if (isset($extra_info["writetothem_responsiveness_notes_$year"])) {
1231
-        return '<li>Responsiveness to messages sent via <a href="https://www.writetothem.com/stats/' . $year . '/mps">WriteToThem.com</a> in ' . $year . ': ' . $extra_info["writetothem_responsiveness_notes_$year"] . '.</li>';
1231
+        return '<li>Responsiveness to messages sent via <a href="https://www.writetothem.com/stats/'.$year.'/mps">WriteToThem.com</a> in '.$year.': '.$extra_info["writetothem_responsiveness_notes_$year"].'.</li>';
1232 1232
     } elseif (isset($extra_info["writetothem_responsiveness_mean_$year"])) {
1233 1233
         $mean = $extra_info["writetothem_responsiveness_mean_$year"];
1234 1234
 
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
         if ($a == 'very high') $a = 'a very high';
1241 1241
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1242 1242
 
1243
-        return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info);
1243
+        return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: ".$mean." --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info);
1244 1244
     }
1245 1245
 
1246 1246
 }
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 function get_all_writetothem_strings($member, $wtt_stats_years) {
1249 1249
     $extra_info = $member->extra_info();
1250 1250
     $strings = array();
1251
-    foreach ( $wtt_stats_years as $year ) {
1251
+    foreach ($wtt_stats_years as $year) {
1252 1252
 
1253 1253
         if (isset($extra_info["writetothem_responsiveness_mean_$year"])) {
1254 1254
             $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
         return;
1265 1265
     }
1266 1266
 
1267
-    $reg = array( 'date' => '', 'data' => '<p>Nil</p>' );
1267
+    $reg = array('date' => '', 'data' => '<p>Nil</p>');
1268 1268
     if (isset($extra_info['register_member_interests_date'])) {
1269 1269
         $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
1270 1270
     }
@@ -1279,27 +1279,27 @@  discard block
 block discarded – undo
1279 1279
     if ($constituencies == 'CONNECTION_TIMED_OUT') {
1280 1280
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, we couldn&rsquo;t check your postcode right now, as our postcode lookup server is under quite a lot of load.');
1281 1281
     } elseif (!$constituencies) {
1282
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . htmlentities($pc) . ' isn&rsquo;t a known postcode');
1282
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '.htmlentities($pc).' isn&rsquo;t a known postcode');
1283 1283
     } elseif (!isset($constituencies[$area_type])) {
1284
-        throw new MySociety\TheyWorkForYou\MemberException(htmlentities($pc) . ' does not appear to be a valid postcode');
1284
+        throw new MySociety\TheyWorkForYou\MemberException(htmlentities($pc).' does not appear to be a valid postcode');
1285 1285
     }
1286 1286
     global $PAGE;
1287 1287
     $a = array_values($constituencies);
1288 1288
     $db = new ParlDB;
1289 1289
     $query_base = "SELECT member.person_id, given_name, family_name, constituency, house
1290 1290
         FROM member, person_names pn
1291
-        WHERE constituency IN ('" . join("','", $a) . "')
1291
+        WHERE constituency IN ('" . join("','", $a)."')
1292 1292
             AND member.person_id = pn.person_id AND pn.type = 'name'
1293 1293
             AND pn.end_date = (SELECT MAX(end_date) FROM person_names WHERE person_names.person_id = member.person_id)";
1294
-    $q = $db->query($query_base . " AND left_reason = 'still_in_office' AND house in (" . HOUSE_TYPE_NI . "," . HOUSE_TYPE_SCOTLAND . ")");
1294
+    $q = $db->query($query_base." AND left_reason = 'still_in_office' AND house in (".HOUSE_TYPE_NI.",".HOUSE_TYPE_SCOTLAND.")");
1295 1295
     $current = true;
1296 1296
     if (!$q->rows() && ($dissolution = MySociety\TheyWorkForYou\Dissolution::db())) {
1297 1297
         $current = false;
1298
-        $q = $db->query($query_base . " AND $dissolution[query]",
1298
+        $q = $db->query($query_base." AND $dissolution[query]",
1299 1299
             $dissolution['params']);
1300 1300
     }
1301 1301
     $mcon = array(); $mreg = array();
1302
-    for ($i=0; $i<$q->rows(); $i++) {
1302
+    for ($i = 0; $i < $q->rows(); $i++) {
1303 1303
         $house = $q->field($i, 'house');
1304 1304
         $pid = $q->field($i, 'person_id');
1305 1305
         $cons = $q->field($i, 'constituency');
@@ -1314,33 +1314,33 @@  discard block
 block discarded – undo
1314 1314
                 $mreg[] = $q->row($i);
1315 1315
             }
1316 1316
         } else {
1317
-            throw new MySociety\TheyWorkForYou\MemberException('Odd result returned!' . $house);
1317
+            throw new MySociety\TheyWorkForYou\MemberException('Odd result returned!'.$house);
1318 1318
         }
1319 1319
     }
1320 1320
     if ($rep_type == 'msp') {
1321 1321
         if ($current) {
1322 1322
             $data['members_statement'] = '<p>You have one constituency MSP (Member of the Scottish Parliament) and multiple region MSPs.</p>';
1323
-            $data['members_statement'] .= '<p>Your <strong>constituency MSP</strong> is <a href="/msp/?p=' . $mcon['person_id'] . '">';
1324
-            $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, MSP for ' . $mcon['constituency'];
1325
-            $data['members_statement'] .= '.</p> <p>Your <strong>' . $constituencies['SPE'] . ' region MSPs</strong> are:</p>';
1323
+            $data['members_statement'] .= '<p>Your <strong>constituency MSP</strong> is <a href="/msp/?p='.$mcon['person_id'].'">';
1324
+            $data['members_statement'] .= $mcon['given_name'].' '.$mcon['family_name'].'</a>, MSP for '.$mcon['constituency'];
1325
+            $data['members_statement'] .= '.</p> <p>Your <strong>'.$constituencies['SPE'].' region MSPs</strong> are:</p>';
1326 1326
         } else {
1327 1327
             $data['members_statement'] = '<p>You had one constituency MSP (Member of the Scottish Parliament) and multiple region MSPs.</p>';
1328
-            $data['members_statement'] .= '<p>Your <strong>constituency MSP</strong> was <a href="/msp/?p=' . $mcon['person_id'] . '">';
1329
-            $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, MSP for ' . $mcon['constituency'];
1330
-            $data['members_statement'] .= '.</p> <p>Your <strong>' . $constituencies['SPE'] . ' region MSPs</strong> were:</p>';
1328
+            $data['members_statement'] .= '<p>Your <strong>constituency MSP</strong> was <a href="/msp/?p='.$mcon['person_id'].'">';
1329
+            $data['members_statement'] .= $mcon['given_name'].' '.$mcon['family_name'].'</a>, MSP for '.$mcon['constituency'];
1330
+            $data['members_statement'] .= '.</p> <p>Your <strong>'.$constituencies['SPE'].' region MSPs</strong> were:</p>';
1331 1331
         }
1332 1332
     } else {
1333 1333
         if ($current) {
1334
-            $data['members_statement'] = '<p>You have multiple MLAs (Members of the Legislative Assembly) who represent you in ' . $constituencies['NIE'] . '. They are:</p>';
1334
+            $data['members_statement'] = '<p>You have multiple MLAs (Members of the Legislative Assembly) who represent you in '.$constituencies['NIE'].'. They are:</p>';
1335 1335
         } else {
1336
-            $data['members_statement'] = '<p>You had multiple MLAs (Members of the Legislative Assembly) who represented you in ' . $constituencies['NIE'] . '. They were:</p>';
1336
+            $data['members_statement'] = '<p>You had multiple MLAs (Members of the Legislative Assembly) who represented you in '.$constituencies['NIE'].'. They were:</p>';
1337 1337
         }
1338 1338
     }
1339 1339
 
1340
-    foreach($mreg as $reg) {
1341
-        $data['members'][] = array (
1342
-            'url' => '/' . $rep_type . '/?p=' . $reg['person_id'],
1343
-            'name' => $reg['given_name'] . ' ' . $reg['family_name']
1340
+    foreach ($mreg as $reg) {
1341
+        $data['members'][] = array(
1342
+            'url' => '/'.$rep_type.'/?p='.$reg['person_id'],
1343
+            'name' => $reg['given_name'].' '.$reg['family_name']
1344 1344
         );
1345 1345
 
1346 1346
     }
Please login to merge, or discard this patch.
Braces   +143 added lines, -63 removed lines patch added patch discarded remove patch
@@ -62,16 +62,36 @@  discard block
 block discarded – undo
62 62
 $constituency = strtolower(str_replace('_', ' ', get_http_var('c')));
63 63
 
64 64
 // Fix for names with non-ASCII characters
65
-if ($name == 'sion simon') $name = 'si\xf4n simon';
66
-if ($name == 'sian james') $name = 'si\xe2n james';
67
-if ($name == 'lembit opik') $name = 'lembit \xf6pik';
68
-if ($name == 'bairbre de brun') $name = 'bairbre de br\xfan';
69
-if ($name == 'daithi mckay') $name = 'daith\xed mckay';
70
-if ($name == 'caral ni chuilin') $name = 'car\xe1l n\xed chuil\xedn';
71
-if ($name == 'caledon du pre') $name = 'caledon du pr\xe9';
72
-if ($name == 'sean etchingham') $name = 'se\xe1n etchingham';
73
-if ($name == 'john tinne') $name = 'john tinn\xe9';
74
-if ($name == 'renee short') $name = 'ren\xe9e short';
65
+if ($name == 'sion simon') {
66
+    $name = 'si\xf4n simon';
67
+}
68
+if ($name == 'sian james') {
69
+    $name = 'si\xe2n james';
70
+}
71
+if ($name == 'lembit opik') {
72
+    $name = 'lembit \xf6pik';
73
+}
74
+if ($name == 'bairbre de brun') {
75
+    $name = 'bairbre de br\xfan';
76
+}
77
+if ($name == 'daithi mckay') {
78
+    $name = 'daith\xed mckay';
79
+}
80
+if ($name == 'caral ni chuilin') {
81
+    $name = 'car\xe1l n\xed chuil\xedn';
82
+}
83
+if ($name == 'caledon du pre') {
84
+    $name = 'caledon du pr\xe9';
85
+}
86
+if ($name == 'sean etchingham') {
87
+    $name = 'se\xe1n etchingham';
88
+}
89
+if ($name == 'john tinne') {
90
+    $name = 'john tinn\xe9';
91
+}
92
+if ($name == 'renee short') {
93
+    $name = 'ren\xe9e short';
94
+}
75 95
 
76 96
 // Fix for common misspellings, name changes etc
77 97
 $name_fix = array(
@@ -103,7 +123,9 @@  discard block
 block discarded – undo
103 123
 }
104 124
 
105 125
 // Fixes for Ynys Mon, and a Unicode URL
106
-if ($constituency == 'ynys mon') $constituency = "ynys m\xf4n";
126
+if ($constituency == 'ynys mon') {
127
+    $constituency = "ynys m\xf4n";
128
+}
107 129
 if (preg_match("#^ynys m\xc3\xb4n#i", $constituency)) {
108 130
     $constituency = "ynys m\xf4n";
109 131
 }
@@ -126,11 +148,17 @@  discard block
 block discarded – undo
126 148
 
127 149
 /////////////////////////////////////////////////////////
128 150
 // DETERMINE TYPE OF REPRESENTITIVE
129
-if (get_http_var('peer')) $this_page = 'peer';
130
-elseif (get_http_var('royal')) $this_page = 'royal';
131
-elseif (get_http_var('mla')) $this_page = 'mla';
132
-elseif (get_http_var('msp')) $this_page = 'msp';
133
-else $this_page = 'mp';
151
+if (get_http_var('peer')) {
152
+    $this_page = 'peer';
153
+} elseif (get_http_var('royal')) {
154
+    $this_page = 'royal';
155
+} elseif (get_http_var('mla')) {
156
+    $this_page = 'mla';
157
+} elseif (get_http_var('msp')) {
158
+    $this_page = 'msp';
159
+} else {
160
+    $this_page = 'mp';
161
+}
134 162
 
135 163
 try {
136 164
     if (is_numeric($pid)) {
@@ -179,8 +207,9 @@  discard block
 block discarded – undo
179 207
 $desc = "Read $member_name's contributions to Parliament, including speeches and questions";
180 208
 
181 209
 // Enhance description if this is a current member
182
-if ($MEMBER->current_member_anywhere())
210
+if ($MEMBER->current_member_anywhere()) {
183 211
     $desc .= ', investigate their voting record, and get email alerts on their activity';
212
+}
184 213
 
185 214
 // Enhance title if this is a member of the Commons
186 215
 if ($MEMBER->house(HOUSE_TYPE_COMMONS)) {
@@ -188,8 +217,10 @@  discard block
 block discarded – undo
188 217
         $title .= ', former';
189 218
     }
190 219
     $title .= ' MP';
191
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
192
-}
220
+    if ($MEMBER->constituency()) {
221
+        $title .= ', ' . $MEMBER->constituency();
222
+    }
223
+    }
193 224
 
194 225
 // Enhance title if this is a member of NIA
195 226
 if ($MEMBER->house(HOUSE_TYPE_NI)) {
@@ -202,8 +233,10 @@  discard block
 block discarded – undo
202 233
         $title .= ', former';
203 234
     }
204 235
     $title .= ' MLA';
205
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
206
-}
236
+    if ($MEMBER->constituency()) {
237
+        $title .= ', ' . $MEMBER->constituency();
238
+    }
239
+    }
207 240
 
208 241
 // Enhance title if this is a member of Scottish Parliament
209 242
 if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) {
@@ -224,14 +257,18 @@  discard block
 block discarded – undo
224 257
 // Position if this is a member of the Commons
225 258
 if ($MEMBER->house(HOUSE_TYPE_COMMONS)) {
226 259
     $position = $MEMBER->current_member(HOUSE_TYPE_COMMONS) ? 'MP' : 'Former MP';
227
-    if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency();
260
+    if ($MEMBER->constituency()) {
261
+        $position .= ', ' . $MEMBER->constituency();
262
+    }
228 263
     $positions[] = $position;
229 264
 }
230 265
 
231 266
 // Position if this is a member of NIA
232 267
 if ($MEMBER->house(HOUSE_TYPE_NI)) {
233 268
     $position = $MEMBER->current_member(HOUSE_TYPE_NI) ? 'MLA' : 'Former MLA';
234
-    if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency();
269
+    if ($MEMBER->constituency()) {
270
+        $position .= ', ' . $MEMBER->constituency();
271
+    }
235 272
     $positions[] = $position;
236 273
 }
237 274
 
@@ -265,8 +302,9 @@  discard block
 block discarded – undo
265 302
 
266 303
 // Build the RSS link and add it to page data.
267 304
 $feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf';
268
-if (file_exists(BASEDIR . '/' . $feedurl))
305
+if (file_exists(BASEDIR . '/' . $feedurl)) {
269 306
     $DATA->set_page_metadata($this_page, 'rss', $feedurl);
307
+}
270 308
 
271 309
 // Prepare data for the template
272 310
 $data['full_name'] = $MEMBER->full_name();
@@ -692,11 +730,13 @@  discard block
 block discarded – undo
692 730
         $url = $MEMBER->url();
693 731
         $params = array();
694 732
         foreach ($_GET as $key => $value) {
695
-            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid')
696
-                $params[] = "$key=$value";
733
+            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') {
734
+                            $params[] = "$key=$value";
735
+            }
736
+        }
737
+        if (count($params)) {
738
+                    $url .= '?' . join('&', $params);
697 739
         }
698
-        if (count($params))
699
-            $url .= '?' . join('&', $params);
700 740
         if ($pagetype) {
701 741
             $pagetype = '/' . $pagetype;
702 742
         } else {
@@ -779,10 +819,14 @@  discard block
 block discarded – undo
779 819
     }
780 820
     $desc = '';
781 821
     foreach ($MEMBER->houses() as $house) {
782
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
783
-            continue; # Same info is printed further down
822
+        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) {
823
+                    continue;
824
+        }
825
+        # Same info is printed further down
784 826
 
785
-        if (!$current_member[$house]) $desc .= 'Former ';
827
+        if (!$current_member[$house]) {
828
+            $desc .= 'Former ';
829
+        }
786 830
 
787 831
         $party = $left_house[$house]['party'];
788 832
         $party_br = '';
@@ -790,8 +834,9 @@  discard block
 block discarded – undo
790 834
             $party_br = $m[2];
791 835
             $party = $m[1];
792 836
         }
793
-        if ($party != 'unknown')
794
-            $desc .= _htmlentities($party);
837
+        if ($party != 'unknown') {
838
+                    $desc .= _htmlentities($party);
839
+        }
795 840
         if ($party == 'Speaker' || $party == 'Deputy Speaker') {
796 841
             $desc .= ', and ';
797 842
             # XXX: Might go horribly wrong if something odd happens
@@ -802,15 +847,23 @@  discard block
 block discarded – undo
802 847
         }
803 848
         if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
804 849
             $desc .= ' ';
805
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
806
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
807
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
850
+            if ($house==HOUSE_TYPE_COMMONS) {
851
+                $desc .= '<abbr title="Member of Parliament">MP</abbr>';
852
+            }
853
+            if ($house==HOUSE_TYPE_NI) {
854
+                $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
855
+            }
856
+            if ($house==HOUSE_TYPE_SCOTLAND) {
857
+                $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
858
+            }
808 859
             if ($party_br) {
809 860
                 $desc .= " ($party_br)";
810 861
             }
811 862
             $desc .= ' for ' . $left_house[$house]['constituency'];
812 863
         }
813
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
864
+        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') {
865
+            $desc .= ' Peer';
866
+        }
814 867
         $desc .= ', ';
815 868
     }
816 869
     $desc = preg_replace('#, $#', '', $desc);
@@ -1073,10 +1126,13 @@  discard block
 block discarded – undo
1073 1126
     # Find latest entered house
1074 1127
     $entered_house = null;
1075 1128
     foreach ($member->entered_house() as $h => $eh) {
1076
-        if (!$entered_house || $eh['date'] > $entered_house) $entered_house = $eh['date'];
1129
+        if (!$entered_house || $eh['date'] > $entered_house) {
1130
+            $entered_house = $eh['date'];
1131
+        }
1132
+    }
1133
+    if ($entered_house > $year_ago) {
1134
+            $since_text = 'since joining Parliament';
1077 1135
     }
1078
-    if ($entered_house > $year_ago)
1079
-        $since_text = 'since joining Parliament';
1080 1136
 
1081 1137
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
1082 1138
     $section = 'section:debates section:whall section:lords section:ni';
@@ -1089,10 +1145,12 @@  discard block
 block discarded – undo
1089 1145
         $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1));
1090 1146
         // We assume that if they've answered a question, they're a minister
1091 1147
         $minister = 0; $Lminister = false;
1092
-        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0)
1093
-            $minister = 1;
1094
-        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0)
1095
-            $Lminister = true;
1148
+        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
1149
+                    $minister = 1;
1150
+        }
1151
+        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
1152
+                    $Lminister = true;
1153
+        }
1096 1154
         if ($member->party() == 'SPK' || $member->party() == 'CWM' || $member->party() == 'DCWM') {
1097 1155
             $minister = 2;
1098 1156
         }
@@ -1141,11 +1199,17 @@  discard block
 block discarded – undo
1141 1199
 
1142 1200
     if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1143 1201
         $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1144
-        if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1145
-        elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1146
-        elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1147
-        elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1148
-        elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1202
+        if ($member->house_disp == HOUSE_TYPE_COMMONS) {
1203
+            $line .= 'this MP';
1204
+        } elseif ($member->house_disp == HOUSE_TYPE_LORDS) {
1205
+            $line .= 'this peer';
1206
+        } elseif ($member->house_disp == HOUSE_TYPE_NI) {
1207
+            $line .= 'this MLA';
1208
+        } elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) {
1209
+            $line .= 'this MSP';
1210
+        } elseif ($member->house_disp == HOUSE_TYPE_ROYAL) {
1211
+            $line .= $member->full_name();
1212
+        }
1149 1213
         if ($has_email_alerts) {
1150 1214
             $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1151 1215
         }
@@ -1169,10 +1233,12 @@  discard block
 block discarded – undo
1169 1233
 
1170 1234
 function display_stats_line($category, $blurb, $type, $inwhat, $afterstuff, $extra_info, $minister = false, $Lminister = false) {
1171 1235
     $return = false;
1172
-    if (isset($extra_info[$category]))
1173
-        $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1174
-    if (isset($extra_info["L$category"]))
1175
-        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1236
+    if (isset($extra_info[$category])) {
1237
+            $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1238
+    }
1239
+    if (isset($extra_info["L$category"])) {
1240
+            $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1241
+    }
1176 1242
     return $return;
1177 1243
 }
1178 1244
 
@@ -1184,17 +1250,21 @@  discard block
 block discarded – undo
1184 1250
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1185 1251
         }
1186 1252
     }
1187
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1253
+    if ($house==HOUSE_TYPE_LORDS) {
1254
+        $inwhat = str_replace('MP', 'Lord', $inwhat);
1255
+    }
1188 1256
     $line = $blurb;
1189 1257
     $line .= '<strong>' . $extra_info[$category];
1190
-    if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1258
+    if ($type) {
1259
+        $line .= ' ' . make_plural($type, $extra_info[$category]);
1260
+    }
1191 1261
     $line .= '</strong>';
1192 1262
     $line .= $inwhat;
1193 1263
     if ($minister===2) {
1194 1264
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1195
-    } elseif ($minister)
1196
-        $line .= ' &#8212; Ministers do not ask written questions';
1197
-    else {
1265
+    } elseif ($minister) {
1266
+            $line .= ' &#8212; Ministers do not ask written questions';
1267
+    } else {
1198 1268
         $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1199 1269
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1200 1270
             $line .= ' &#8212; ';
@@ -1233,11 +1303,21 @@  discard block
 block discarded – undo
1233 1303
         $mean = $extra_info["writetothem_responsiveness_mean_$year"];
1234 1304
 
1235 1305
         $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
1236
-        if ($a == 'very low') $a = 'a very low';
1237
-        if ($a == 'low') $a = 'a low';
1238
-        if ($a == 'medium') $a = 'a medium';
1239
-        if ($a == 'high') $a = 'a high';
1240
-        if ($a == 'very high') $a = 'a very high';
1306
+        if ($a == 'very low') {
1307
+            $a = 'a very low';
1308
+        }
1309
+        if ($a == 'low') {
1310
+            $a = 'a low';
1311
+        }
1312
+        if ($a == 'medium') {
1313
+            $a = 'a medium';
1314
+        }
1315
+        if ($a == 'high') {
1316
+            $a = 'a high';
1317
+        }
1318
+        if ($a == 'very high') {
1319
+            $a = 'a very high';
1320
+        }
1241 1321
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1242 1322
 
1243 1323
         return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info);
Please login to merge, or discard this patch.
www/docs/admin/featured.php 1 patch
Spacing   +9 added lines, -9 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 ));
32
+    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid));
33 33
     $url_gid = fix_gid_from_db($gid);
34 34
     $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q->field(0, '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,11 +113,11 @@  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
-        include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php';
120
+        include INCLUDESPATH.'easyparliament/templates/html/homepage/featured.php';
121 121
     } else {
122 122
         print "<p>A random debate from the last 7 days will be displayed</p>";
123 123
     }
@@ -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) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     $featured->set_related(array($related1, $related2, $related3));
187 187
 
188 188
     $out = "<h4>update successful</h4>";
189
-    $out .= "<p>Title set to " . _htmlspecialchars($title) . " and gid to " . _htmlspecialchars($gid) . "</p>";
189
+    $out .= "<p>Title set to "._htmlspecialchars($title)." and gid to "._htmlspecialchars($gid)."</p>";
190 190
 
191 191
     return $out;
192 192
 }
Please login to merge, or discard this patch.
classes/MiniSurvey.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace MySociety\TheyWorkForYou;
4 4
 
5
-require_once INCLUDESPATH . "../../commonlib/phplib/random.php";
6
-require_once INCLUDESPATH . "../../commonlib/phplib/auth.php";
5
+require_once INCLUDESPATH."../../commonlib/phplib/random.php";
6
+require_once INCLUDESPATH."../../commonlib/phplib/auth.php";
7 7
 
8 8
 class MiniSurvey {
9 9
 
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
         if ($hide_question) {
26 26
             $always_ask = 0;
27 27
             $show_survey_qn = $current_question;
28
-            setcookie('survey', $current_question, time()+60*60*24*365, '/');
28
+            setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
29 29
         } elseif ($has_answered_question == $current_question && !$always_ask) {
30 30
             $show_survey_qn = $current_question;
31
-            setcookie('survey', $current_question, time()+60*60*24*365, '/');
31
+            setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
32 32
         } elseif (isset($_COOKIE['survey'])) {
33 33
             $show_survey_qn = $_COOKIE['survey'];
34 34
         }
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 
39 39
             $page_url = '';
40 40
             $hide_url = '';
41
-            if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) {
41
+            if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) {
42 42
                 global $MEMBER;
43
-                if ( $MEMBER ) {
44
-                    $page_url = $MEMBER->url(true) . "?answered_survey=$current_question";
45
-                    $hide_url = $MEMBER->url() . "?hide_survey=$current_question";
43
+                if ($MEMBER) {
44
+                    $page_url = $MEMBER->url(true)."?answered_survey=$current_question";
45
+                    $hide_url = $MEMBER->url()."?hide_survey=$current_question";
46 46
                 }
47 47
             } else {
48 48
                 $URL = new Url($this_page);
49
-                $URL->insert(array('answered_survey' => $current_question ));
50
-                $page_url = 'https://' . DOMAIN . $URL->generate();
49
+                $URL->insert(array('answered_survey' => $current_question));
50
+                $page_url = 'https://'.DOMAIN.$URL->generate();
51 51
                 $URL = new Url($this_page);
52
-                $URL->insert(array('hide_survey' => $current_question ));
52
+                $URL->insert(array('hide_survey' => $current_question));
53 53
                 $hide_url = $URL->generate();
54 54
             }
55 55
 
Please login to merge, or discard this patch.
classes/Topic.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     function sctitle() {
55 55
         $title = $this->title;
56
-        if (strpos($title, 'The ') === 0 ) {
56
+        if (strpos($title, 'The ') === 0) {
57 57
             $title = lcfirst($title);
58 58
         }
59 59
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     function url() {
76 76
         $url = new Url('topic');
77
-        return $url->generate() . $this->slug;
77
+        return $url->generate().$this->slug;
78 78
     }
79 79
 
80 80
     function image() {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     function image_url() {
85
-        return "/topic/image.php?id=" . $this->slug();
85
+        return "/topic/image.php?id=".$this->slug();
86 86
     }
87 87
 
88 88
     function image_path() {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             );
243 243
         } else {
244 244
             foreach ($sets as $set) {
245
-                if ($set == '' ) {
245
+                if ($set == '') {
246 246
                     continue;
247 247
                 }
248 248
                 $q = $this->db->query(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             );
286 286
         } else {
287 287
             foreach ($policies as $policy) {
288
-                if ($policy == '' ) {
288
+                if ($policy == '') {
289 289
                     continue;
290 290
                 }
291 291
                 $q = $this->db->query(
Please login to merge, or discard this patch.
classes/Renderer.php 1 patch
Spacing   +8 added lines, -8 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
 
@@ -84,25 +84,25 @@  discard block
 block discarded – undo
84 84
         // Require the templates and output
85 85
 
86 86
         if ($template_only) {
87
-          require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
87
+          require_once INCLUDESPATH.'easyparliament/templates/html/'.$template.'.php';
88 88
         } else {
89 89
           header('Content-Type: text/html; charset=utf-8');
90
-          require_once INCLUDESPATH . 'easyparliament/templates/html/header.php';
91
-          require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
92
-          require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php';
90
+          require_once INCLUDESPATH.'easyparliament/templates/html/header.php';
91
+          require_once INCLUDESPATH.'easyparliament/templates/html/'.$template.'.php';
92
+          require_once INCLUDESPATH.'easyparliament/templates/html/footer.php';
93 93
         }
94 94
     }
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/Homepage.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
         $gid = $featured->get_gid();
58 58
         $gidCheck = new Gid($gid);
59 59
         $gid = $gidCheck->checkForRedirect();
60
-        if ( $gid ) {
60
+        if ($gid) {
61 61
             $title = $featured->get_title();
62 62
             $context = $featured->get_context();
63 63
             $related = $featured->get_related();
64 64
             $item = $this->getFeaturedDebate($gid, $title, $context, $related);
65 65
         } else {
66 66
             $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none');
67
-            if ( isset($item['data']) && count($item['data']) ) {
67
+            if (isset($item['data']) && count($item['data'])) {
68 68
                 $item = $item['data'][0];
69 69
                 $more_url = new Url('debates');
70 70
                 $item['more_url'] = $more_url->generate();
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
         $item['featured'] = true;
96 96
 
97 97
         $related_debates = array();
98
-        foreach ( $related as $related_gid ) {
99
-            if ( $related_gid ) {
98
+        foreach ($related as $related_gid) {
99
+            if ($related_gid) {
100 100
                 $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none');
101 101
                 $related_debates[] = $related_item['data'];
102 102
             }
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
 
122 122
         $recent_content = array();
123 123
 
124
-        foreach ( $this->recent_types as $class => $recent ) {
124
+        foreach ($this->recent_types as $class => $recent) {
125 125
             $class = "\\$class";
126 126
             $instance = new $class();
127 127
             $more_url = new Url($recent[1]);
128
-            if ( $recent[0] == 'recent_pbc_debates' ) {
129
-                $content = array( 'data' => $instance->display($recent[0], array('num' => 5), 'none') );
128
+            if ($recent[0] == 'recent_pbc_debates') {
129
+                $content = array('data' => $instance->display($recent[0], array('num' => 5), 'none'));
130 130
             } else {
131 131
                 $content = $instance->display($recent[0], array('days' => 7, 'num' => 1), 'none');
132
-                if ( isset($content['data']) && count($content['data']) ) {
132
+                if (isset($content['data']) && count($content['data'])) {
133 133
                     $content = $content['data'][0];
134 134
                 } else {
135 135
                     $content = array();
136 136
                 }
137 137
             }
138
-            if ( $content ) {
138
+            if ($content) {
139 139
                 $content['more_url'] = $more_url->generate();
140 140
                 $content['desc'] = $recent[2];
141 141
                 $recent_content[] = $content;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             WHERE event_date >= :date
155 155
             AND deleted = 0
156 156
             ORDER BY event_date, chamber, pos",
157
-            array( ':date' => $date )
157
+            array(':date' => $date)
158 158
         );
159 159
 
160 160
         if (!$q->rows()) {
Please login to merge, or discard this patch.
classes/Utility/Hansard.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         $parts = parse_url($url);
16 16
         parse_str($parts['query'], $query);
17 17
 
18
-        if ( $query['id'] ) {
18
+        if ($query['id']) {
19 19
             if (strpos($parts['path'], 'lords') !== false) {
20 20
                 $gid = 'uk.org.publicwhip/lords/';
21 21
             } elseif (strpos($parts['path'], 'whall') !== false) {
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
     public static function gid_to_url($gid) {
33
-        if ( !$gid ) {
33
+        if (!$gid) {
34 34
             return '';
35 35
         }
36 36
         global $hansardmajors;
37 37
         $db = new \ParlDB();
38 38
 
39
-        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ));
39
+        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid));
40 40
         $url_gid = fix_gid_from_db($gid);
41 41
         $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q->field(0, 'major')]['page']);
42 42
         $url->insert(array('id' => $url_gid));
Please login to merge, or discard this patch.
classes/Renderer/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $edittext   = $menudata['text'];
50 50
         $edittitle  = $menudata['title'];
51 51
         $EDITURL    = new \MySociety\TheyWorkForYou\Url('userviewself');
52
-        if ($this->page == 'userviewself' || $this->page == 'useredit' ) {
52
+        if ($this->page == 'userviewself' || $this->page == 'useredit') {
53 53
             $editclass = 'on';
54 54
         } else {
55 55
             $editclass = '';
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // The 'Log out' link.
59 59
         $menudata   = $this->pagedata->page_metadata('userlogout', 'menu');
60 60
         $logouttext = $menudata['text'];
61
-        $logouttitle= $menudata['title'];
61
+        $logouttitle = $menudata['title'];
62 62
 
63 63
         $LOGOUTURL  = new \MySociety\TheyWorkForYou\Url('userlogout');
64 64
         if ($this->page != 'userlogout') {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $logoutclass = 'on';
69 69
         }
70 70
 
71
-        $username = $this->user->firstname() . ' ' . $this->user->lastname();
71
+        $username = $this->user->firstname().' '.$this->user->lastname();
72 72
 
73 73
         $this->data['user_nav_links'][] = array(
74 74
             'href'    => $LOGOUTURL->generate(),
Please login to merge, or discard this patch.
classes/SectionView/SectionView.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $this->major_data = $hansardmajors[$this->major];
17 17
         $this->page_base = str_replace('year', '', $this->major_data['page_year']);
18 18
         if (!$this->list) {
19
-            $this->class = "\\" . $this->class;
19
+            $this->class = "\\".$this->class;
20 20
             $this->list = new $this->class();
21 21
         }
22 22
     }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             $data = $this->addCommonData($data);
33 33
         } elseif ($date = get_http_var('d')) {
34 34
             $data = $this->display_day($date);
35
-            if ( !isset($data['template']) ) {
35
+            if (!isset($data['template'])) {
36 36
                 $data['template'] = 'section/day';
37 37
             }
38 38
             $data = $this->addCommonData($data);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $data = $this->display_section_or_speech();
41 41
         } else {
42 42
             $data = $this->display_front();
43
-            if ( !isset($data['template']) ) {
43
+            if (!isset($data['template'])) {
44 44
                 $data['template'] = 'section/recent';
45 45
             }
46 46
             $data['search_sections'] = $this->getSearchSections();
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
         $data['recess_major'] = $this->getRecessMajor($data);
60 60
 
61 61
         $nextprev = $DATA->page_metadata($this_page, 'nextprev');
62
-        if ( isset($nextprev['next']['url']) ) {
62
+        if (isset($nextprev['next']['url'])) {
63 63
             $data['next'] = $nextprev['next'];
64 64
         }
65
-        if ( isset($nextprev['prev']['url']) ) {
65
+        if (isset($nextprev['prev']['url'])) {
66 66
             $data['prev'] = $nextprev['prev'];
67 67
         }
68 68
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         if (!isset($data['title']) && $parent_page != '') {
72 72
             $data['title'] = $DATA->page_metadata($parent_page, 'title');
73 73
         }
74
-        if ( $parent_page ) {
74
+        if ($parent_page) {
75 75
             $data['parent_title'] = $DATA->page_metadata($parent_page, 'title');
76 76
         }
77 77
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         $urls = array_merge($urls, $this->getViewUrls());
89 89
 
90
-        if ( isset($data['info']['page']) ) {
90
+        if (isset($data['info']['page'])) {
91 91
             $day = new \MySociety\TheyWorkForYou\Url($data['info']['page']);
92 92
             $urls['day'] = $day;
93 93
         }
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 
129 129
     protected function display_year($year) {
130 130
         global $this_page, $PAGE, $DATA;
131
-        $this_page = $this->page_base . 'year';
131
+        $this_page = $this->page_base.'year';
132 132
         if (is_numeric($year)) {
133 133
             $DATA->set_page_metadata($this_page, 'title', $year);
134 134
         }
135 135
 
136
-        $args = array ( 'year' => $year );
136
+        $args = array('year' => $year);
137 137
         $data = $this->list->display('calendar', $args, 'none');
138 138
         return $data;
139 139
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     protected function display_column($date, $column) {
142 142
         global $this_page;
143 143
         $this_page = $this->page_base;
144
-        $args = array( 'date' => $date, 'column' => $column );
144
+        $args = array('date' => $date, 'column' => $column);
145 145
         $content = $this->list->display('column', $args, 'none');
146 146
 
147 147
         $data = array();
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 
166 166
     protected function display_day($date) {
167 167
         global $this_page;
168
-        $this_page = $this->page_base . 'day';
169
-        $args = array ( 'date' => get_http_var('d') );
168
+        $this_page = $this->page_base.'day';
169
+        $args = array('date' => get_http_var('d'));
170 170
         $data = $this->list->display('date', $args, 'none');
171 171
         list($year, $month, $day) = explode('-', $date);
172
-        $args = array( 'year' => $year, 'month' => $month, 'day' => $day);
172
+        $args = array('year' => $year, 'month' => $month, 'day' => $day);
173 173
         $calendar = $this->list->display('calendar', $args, 'none');
174
-        if ( isset($calendar['years']) ) {
174
+        if (isset($calendar['years'])) {
175 175
             $data['calendar'] = $calendar['years'];
176 176
         }
177 177
         return $data;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         global $DATA, $this_page, $THEUSER;
182 182
 
183 183
         # += as we *don't* want to override any already supplied argument
184
-        $args += array (
184
+        $args += array(
185 185
             'gid' => get_http_var('id'),
186 186
             's' => get_http_var('s'), // Search terms to be highlighted.
187 187
             'member_id' => get_http_var('m'), // Member's speeches to be highlighted.
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
             if ($this->major == 6) {
199 199
                 # Magically (as in I can't remember quite why), pbc_clause will
200 200
                 # contain the new URL without any change...
201
-                $URL->remove( array('id') );
201
+                $URL->remove(array('id'));
202 202
             } else {
203
-                $URL->insert( array('id'=>$e->getMessage()) );
203
+                $URL->insert(array('id'=>$e->getMessage()));
204 204
             }
205 205
             # put the search term back in so highlighting works.
206 206
             # NB: as we don't see the # part of the URL we lose this :(
207
-            if ( $args['s'] !== '' ) {
208
-                $URL->insert( array('s'=>$args['s']) );
207
+            if ($args['s'] !== '') {
208
+                $URL->insert(array('s'=>$args['s']));
209 209
             }
210 210
             redirect($URL->generate('none'));
211 211
         }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         if (array_key_exists('text_heading', $data['info'])) {
274 274
             // avoid having Clause 1 etc as the alert text search string on PBC pages as it's
275 275
             // almost certainly not what the person wants
276
-            if ( $this->major == 6 ) {
276
+            if ($this->major == 6) {
277 277
                 $data['email_alert_text'] = $data['section_title'];
278 278
             } else {
279 279
                 $data['email_alert_text'] = $data['info']['text_heading'];
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             $body = preg_replace('#<phrase class="honfriend" id="uk.org.publicwhip/member/(\d+)" name="([^"]*?)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?m=$1" title="Our page on $2 - \'$3\'">$4</a>', $body);
321 321
             $body = preg_replace('#<phrase class="honfriend" name="([^"]*?)" person_id="uk.org.publicwhip/person/(\d+)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?p=$2" title="Our page on $1 - \'$3\'">$4</a>', $body);
322 322
             $body = preg_replace_callback('#<phrase class="offrep" id="(.*?)/(\d+)-(\d+)-(\d+)\.(.*?)">(.*?)</phrase>#', function($matches) {
323
-                return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] .'">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>';
323
+                return '<a href="/search/?pop=1&s=date:'.$matches[2].$matches[3].$matches[4].'+column:'.$matches[5].'+section:'.$matches[1].'">'.str_replace("Official Report", "Hansard", $matches[6]).'</a>';
324 324
             }, $body);
325 325
             #$body = preg_replace('#<phrase class="offrep" id="((.*?)/(\d+)-(\d+)-(\d+)\.(.*?))">(.*?)</phrase>#e', "\"<a href='/search/?pop=1&amp;s=date:$3$4$5+column:$6+section:$2&amp;match=$1'>\" . str_replace('Official Report', 'Hansard', '$7') . '</a>'", $body);
326 326
             $bodies[] = $body;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         $first_speech = null;
353 353
         $data['section_title'] = '';
354 354
         $subsection_title = '';
355
-        for ($i=0; $i<count($data['rows']); $i++) {
355
+        for ($i = 0; $i < count($data['rows']); $i++) {
356 356
             $row = $data['rows'][$i];
357 357
             $htype = $row['htype'];
358 358
             // HPOS should be defined below if it's needed; otherwise default to 0
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                 # Voting links
376 376
                 $data['rows'][$i]['voting_data'] = '';
377 377
                 if (isset($row['votes'])) {
378
-                    $data['rows'][$i]['voting_data'] = $this->generate_votes( $row['votes'], $row['epobject_id'], $row['gid'] );
378
+                    $data['rows'][$i]['voting_data'] = $this->generate_votes($row['votes'], $row['epobject_id'], $row['gid']);
379 379
                 }
380 380
 
381 381
                 # Annotation link
@@ -398,47 +398,47 @@  discard block
 block discarded – undo
398 398
 
399 399
     private function getCountryDetails() {
400 400
         $details = array(
401
-            1 => array (
401
+            1 => array(
402 402
                 'country' => 'UK',
403 403
                 'assembly' => 'uk-commons',
404 404
                 'location' => '&ndash; in the House of Commons'
405 405
             ),
406
-            2 => array (
406
+            2 => array(
407 407
                 'country' => 'UK',
408 408
                 'assembly' => 'uk-commons',
409 409
                 'location' => '&ndash; in Westminster Hall'
410 410
             ),
411
-            3 => array (
411
+            3 => array(
412 412
                 'country' => 'UK',
413 413
                 'assembly' => 'uk-commons',
414 414
                 'location' => 'written question &ndash; answered'
415 415
             ),
416
-            4 => array (
416
+            4 => array(
417 417
                 'country' => 'UK',
418 418
                 'assembly' => 'uk-commons',
419 419
                 'location' => 'written statement &ndash; made'
420 420
             ),
421
-            5 => array (
421
+            5 => array(
422 422
                 'country' => 'NORTHERN IRELAND',
423 423
                 'assembly' => 'ni',
424 424
                 'location' => '&ndash; in the Northern Ireland Assembly'
425 425
             ),
426
-            6 => array (
426
+            6 => array(
427 427
                 'country' => 'UK',
428 428
                 'assembly' => 'uk-commons',
429 429
                 'location' => '&ndash; in a Public Bill Committee'
430 430
             ),
431
-            7 => array (
431
+            7 => array(
432 432
                 'country' => 'SCOTLAND',
433 433
                 'assembly' => 'scotland',
434 434
                 'location' => '&ndash; in the Scottish Parliament'
435 435
             ),
436
-            8 => array (
436
+            8 => array(
437 437
                 'country' => 'SCOTLAND',
438 438
                 'assembly' => 'scotland',
439 439
                 'location' => '&ndash; Scottish Parliament written question &ndash; answered'
440 440
             ),
441
-            101 => array (
441
+            101 => array(
442 442
                 'country' => 'UK',
443 443
                 'assembly' => 'uk-lords',
444 444
                 'location' => '&ndash; in the House of Lords'
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 
452 452
     protected function display_front() {
453 453
         global $DATA, $this_page;
454
-        $this_page = $this->page_base . 'front';
454
+        $this_page = $this->page_base.'front';
455 455
         $data = array();
456
-        if ( $this->index_template ) {
456
+        if ($this->index_template) {
457 457
             $data['template'] = $this->index_template;
458 458
         }
459 459
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
         $content['calendar'] = $class->display('calendar', array('months' => 1), 'none');
465 465
 
466
-        if ( $rssurl = $DATA->page_metadata($this_page, 'rss') ) {
466
+        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
467 467
             $content['rssurl'] = $rssurl;
468 468
         }
469 469
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
 
480 480
     //$totalcomments, $comment, $commenturl
481
-    function generate_commentteaser ($row) {
481
+    function generate_commentteaser($row) {
482 482
         // Returns HTML for the one fragment of comment and link for the sidebar.
483 483
         // $totalcomments is the number of comments this item has on it.
484 484
         // $comment is an array like:
Please login to merge, or discard this patch.