Completed
Push — master ( a4bf3a...585786 )
by Sam
08:59 queued 03:28
created
www/docs/user/login/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 if (get_http_var("submitted") == "true") {
20 20
     // Form has been submitted, so check input.
21 21
 
22
-    $email 		= get_http_var("email");
22
+    $email = get_http_var("email");
23 23
     $password 	= get_http_var("password");
24 24
     $remember 	= get_http_var("remember");
25 25
 
26 26
     // The user may have tried to do something that requires being logged in.
27 27
     // In which case we should arrive here with that page's URL in 'ret'.
28 28
     // We can then send the user there after log in.
29
-    $returnurl 	= get_http_var("ret");
29
+    $returnurl = get_http_var("ret");
30 30
 
31 31
     $errors = array();
32 32
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             if ($remember == "true") {
54 54
                 $expire = "never";
55 55
             } else {
56
-                $expire ="session";
56
+                $expire = "session";
57 57
             }
58 58
 
59 59
             // $returnurl is the url of where we'll send the user after login.
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 }
97 97
 
98 98
 
99
-function display_page( $errors=array() ) {
99
+function display_page($errors = array()) {
100 100
     global $PAGE, $this_page, $THEUSER;
101 101
 
102 102
     $PAGE->page_start();
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     <?php
128 128
 
129 129
         $PAGE->stripe_end(array(
130
-            array (
130
+            array(
131 131
                 'type' => 'include',
132 132
                 'content' => 'userlogin'
133 133
             )
Please login to merge, or discard this patch.
tests/TWFY_Database_TestCase.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function tearDown()
27 27
     {
28
-        $this->db = NULL;
28
+        $this->db = null;
29 29
 
30 30
         parent::tearDown();
31 31
     }
Please login to merge, or discard this patch.
www/includes/easyparliament/page.php 2 patches
Braces   +15 added lines, -13 removed lines patch added patch discarded remove patch
@@ -114,7 +114,10 @@  discard block
 block discarded – undo
114 114
         //  'foot' - For the bottom stripe on hansard debates/wrans listings.
115 115
         // $id is the value of an id for this div (if blank, not used).
116 116
         ?>
117
-        <div class="stripe-<?php echo $type; ?><?php if ($extra_class != '') echo ' ' . $extra_class; ?>"<?php
117
+        <div class="stripe-<?php echo $type; ?><?php if ($extra_class != '') {
118
+    echo ' ' . $extra_class;
119
+}
120
+?>"<?php
118 121
         if ($id != '') {
119 122
             print ' id="' . $id . '"';
120 123
         }
@@ -479,7 +482,9 @@  discard block
 block discarded – undo
479 482
 
480 483
         global $DATA, $this_page;
481 484
 
482
-        if ($this->page_started()) return;
485
+        if ($this->page_started()) {
486
+            return;
487
+        }
483 488
         // The page's HTML hasn't been started yet, so we'd better do it.
484 489
 
485 490
         // Set the page title (in the <title></title>).
@@ -629,7 +634,9 @@  discard block
 block discarded – undo
629 634
             $URL->insert(array('adv' => 1));
630 635
                 echo '&nbsp;&nbsp; <a href="' . $URL->generate() . '">More&nbsp;options</a>';
631 636
                 echo '<br>';
632
-                if ($wtt) print '<input type="hidden" name="wtt" value="1">';
637
+                if ($wtt) {
638
+                    print '<input type="hidden" name="wtt" value="1">';
639
+                }
633 640
         } else { ?>
634 641
     <form action="http://www.writetothem.com/lords" method="get">
635 642
     <input type="hidden" name="pid" value="<?=_htmlentities(get_http_var('pid')) ?>">
@@ -743,8 +750,7 @@  discard block
 block discarded – undo
743 750
             // The return url for after the user has logged in.
744 751
             if (get_http_var("ret") != "") {
745 752
                 $returl = get_http_var("ret");
746
-            }
747
-            else {
753
+            } else {
748 754
                 $returl = $glossary_returl;
749 755
             }
750 756
             ?>
@@ -808,15 +814,13 @@  discard block
 block discarded – undo
808 814
                 else {
809 815
                     $letters[] = "<li class=\"on\">" . $letter . "</li>";
810 816
                 }
811
-            }
812
-            elseif (!empty($GLOSSARY->alphabet[$letter])) {
817
+            } elseif (!empty($GLOSSARY->alphabet[$letter])) {
813 818
                 $URL = new \MySociety\TheyWorkForYou\Url('glossary');
814 819
                 $URL->insert(array('az' => $letter));
815 820
                 $letter_link = $URL->generate('url');
816 821
 
817 822
                 $letters[] = "<li><a href=\"" . $letter_link . "\">" . $letter . "</a></li>";
818
-            }
819
-            else {
823
+            } else {
820 824
                 $letters[] = '<li>' . $letter . '</li>';
821 825
             }
822 826
         }
@@ -856,8 +860,7 @@  discard block
 block discarded – undo
856 860
             $URL->insert(array("delete_confirm" => $term['glossary_id']));
857 861
             $delete_url = $URL->generate();
858 862
             $admin_links = "<br><small><a href=\"".$delete_url."\">delete</a></small>";
859
-        }
860
-        else {
863
+        } else {
861 864
             $admin_links = "";
862 865
         }
863 866
 
@@ -867,8 +870,7 @@  discard block
 block discarded – undo
867 870
             $user_link = $URL->generate('url');
868 871
 
869 872
             $user_details = "\t\t\t\t<p><small>contributed by user <a href=\"" . $user_link . "\">" . $term['firstname'] . " " . $term['lastname'] . "</a></small>" . $admin_links . "</p>\n";
870
-        }
871
-        else {
873
+        } else {
872 874
             $user_details = "";
873 875
         }
874 876
 
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public $within_stripe_sidebar = false;
20 20
 
21 21
     public function page_start() {
22
-        if ( !$this->page_started() ) {
22
+        if (!$this->page_started()) {
23 23
             $this->checkForAdmin();
24 24
             $this->displayHeader();
25 25
         }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
         $data = $h->data;
34 34
         $data = array_merge($u->data, $data);
35
-        if ( isset($page_errors) ) {
35
+        if (isset($page_errors)) {
36 36
             $data['page_errors'] = $page_errors;
37 37
         }
38 38
         $data['banner_text'] = '';
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 $THISPAGE = new \MySociety\TheyWorkForYou\Url($this_page);
53 53
 
54 54
                 $LOGINURL = new \MySociety\TheyWorkForYou\Url('userlogin');
55
-                $LOGINURL->insert(array('ret' => $THISPAGE->generate('none') ));
55
+                $LOGINURL->insert(array('ret' => $THISPAGE->generate('none')));
56 56
 
57 57
                 $text = "<a href=\"" . $LOGINURL->generate() . "\">You'd better sign in!</a>";
58 58
             } else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 
69 69
     public function page_end() {
70
-        if ( !$this->page_started() ) {
70
+        if (!$this->page_started()) {
71 71
             $this->page_start();
72 72
         }
73 73
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
     }
103 103
 
104
-    public function stripe_start($type='side', $id='', $extra_class = '') {
104
+    public function stripe_start($type = 'side', $id = '', $extra_class = '') {
105 105
         // $type is one of:
106 106
         //  'full' - a full width div
107 107
         //  'side' - a white stripe with a coloured sidebar.
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     }
132 132
 
133 133
 
134
-    public function stripe_end ($contents = array(), $extra = '') {
134
+    public function stripe_end($contents = array(), $extra = '') {
135 135
         // $contents is an array containing 0 or more hashes.
136 136
         // Each hash has two values, 'type' and 'content'.
137 137
         // 'Type' could be one of these:
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     public function include_sidebar_template($sidebarname) {
235 235
         global $this_page, $DATA;
236 236
 
237
-            $sidebarpath = INCLUDESPATH.'easyparliament/sidebars/'.$sidebarname.'.php';
237
+            $sidebarpath = INCLUDESPATH . 'easyparliament/sidebars/' . $sidebarname . '.php';
238 238
 
239 239
             if (file_exists($sidebarpath)) {
240 240
                 include $sidebarpath;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     }
243 243
 
244 244
 
245
-    public function block_start($data=array()) {
245
+    public function block_start($data = array()) {
246 246
         // Starts a 'block' div, used mostly on the home page,
247 247
         // on the MP page, and in the sidebars.
248 248
         // $data is a hash like this:
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         if (is_string($message)) {
390 390
             // Sometimes we're just sending a single line to this function
391 391
             // rather like the bigger array...
392
-            $message = array (
392
+            $message = array(
393 393
                 'text' => $message
394 394
             );
395 395
         }
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
         // if the page has started then we're most likely in an old school page
398 398
         // so we should just print out the error, otherwise stick it in the error
399 399
         // global which will then be displayed by the header template
400
-        if ( $this->page_started() ) {
400
+        if ($this->page_started()) {
401 401
             $this->message($message, 'error');
402 402
         } else {
403
-            if ( !isset($page_errors) ) {
403
+            if (!isset($page_errors)) {
404 404
                 $page_errors = array();
405 405
             }
406
-            $page_errors[]  = $message;
406
+            $page_errors[] = $message;
407 407
         }
408 408
 
409 409
         if ($fatal) {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     }
421 421
 
422 422
 
423
-    public function message($message, $class='') {
423
+    public function message($message, $class = '') {
424 424
         // Generates a very simple but common page content.
425 425
         // Used for when a user logs out, or votes, or any simple thing
426 426
         // where there's a little message and probably a link elsewhere.
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
             if ($page_title != '') {
499 499
                 $page_title .= ': ';
500 500
             }
501
-            $page_title .= format_date ($info['date'], SHORTDATEFORMAT);
501
+            $page_title .= format_date($info['date'], SHORTDATEFORMAT);
502 502
         }
503 503
 
504 504
         if ($page_title != '') {
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
         if (isset($nextprev['up'])) {
555 555
 
556
-            $uplink = '<span class="up"><a href="' .  $nextprev['up']['url'] . '" title="' . $nextprev['up']['title'] . '">' . $nextprev['up']['body'] . '</a>';
556
+            $uplink = '<span class="up"><a href="' . $nextprev['up']['url'] . '" title="' . $nextprev['up']['title'] . '">' . $nextprev['up']['body'] . '</a>';
557 557
             if (get_http_var('s')) {
558 558
                 $URL = new \MySociety\TheyWorkForYou\Url($this_page);
559 559
                 $uplink .= '<br><a href="' . $URL->generate() . '">Remove highlighting</a>';
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
             $next = $nextprev['next'];
569 569
 
570 570
             if (isset($next['url'])) {
571
-                $nextlink = '<a href="' .  $next['url'] . '" title="' . $next['title'] . '" class="linkbutton">' . $next['body'] . ' &raquo;</a>';
571
+                $nextlink = '<a href="' . $next['url'] . '" title="' . $next['title'] . '" class="linkbutton">' . $next['body'] . ' &raquo;</a>';
572 572
             } else {
573 573
                 $nextlink = $next['body'] . ' &raquo;';
574 574
             }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     }
586 586
 
587 587
 
588
-    public function search_form($value='') {
588
+    public function search_form($value = '') {
589 589
         global $SEARCHENGINE;
590 590
         // Search box on the search page.
591 591
         // If $value is set then it will be displayed in the form.
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
             }
616 616
 
617 617
         echo '<div class="mainsearchbox">';
618
-        if ($wtt<2) {
618
+        if ($wtt < 2) {
619 619
                 echo '<form action="', $URL->generate(), '" method="get">';
620 620
                 if (get_http_var('o')) {
621 621
                     echo '<input type="hidden" name="o" value="', _htmlentities(get_http_var('o')), '">';
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
                     echo '<input type="hidden" name="house" value="', _htmlentities(get_http_var('house')), '">';
625 625
                 }
626 626
                 echo '<input type="text" name="q" value="', _htmlentities($value), '" size="50"> ';
627
-                echo '<input type="submit" value=" ', ($wtt?'Modify search':'Search'), ' ">';
627
+                echo '<input type="submit" value=" ', ($wtt ? 'Modify search' : 'Search'), ' ">';
628 628
                 $URL = new \MySociety\TheyWorkForYou\Url('search');
629 629
             $URL->insert(array('adv' => 1));
630 630
                 echo '&nbsp;&nbsp; <a href="' . $URL->generate() . '">More&nbsp;options</a>';
@@ -646,16 +646,16 @@  discard block
 block discarded – undo
646 646
                     $ordering = 'd';
647 647
                 }
648 648
 
649
-                if ($ordering=='r') {
649
+                if ($ordering == 'r') {
650 650
                 print '<strong>Sorted by relevance</strong>';
651 651
                 } else {
652 652
                 printf("<a href='%s'>Sort by relevance</a>", $orderUrl->generate('html', array('o'=>'r')));
653 653
                 }
654 654
 
655 655
                 print "&nbsp;|&nbsp;";
656
-                if ($ordering=='d') {
656
+                if ($ordering == 'd') {
657 657
                 print '<strong>Sorted by date: newest</strong> / <a href="' . $orderUrl->generate('html', array('o'=>'o')) . '">oldest</a>';
658
-                } elseif ($ordering=='o') {
658
+                } elseif ($ordering == 'o') {
659 659
                 print '<strong>Sorted by date:</strong> <a href="' . $orderUrl->generate('html', array('o'=>'d')) . '">newest</a> / <strong>oldest</strong>';
660 660
                 } else {
661 661
                 printf("Sort by date: <a href='%s'>newest</a> / <a href='%s'>oldest</a>",
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
                 }
664 664
 
665 665
             print "&nbsp;|&nbsp;";
666
-            if ($ordering=='p') {
666
+            if ($ordering == 'p') {
667 667
                 print '<strong>Use by person</strong>';
668 668
             } else {
669 669
                 printf('<a href="%s">Show use by person</a>', $orderUrl->generate('html', array('o'=>'p')));
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
         echo '</form> </div>';
684 684
     }
685 685
 
686
-    public function login_form ($errors = array()) {
686
+    public function login_form($errors = array()) {
687 687
         // Used for /user/login/ and /user/prompt/
688 688
         // $errors is a hash of potential errors from a previous log in attempt.
689 689
         ?>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
     public function glossary_atoz(&$GLOSSARY) {
788 788
     // Print out a nice list of lettered links to glossary pages
789 789
 
790
-        $letters = array ();
790
+        $letters = array();
791 791
 
792 792
         foreach ($GLOSSARY->alphabet as $letter => $eps) {
793 793
             // if we're writing out the current letter (list or item)
@@ -820,14 +820,14 @@  discard block
 block discarded – undo
820 820
                     <div class="letters">
821 821
                         <ul>
822 822
     <?php
823
-        for ($n=0; $n<13; $n++) {
823
+        for ($n = 0; $n < 13; $n++) {
824 824
             print $letters[$n];
825 825
         }
826 826
         ?>
827 827
                         </ul>
828 828
                         <ul>
829 829
     <?php
830
-        for ($n=13; $n<26; $n++) {
830
+        for ($n = 13; $n < 26; $n++) {
831 831
             print $letters[$n];
832 832
         }
833 833
         ?>
@@ -846,12 +846,12 @@  discard block
 block discarded – undo
846 846
 
847 847
         // add some extra controls for the administrators
848 848
         if ($this_page == "admin_glossary") {
849
-            print "<a id=\"gl".$term['glossary_id']."\"></a>";
849
+            print "<a id=\"gl" . $term['glossary_id'] . "\"></a>";
850 850
             print "<h3>" . $term['title'] . "</h3>";
851 851
             $URL = new \MySociety\TheyWorkForYou\Url('admin_glossary');
852 852
             $URL->insert(array("delete_confirm" => $term['glossary_id']));
853 853
             $delete_url = $URL->generate();
854
-            $admin_links = "<br><small><a href=\"".$delete_url."\">delete</a></small>";
854
+            $admin_links = "<br><small><a href=\"" . $delete_url . "\">delete</a></small>";
855 855
         }
856 856
         else {
857 857
             $admin_links = "";
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
             // Add a direct search link for current glossary item
875 875
             $URL = new \MySociety\TheyWorkForYou\Url('search');
876 876
             // remember to quote the term for phrase matching in search
877
-            $URL->insert(array('s' => '"'.$term['title'].'"'));
877
+            $URL->insert(array('s' => '"' . $term['title'] . '"'));
878 878
             $search_url = $URL->generate();
879
-            printf ("\t\t\t\t<p>Search hansard for \"<a href=\"%s\" title=\"View search results for this glossary item\">%s</a>\"</p>", $search_url, $term['title']);
879
+            printf("\t\t\t\t<p>Search hansard for \"<a href=\"%s\" title=\"View search results for this glossary item\">%s</a>\"</p>", $search_url, $term['title']);
880 880
         }
881 881
     }
882 882
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 
952 952
             // Generate all the page links.
953 953
             $URL = new \MySociety\TheyWorkForYou\Url($this_page);
954
-            $URL->insert( array('wtt' => get_http_var('wtt')) );
954
+            $URL->insert(array('wtt' => get_http_var('wtt')));
955 955
             if (isset($pagedata['s'])) {
956 956
                 # XXX: Should be taken out in *one* place, not here + search_form etc.
957 957
                 $value = $pagedata['s'];
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
                 $body = trim_characters($report['body'], 0, 40);
1091 1091
 
1092
-                $tabledata['rows'][] = array (
1092
+                $tabledata['rows'][] = array(
1093 1093
                     _htmlentities($report['firstname'] . ' ' . $report['lastname']),
1094 1094
                     _htmlentities($body),
1095 1095
                     $report['reported'],
@@ -1120,13 +1120,13 @@  discard block
 block discarded – undo
1120 1120
         // $page is the name of the page the dates should link to.
1121 1121
 
1122 1122
         // Create array containing abbreviations of days of week.
1123
-        $daysOfWeek = array('Mon','Tue','Wed','Thu','Fri','Sat','Sun');
1123
+        $daysOfWeek = array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun');
1124 1124
 
1125 1125
         // What is the first day of the month in question?
1126
-        $firstDayOfMonth = mktime(0,0,0,$month,1,$year);
1126
+        $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year);
1127 1127
 
1128 1128
         // How many days does this month contain?
1129
-        $numberDays = date('t',$firstDayOfMonth);
1129
+        $numberDays = date('t', $firstDayOfMonth);
1130 1130
 
1131 1131
         // Retrieve some information about the first day of the
1132 1132
         // month in question.
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 
1208 1208
             // Is the $currentDay a member of $dateArray? If so,
1209 1209
             // the day should be linked.
1210
-            if (in_array($currentDay,$dateArray)) {
1210
+            if (in_array($currentDay, $dateArray)) {
1211 1211
 
1212 1212
                 $date = sprintf("%04d-%02d-%02d", $year, $month, $currentDay);
1213 1213
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
         // Returns HTML suitable for putting in the sidebar on Admin pages.
1309 1309
         global $this_page, $DATA;
1310 1310
 
1311
-        $pages = array ('admin_home',
1311
+        $pages = array('admin_home',
1312 1312
                 'admin_comments', 'admin_searchlogs', 'admin_popularsearches', 'admin_failedsearches',
1313 1313
                 'alert_stats', 'admin_statistics', 'admin_reportstats',
1314 1314
                 'admin_commentreports', 'admin_glossary', 'admin_glossary_pending', 'admin_badusers',
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/calendar_date.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,13 @@
 block discarded – undo
18 18
 # Content goes here
19 19
 foreach ($data['dates'] as $date => $day_events) {
20 20
     foreach ($order as $i => $chamber) {
21
-        if (!array_key_exists($chamber, $day_events))
22
-            continue;
21
+        if (!array_key_exists($chamber, $day_events)) {
22
+                    continue;
23
+        }
23 24
         $events = $day_events[$chamber];
24
-        if ($plural[$i]) $chamber .= 's';
25
+        if ($plural[$i]) {
26
+            $chamber .= 's';
27
+        }
25 28
         print "<h2 class='calendar'>$chamber";
26 29
         if (in_array($major[$i], $data['majors'])) {
27 30
             $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         print "<h2 class='calendar'>$chamber";
26 26
         if (in_array($major[$i], $data['majors'])) {
27 27
             $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']);
28
-            $URL->insert( array( 'd' => $date ) );
28
+            $URL->insert(array('d' => $date));
29 29
             print ' &nbsp; <a href="' . $URL->generate() . '">See this day &rarr;</a>';
30 30
         }
31 31
         print "</h2>\n";
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/comments_recent.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
     }
19 19
     $PAGE->block_start(array('id'=>'recentcomments', 'title'=>$title));
20 20
 
21
-    if ($this_page != 'home') $PAGE->page_links($data);
21
+    if ($this_page != 'home') {
22
+        $PAGE->page_links($data);
23
+    }
22 24
     $USERURL = new \MySociety\TheyWorkForYou\Url('userview');
23 25
     ?>
24 26
                         <ul>
@@ -50,7 +52,9 @@  discard block
 block discarded – undo
50 52
                         <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
51 53
 <?php
52 54
     }
53
-    if ($this_page != 'home') $PAGE->page_links($data);
55
+    if ($this_page != 'home') {
56
+        $PAGE->page_links($data);
57
+    }
54 58
     $PAGE->block_end();
55 59
 }
56 60
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $date = format_date($date, SHORTDATEFORMAT);
34 34
         $time = format_time($time, TIMEFORMAT);
35 35
 
36
-        $count = $n+1;
36
+        $count = $n + 1;
37 37
 
38 38
         $USERURL->insert(array('u'=>$comment['user_id']));
39 39
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     if ($this_page == 'home') {
48 48
         $MOREURL = new \MySociety\TheyWorkForYou\Url('comments_recent');
49 49
         ?>
50
-                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
50
+                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments']) + 1; ?>">See more annotations posted recently</a></p>
51 51
 <?php
52 52
     }
53 53
     if ($this_page != 'home') $PAGE->page_links($data);
Please login to merge, or discard this patch.
classes/Url.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,8 +156,9 @@
 block discarded – undo
156 156
                 foreach ($var as $v) {
157 157
                     $url_args[] = "$key=" . urlencode(stripslashes($v));
158 158
                 }
159
-            } elseif ($var != null)
160
-                $url_args[] = "$key=" . urlencode(stripslashes($var));
159
+            } elseif ($var != null) {
160
+                            $url_args[] = "$key=" . urlencode(stripslashes($var));
161
+            }
161 162
         }
162 163
 
163 164
         $page_url = WEBPATH . $DATA->page_metadata($this->destinationpage, "url");
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         // These stores an associative array of key/value pairs that
44 44
         // we'll want passed on to other pages.
45
-        $this->session_vars = array ();
45
+        $this->session_vars = array();
46 46
 
47 47
         // Prevent things using $DATA running if it hasn't been set, ie in testing
48 48
         if (isset($DATA)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function reset() {
95 95
         // Call this to remove all the session_vars.
96
-        $this->session_vars = array ();
96
+        $this->session_vars = array();
97 97
     }
98 98
 
99 99
     /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
      *                            override just one or two of them.
163 163
      */
164 164
 
165
-    public function generate($encode = "html", $overrideVars=array()) {
165
+    public function generate($encode = "html", $overrideVars = array()) {
166 166
 
167 167
         global $DATA;
168 168
 
169
-        $url_args = array ();
169
+        $url_args = array();
170 170
 
171 171
         foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) {
172 172
             if (is_array($var)) {
Please login to merge, or discard this patch.
www/docs/mp/index.php 5 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.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 
31 31
 // Disable the old PAGE class.
32
-$new_style_template = TRUE;
32
+$new_style_template = true;
33 33
 
34 34
 // Include all the things this page needs.
35 35
 include_once '../../includes/easyparliament/init.php';
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 // Basic name, title and description
177 177
 $member_name = ucfirst($MEMBER->full_name());
178 178
 $title = $member_name;
179
-$desc = "Read $member_name's contributions to Parliament, including speeches and questions";
179
+$desc = "read $member_name's contributions to Parliament, including speeches and questions";
180 180
 
181 181
 // Enhance description if this is a current member
182 182
 if ($MEMBER->current_member_anywhere())
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 }
221 221
 
222 222
 $known_for = '';
223
-$current_offices_ignoring_committees = $MEMBER->offices('current', TRUE);
223
+$current_offices_ignoring_committees = $MEMBER->offices('current', true);
224 224
 if (count($current_offices_ignoring_committees) > 0) {
225 225
     $known_for = $current_offices_ignoring_committees[0];
226 226
 }
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 $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)));
308 308
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
309 309
 
310
-$data['pre_2010_expenses'] = False;
310
+$data['pre_2010_expenses'] = false;
311 311
 $data['post_2010_expenses'] = $data['leave_date'] > '2010-05-05';
312 312
 
313 313
 if ($data['entry_date'] < '2010-05-05') {
314
-    $data['pre_2010_expenses'] = True;
314
+    $data['pre_2010_expenses'] = true;
315 315
     // Set the expenses URL if we know it
316 316
     if (isset($MEMBER->extra_info['expenses_url'])) {
317 317
         $data['expenses_url_2004'] = $MEMBER->extra_info['expenses_url'];
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
  * Redirect to the canonical page for a member.
678 678
  */
679 679
 
680
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
680
+function member_redirect (&$MEMBER, $code = 301, $pagetype = null) {
681 681
     // We come here after creating a MEMBER object by various methods.
682 682
     // Now we redirect to the canonical MP page, with a person_id.
683 683
     if ($MEMBER->person_id()) {
@@ -1163,8 +1163,8 @@  discard block
 block discarded – undo
1163 1163
     $return = false;
1164 1164
     if (isset($extra_info[$category]))
1165 1165
         $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1166
-    if (isset($extra_info["L$category"]))
1167
-        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1166
+    if (isset($extra_info["l$category"]))
1167
+        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "l$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1168 1168
     return $return;
1169 1169
 }
1170 1170
 
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
     if ($pid) {
119 119
         $URL = new \MySociety\TheyWorkForYou\Url('search');
120
-        $URL->insert( array('pid'=>$pid, 'pop'=>1) );
120
+        $URL->insert(array('pid'=>$pid, 'pop'=>1));
121 121
         header('Location: ' . $URL->generate('none'));
122 122
         exit;
123 123
     }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     } elseif ($THEUSER->postcode_is_set()) {
149 149
         get_mp_by_user_postcode($THEUSER->postcode());
150 150
     } else {
151
-        twfy_debug ('MP', "We don't have any way of telling what MP to display");
151
+        twfy_debug('MP', "We don't have any way of telling what MP to display");
152 152
         throw new MySociety\TheyWorkForYou\MemberException('Sorry, but we can&rsquo;t tell which representative to display.');
153 153
     }
154 154
     if (!isset($MEMBER) || !$MEMBER->valid) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     if (!$MEMBER->current_member(HOUSE_TYPE_SCOTLAND)) {
216 216
         $title .= ', former';
217 217
     }
218
-    $title .= ' MSP, '.$MEMBER->constituency();
218
+    $title .= ' MSP, ' . $MEMBER->constituency();
219 219
 }
220 220
 
221 221
 $known_for = '';
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 $data['eu_stance'] = $MEMBER->getEUStance();
284 284
 
285 285
 # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs
286
-$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) );
286
+$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS));
287 287
 # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs
288 288
 $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)));
289 289
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 
310 310
 $data['this_page'] = $this_page;
311 311
 $data['current_assembly'] = 'westminster';
312
-if ( $this_page == 'msp' || $this_page == 'yourmsp' ) {
312
+if ($this_page == 'msp' || $this_page == 'yourmsp') {
313 313
     $data['current_assembly'] = 'scotland';
314
-} else if ( $this_page == 'mla' || $this_page == 'yourmla' ) {
314
+} else if ($this_page == 'mla' || $this_page == 'yourmla') {
315 315
     $data['current_assembly'] = 'ni';
316 316
 }
317 317
 
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
328 328
         $policySummaries = $divisions->getMemberDivisionDetails();
329 329
 
330
-        $policyOptions = array( 'summaries' => $policySummaries);
330
+        $policyOptions = array('summaries' => $policySummaries);
331 331
 
332 332
         // Generate voting segments
333 333
         $set_descriptions = $policiesList->getSetDescriptions();
334
-        if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) {
334
+        if ($policy_set && array_key_exists($policy_set, $set_descriptions)) {
335 335
             $sets = array($policy_set);
336 336
             $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set;
337 337
             $data['page_title'] = $policiesList->getSetDescriptions()[$policy_set] . ' ' . $title . ' - TheyWorkForYou';
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 
371 371
     case 'divisions':
372 372
         $policyID = get_http_var('policy');
373
-        if ( $policyID ) {
374
-            $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID );
373
+        if ($policyID) {
374
+            $policiesList = new MySociety\TheyWorkForYou\Policies($policyID);
375 375
         } else {
376 376
             $policiesList = new MySociety\TheyWorkForYou\Policies;
377 377
         }
378
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
378
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
379 379
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList);
380 380
 
381
-        if ( $policyID ) {
381
+        if ($policyID) {
382 382
             $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID);
383 383
         } else {
384 384
             $data['policydivisions'] = $divisions->getAllMemberDivisionsByPolicy();
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
         // generate party policy diffs
457 457
         $party = new MySociety\TheyWorkForYou\Party($MEMBER->party());
458
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
458
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
459 459
         $party_positions = $party->getAllPolicyPositions($policiesList);
460 460
         $policy_diffs = $MEMBER->getPartyPolicyDiffs($party, $policiesList, $positions, true);
461 461
 
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
     global $THEUSER;
510 510
     $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
511 511
     if (!validate_postcode($pc)) {
512
-        twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
513
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn&rsquo;t a valid postcode');
512
+        twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
513
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a valid postcode');
514 514
     }
515
-    twfy_debug ('MP', "MP lookup by postcode");
515
+    twfy_debug('MP', "MP lookup by postcode");
516 516
     $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
517 517
     if ($constituency == "connection_timed_out") {
518 518
         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.');
519 519
     } elseif ($constituency == "") {
520
-        twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
521
-        throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn&rsquo;t a known postcode');
520
+        twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
521
+        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a known postcode');
522 522
     } else {
523 523
         // Redirect to the canonical MP page, with a person id.
524 524
         $MEMBER = new MySociety\TheyWorkForYou\Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS));
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
     }
531 531
 }
532 532
 
533
-function get_person_by_name($name, $const='') {
533
+function get_person_by_name($name, $const = '') {
534 534
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const));
535 535
     // Edge case, only attempt further detection if this isn't the Queen.
536 536
     if ($name !== 'elizabeth the second' || $const) {
537
-        twfy_debug ('MP', 'Redirecting for MP found by name/constituency');
537
+        twfy_debug('MP', 'Redirecting for MP found by name/constituency');
538 538
         member_redirect($MEMBER);
539 539
     }
540 540
     return $MEMBER;
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
  * Redirect to the canonical page for a member.
569 569
  */
570 570
 
571
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
571
+function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) {
572 572
     // We come here after creating a MEMBER object by various methods.
573 573
     // Now we redirect to the canonical MP page, with a person_id.
574 574
     if ($MEMBER->person_id()) {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         } else {
586 586
             $pagetype = '';
587 587
         }
588
-        header('Location: ' . $url . $pagetype, true, $code );
588
+        header('Location: ' . $url . $pagetype, true, $code);
589 589
         exit;
590 590
     }
591 591
 }
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 function person_error_page($message) {
615 615
     global $this_page;
616
-    switch($this_page) {
616
+    switch ($this_page) {
617 617
     case 'mla':
618 618
         $rep = 'MLA';
619 619
         $SEARCHURL = '/postcode/';
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
  * Generate the summary of this person's held positions.
652 652
  */
653 653
 
654
-function person_summary_description ($MEMBER) {
654
+function person_summary_description($MEMBER) {
655 655
     $entered_house = $MEMBER->entered_house();
656 656
     $current_member = $MEMBER->current_member();
657 657
     $left_house = $MEMBER->left_house();
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     }
663 663
     $desc = '';
664 664
     foreach ($MEMBER->houses() as $house) {
665
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
665
+        if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
666 666
             continue; # Same info is printed further down
667 667
 
668 668
         if (!$current_member[$house]) $desc .= 'Former ';
@@ -683,17 +683,17 @@  discard block
 block discarded – undo
683 683
                 $desc .= $last['from'] . ' ';
684 684
             }
685 685
         }
686
-        if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
686
+        if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) {
687 687
             $desc .= ' ';
688
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
689
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
690
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
688
+            if ($house == HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
689
+            if ($house == HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
690
+            if ($house == HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
691 691
             if ($party_br) {
692 692
                 $desc .= " ($party_br)";
693 693
             }
694 694
             $desc .= ' for ' . $left_house[$house]['constituency'];
695 695
         }
696
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
696
+        if ($house == HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
697 697
         $desc .= ', ';
698 698
     }
699 699
     $desc = preg_replace('#, $#', '', $desc);
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
  * @return string A HTML summary of this person's rebellion rate.
711 711
  */
712 712
 
713
-function person_rebellion_rate ($member) {
713
+function person_rebellion_rate($member) {
714 714
 
715 715
     // Rebellion string may be empty.
716 716
     $rebellion_string = '';
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     // benefit unfortunately.
749 749
     twfy_debug_timestamp();
750 750
 
751
-    $person_id= $member->person_id();
751
+    $person_id = $member->person_id();
752 752
 
753 753
     $memcache = new MySociety\TheyWorkForYou\Memcache;
754 754
     $recent = $memcache->get('recent_appear:' . $person_id);
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
         $SEARCHENGINE = new \SEARCHENGINE($searchstring);
760 760
 
761 761
         $hansard = new MySociety\TheyWorkForYou\Hansard();
762
-        $args = array (
762
+        $args = array(
763 763
             's' => $searchstring,
764 764
             'p' => 1,
765 765
             'num' => 3,
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
     twfy_debug_timestamp();
775 775
 
776 776
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
777
-    $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) );
777
+    $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1));
778 778
 
779 779
     $out['more_href'] = $MOREURL->generate() . '#n4';
780 780
     $out['more_text'] = 'More of ' . ucfirst($member->full_name()) . '&rsquo;s recent appearances';
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         }
986 986
     }
987 987
 
988
-    foreach ( $wtt_stats_years as $year ) {
988
+    foreach ($wtt_stats_years as $year) {
989 989
         $wtt_displayed = display_writetothem_numbers($year, $extra_info);
990 990
         if ($wtt_displayed) {
991 991
             $out[] = $wtt_displayed;
@@ -1021,15 +1021,15 @@  discard block
 block discarded – undo
1021 1021
         }
1022 1022
     }
1023 1023
 
1024
-    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
1025
-        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
1024
+    if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts'] > 0 || $has_email_alerts)) {
1025
+        $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are') . ' tracking ';
1026 1026
         if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1027 1027
         elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1028 1028
         elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1029 1029
         elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1030 1030
         elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1031 1031
         if ($has_email_alerts) {
1032
-            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1032
+            $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid=' . $member->person_id() . '">email me updates on ' . $member->full_name() . '&rsquo;s activity</a>';
1033 1033
         }
1034 1034
 
1035 1035
         $out[] = $line;
@@ -1059,25 +1059,25 @@  discard block
 block discarded – undo
1059 1059
 }
1060 1060
 
1061 1061
 function display_stats_line_house($house, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff) {
1062
-    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category =='comments_on_speeches' ||
1063
-        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category =='Lcomments_on_speeches') {
1064
-        if ($extra_info[$category]==0) {
1062
+    if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category == 'comments_on_speeches' ||
1063
+        $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category == 'Lcomments_on_speeches') {
1064
+        if ($extra_info[$category] == 0) {
1065 1065
             $blurb = preg_replace('#<a.*?>#', '', $blurb);
1066 1066
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1067 1067
         }
1068 1068
     }
1069
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1069
+    if ($house == HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1070 1070
     $line = $blurb;
1071 1071
     $line .= '<strong>' . $extra_info[$category];
1072 1072
     if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1073 1073
     $line .= '</strong>';
1074 1074
     $line .= $inwhat;
1075
-    if ($minister===2) {
1075
+    if ($minister === 2) {
1076 1076
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1077 1077
     } elseif ($minister)
1078 1078
         $line .= ' &#8212; Ministers do not ask written questions';
1079 1079
     else {
1080
-        $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1080
+        $type = ($house == HOUSE_TYPE_COMMONS ? 'MP' : ($house == HOUSE_TYPE_LORDS ? 'Lord' : 'MLA'));
1081 1081
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1082 1082
             $line .= ' &#8212; ';
1083 1083
             $q = $extra_info[$category . '_quintile'];
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
         if ($a == 'very high') $a = 'a very high';
1123 1123
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1124 1124
 
1125
-        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);
1125
+        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);
1126 1126
     }
1127 1127
 
1128 1128
 }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 function get_all_writetothem_strings($member, $wtt_stats_years) {
1131 1131
     $extra_info = $member->extra_info();
1132 1132
     $strings = array();
1133
-    foreach ( $wtt_stats_years as $year ) {
1133
+    foreach ($wtt_stats_years as $year) {
1134 1134
 
1135 1135
         if (isset($extra_info["writetothem_responsiveness_mean_$year"])) {
1136 1136
             $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         return;
1147 1147
     }
1148 1148
 
1149
-    $reg = array( 'date' => '', 'data' => '<p>Nil</p>' );
1149
+    $reg = array('date' => '', 'data' => '<p>Nil</p>');
1150 1150
     if (isset($extra_info['register_member_interests_date'])) {
1151 1151
         $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
1152 1152
     }
@@ -1218,8 +1218,8 @@  discard block
 block discarded – undo
1218 1218
         }
1219 1219
     }
1220 1220
 
1221
-    foreach($mreg as $reg) {
1222
-        $data['members'][] = array (
1221
+    foreach ($mreg as $reg) {
1222
+        $data['members'][] = array(
1223 1223
             'url' => '/' . $rep_type . '/?p=' . $reg['person_id'],
1224 1224
             'name' => $reg['given_name'] . ' ' . $reg['family_name']
1225 1225
         );
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 // Finally, if this is a Votes page, replace the page description with
228 228
 // something more descriptive of the actual data on the page.
229 229
 if ($pagetype == 'votes') {
230
-  $title = "Voting record - " . $title;
231
-  $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
230
+    $title = "Voting record - " . $title;
231
+    $desc = 'See how ' . $member_name . ' voted on topics like Employment, Social Issues, Foreign Policy, and more.';
232 232
 }
233 233
 
234 234
 // Set page metadata
@@ -1200,11 +1200,11 @@  discard block
 block discarded – undo
1200 1200
 
1201 1201
     // Generate voting segments
1202 1202
     $data['segment'] = array(
1203
-      'key'   => $policy_set,
1204
-      'title' => $policiesList->getSetDescriptions()[$policy_set],
1205
-      'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
1206
-          $policiesList->limitToSet($policy_set), $MEMBER
1207
-      )
1203
+        'key'   => $policy_set,
1204
+        'title' => $policiesList->getSetDescriptions()[$policy_set],
1205
+        'votes' => new MySociety\TheyWorkForYou\PolicyPositions(
1206
+            $policiesList->limitToSet($policy_set), $MEMBER
1207
+        )
1208 1208
     );
1209 1209
 
1210 1210
     if ($format === 'png') {
Please login to merge, or discard this patch.
Braces   +128 added lines, -57 removed lines patch added patch discarded remove patch
@@ -61,16 +61,36 @@  discard block
 block discarded – undo
61 61
 $constituency = strtolower(str_replace('_', ' ', get_http_var('c')));
62 62
 
63 63
 // Fix for names with non-ASCII characters
64
-if ($name == 'sion simon') $name = 'si\xf4n simon';
65
-if ($name == 'sian james') $name = 'si\xe2n james';
66
-if ($name == 'lembit opik') $name = 'lembit \xf6pik';
67
-if ($name == 'bairbre de brun') $name = 'bairbre de br\xfan';
68
-if ($name == 'daithi mckay') $name = 'daith\xed mckay';
69
-if ($name == 'caral ni chuilin') $name = 'car\xe1l n\xed chuil\xedn';
70
-if ($name == 'caledon du pre') $name = 'caledon du pr\xe9';
71
-if ($name == 'sean etchingham') $name = 'se\xe1n etchingham';
72
-if ($name == 'john tinne') $name = 'john tinn\xe9';
73
-if ($name == 'renee short') $name = 'ren\xe9e short';
64
+if ($name == 'sion simon') {
65
+    $name = 'si\xf4n simon';
66
+}
67
+if ($name == 'sian james') {
68
+    $name = 'si\xe2n james';
69
+}
70
+if ($name == 'lembit opik') {
71
+    $name = 'lembit \xf6pik';
72
+}
73
+if ($name == 'bairbre de brun') {
74
+    $name = 'bairbre de br\xfan';
75
+}
76
+if ($name == 'daithi mckay') {
77
+    $name = 'daith\xed mckay';
78
+}
79
+if ($name == 'caral ni chuilin') {
80
+    $name = 'car\xe1l n\xed chuil\xedn';
81
+}
82
+if ($name == 'caledon du pre') {
83
+    $name = 'caledon du pr\xe9';
84
+}
85
+if ($name == 'sean etchingham') {
86
+    $name = 'se\xe1n etchingham';
87
+}
88
+if ($name == 'john tinne') {
89
+    $name = 'john tinn\xe9';
90
+}
91
+if ($name == 'renee short') {
92
+    $name = 'ren\xe9e short';
93
+}
74 94
 
75 95
 // Fix for common misspellings, name changes etc
76 96
 $name_fix = array(
@@ -102,7 +122,9 @@  discard block
 block discarded – undo
102 122
 }
103 123
 
104 124
 // Fixes for Ynys Mon, and a Unicode URL
105
-if ($constituency == 'ynys mon') $constituency = "ynys m\xf4n";
125
+if ($constituency == 'ynys mon') {
126
+    $constituency = "ynys m\xf4n";
127
+}
106 128
 if (preg_match("#^ynys m\xc3\xb4n#i", $constituency)) {
107 129
     $constituency = "ynys m\xf4n";
108 130
 }
@@ -194,8 +216,9 @@  discard block
 block discarded – undo
194 216
 $desc = "Read $member_name's contributions to Parliament, including speeches and questions";
195 217
 
196 218
 // Enhance description if this is a current member
197
-if ($MEMBER->current_member_anywhere())
219
+if ($MEMBER->current_member_anywhere()) {
198 220
     $desc .= ', investigate their voting record, and get email alerts on their activity';
221
+}
199 222
 
200 223
 // Enhance title if this is a member of the Commons
201 224
 if ($MEMBER->house(HOUSE_TYPE_COMMONS)) {
@@ -203,8 +226,10 @@  discard block
 block discarded – undo
203 226
         $title .= ', former';
204 227
     }
205 228
     $title .= ' MP';
206
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
207
-}
229
+    if ($MEMBER->constituency()) {
230
+        $title .= ', ' . $MEMBER->constituency();
231
+    }
232
+    }
208 233
 
209 234
 // Enhance title if this is a member of NIA
210 235
 if ($MEMBER->house(HOUSE_TYPE_NI)) {
@@ -217,8 +242,10 @@  discard block
 block discarded – undo
217 242
         $title .= ', former';
218 243
     }
219 244
     $title .= ' MLA';
220
-    if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency();
221
-}
245
+    if ($MEMBER->constituency()) {
246
+        $title .= ', ' . $MEMBER->constituency();
247
+    }
248
+    }
222 249
 
223 250
 // Enhance title if this is a member of Scottish Parliament
224 251
 if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) {
@@ -253,8 +280,9 @@  discard block
 block discarded – undo
253 280
 
254 281
 // Build the RSS link and add it to page data.
255 282
 $feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf';
256
-if (file_exists(BASEDIR . '/' . $feedurl))
283
+if (file_exists(BASEDIR . '/' . $feedurl)) {
257 284
     $DATA->set_page_metadata($this_page, 'rss', $feedurl);
285
+}
258 286
 
259 287
 // Prepare data for the template
260 288
 $data['full_name'] = $MEMBER->full_name();
@@ -548,11 +576,13 @@  discard block
 block discarded – undo
548 576
         $url = $MEMBER->url();
549 577
         $params = array();
550 578
         foreach ($_GET as $key => $value) {
551
-            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid')
552
-                $params[] = "$key=$value";
579
+            if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') {
580
+                            $params[] = "$key=$value";
581
+            }
582
+        }
583
+        if (count($params)) {
584
+                    $url .= '?' . join('&', $params);
553 585
         }
554
-        if (count($params))
555
-            $url .= '?' . join('&', $params);
556 586
         if ($pagetype) {
557 587
             $pagetype = '/' . $pagetype;
558 588
         } else {
@@ -629,16 +659,21 @@  discard block
 block discarded – undo
629 659
     $current_member = $MEMBER->current_member();
630 660
     $left_house = $MEMBER->left_house();
631 661
 
632
-    if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) { # Royal short-circuit
662
+    if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) {
663
+# Royal short-circuit
633 664
         return '<strong>Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
634 665
             . '<br>Coronated on 2 June 1953</strong></li>';
635 666
     }
636 667
     $desc = '';
637 668
     foreach ($MEMBER->houses() as $house) {
638
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS]))
639
-            continue; # Same info is printed further down
669
+        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) {
670
+                    continue;
671
+        }
672
+        # Same info is printed further down
640 673
 
641
-        if (!$current_member[$house]) $desc .= 'Former ';
674
+        if (!$current_member[$house]) {
675
+            $desc .= 'Former ';
676
+        }
642 677
 
643 678
         $party = $left_house[$house]['party'];
644 679
         $party_br = '';
@@ -646,8 +681,9 @@  discard block
 block discarded – undo
646 681
             $party_br = $m[2];
647 682
             $party = $m[1];
648 683
         }
649
-        if ($party != 'unknown')
650
-            $desc .= _htmlentities($party);
684
+        if ($party != 'unknown') {
685
+                    $desc .= _htmlentities($party);
686
+        }
651 687
         if ($party == 'Speaker' || $party == 'Deputy Speaker') {
652 688
             $desc .= ', and ';
653 689
             # XXX: Might go horribly wrong if something odd happens
@@ -658,15 +694,23 @@  discard block
 block discarded – undo
658 694
         }
659 695
         if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
660 696
             $desc .= ' ';
661
-            if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>';
662
-            if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
663
-            if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
697
+            if ($house==HOUSE_TYPE_COMMONS) {
698
+                $desc .= '<abbr title="Member of Parliament">MP</abbr>';
699
+            }
700
+            if ($house==HOUSE_TYPE_NI) {
701
+                $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>';
702
+            }
703
+            if ($house==HOUSE_TYPE_SCOTLAND) {
704
+                $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>';
705
+            }
664 706
             if ($party_br) {
665 707
                 $desc .= " ($party_br)";
666 708
             }
667 709
             $desc .= ' for ' . $left_house[$house]['constituency'];
668 710
         }
669
-        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer';
711
+        if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') {
712
+            $desc .= ' Peer';
713
+        }
670 714
         $desc .= ', ';
671 715
     }
672 716
     $desc = preg_replace('#, $#', '', $desc);
@@ -928,10 +972,13 @@  discard block
 block discarded – undo
928 972
     # Find latest entered house
929 973
     $entered_house = null;
930 974
     foreach ($member->entered_house() as $h => $eh) {
931
-        if (!$entered_house || $eh['date'] > $entered_house) $entered_house = $eh['date'];
975
+        if (!$entered_house || $eh['date'] > $entered_house) {
976
+            $entered_house = $eh['date'];
977
+        }
978
+    }
979
+    if ($entered_house > $year_ago) {
980
+            $since_text = 'since joining Parliament';
932 981
     }
933
-    if ($entered_house > $year_ago)
934
-        $since_text = 'since joining Parliament';
935 982
 
936 983
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
937 984
     $section = 'section:debates section:whall section:lords section:ni';
@@ -945,10 +992,12 @@  discard block
 block discarded – undo
945 992
         $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1));
946 993
         // We assume that if they've answered a question, they're a minister
947 994
         $minister = 0; $Lminister = false;
948
-        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0)
949
-            $minister = 1;
950
-        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0)
951
-            $Lminister = true;
995
+        if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
996
+                    $minister = 1;
997
+        }
998
+        if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
999
+                    $Lminister = true;
1000
+        }
952 1001
         if ($member->party() == 'Speaker' || $member->party() == 'Deputy Speaker') {
953 1002
             $minister = 2;
954 1003
         }
@@ -996,11 +1045,17 @@  discard block
 block discarded – undo
996 1045
 
997 1046
     if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) {
998 1047
         $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking ';
999
-        if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP';
1000
-        elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer';
1001
-        elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA';
1002
-        elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP';
1003
-        elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name();
1048
+        if ($member->house_disp == HOUSE_TYPE_COMMONS) {
1049
+            $line .= 'this MP';
1050
+        } elseif ($member->house_disp == HOUSE_TYPE_LORDS) {
1051
+            $line .= 'this peer';
1052
+        } elseif ($member->house_disp == HOUSE_TYPE_NI) {
1053
+            $line .= 'this MLA';
1054
+        } elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) {
1055
+            $line .= 'this MSP';
1056
+        } elseif ($member->house_disp == HOUSE_TYPE_ROYAL) {
1057
+            $line .= $member->full_name();
1058
+        }
1004 1059
         if ($has_email_alerts) {
1005 1060
             $line .= ' &mdash; <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '&rsquo;s activity</a>';
1006 1061
         }
@@ -1024,10 +1079,12 @@  discard block
 block discarded – undo
1024 1079
 
1025 1080
 function display_stats_line($category, $blurb, $type, $inwhat, $afterstuff, $extra_info, $minister = false, $Lminister = false) {
1026 1081
     $return = false;
1027
-    if (isset($extra_info[$category]))
1028
-        $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1029
-    if (isset($extra_info["L$category"]))
1030
-        $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1082
+    if (isset($extra_info[$category])) {
1083
+            $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff);
1084
+    }
1085
+    if (isset($extra_info["L$category"])) {
1086
+            $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff);
1087
+    }
1031 1088
     return $return;
1032 1089
 }
1033 1090
 
@@ -1039,17 +1096,21 @@  discard block
 block discarded – undo
1039 1096
             $inwhat = preg_replace('#<\/a>#', '', $inwhat);
1040 1097
         }
1041 1098
     }
1042
-    if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat);
1099
+    if ($house==HOUSE_TYPE_LORDS) {
1100
+        $inwhat = str_replace('MP', 'Lord', $inwhat);
1101
+    }
1043 1102
     $line = $blurb;
1044 1103
     $line .= '<strong>' . $extra_info[$category];
1045
-    if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]);
1104
+    if ($type) {
1105
+        $line .= ' ' . make_plural($type, $extra_info[$category]);
1106
+    }
1046 1107
     $line .= '</strong>';
1047 1108
     $line .= $inwhat;
1048 1109
     if ($minister===2) {
1049 1110
         $line .= ' &#8212; Speakers/ deputy speakers do not ask written questions';
1050
-    } elseif ($minister)
1051
-        $line .= ' &#8212; Ministers do not ask written questions';
1052
-    else {
1111
+    } elseif ($minister) {
1112
+            $line .= ' &#8212; Ministers do not ask written questions';
1113
+    } else {
1053 1114
         $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA'));
1054 1115
         if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) {
1055 1116
             $line .= ' &#8212; ';
@@ -1088,11 +1149,21 @@  discard block
 block discarded – undo
1088 1149
         $mean = $extra_info["writetothem_responsiveness_mean_$year"];
1089 1150
 
1090 1151
         $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"];
1091
-        if ($a == 'very low') $a = 'a very low';
1092
-        if ($a == 'low') $a = 'a low';
1093
-        if ($a == 'medium') $a = 'a medium';
1094
-        if ($a == 'high') $a = 'a high';
1095
-        if ($a == 'very high') $a = 'a very high';
1152
+        if ($a == 'very low') {
1153
+            $a = 'a very low';
1154
+        }
1155
+        if ($a == 'low') {
1156
+            $a = 'a low';
1157
+        }
1158
+        if ($a == 'medium') {
1159
+            $a = 'a medium';
1160
+        }
1161
+        if ($a == 'high') {
1162
+            $a = 'a high';
1163
+        }
1164
+        if ($a == 'very high') {
1165
+            $a = 'a very high';
1166
+        }
1096 1167
         $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a;
1097 1168
 
1098 1169
         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.
classes/SectionView/NiView.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     protected function getSearchSections() {
34 34
         return array(
35
-            array( 'section' => 'ni' )
35
+            array('section' => 'ni')
36 36
         );
37 37
     }
38 38
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
         $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none');
54 54
         $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront');
55
-        $MOREURL->insert( array( 'more' => 1 ) );
55
+        $MOREURL->insert(array('more' => 1));
56 56
 
57 57
         // this makes sure that we don't repeat this debate in the list below
58 58
         $random_debate = NULL;
59
-        if ( isset($debates['data']) && count($debates['data']) ) {
59
+        if (isset($debates['data']) && count($debates['data'])) {
60 60
             $random_debate = $debates['data'][0];
61 61
         }
62 62
 
63 63
         $recent = array();
64
-        if ( isset($debates['data']) && count($debates['data']) ) {
64
+        if (isset($debates['data']) && count($debates['data'])) {
65 65
             // at the start of a session there may be less than 6
66 66
             // debates
67 67
             $max = 6;
68
-            if ( count($debates['data']) < 6 ) {
68
+            if (count($debates['data']) < 6) {
69 69
                 $max = count($debates['data']);
70 70
             }
71
-            for ( $i = 1; $i < $max; $i++ ) {
71
+            for ($i = 1; $i < $max; $i++) {
72 72
                 $debate = $debates['data'][$i];
73 73
                 $debate['desc'] = "Northern Ireland Assembly debates";
74 74
                 $debate['more_url'] = $MOREURL->generate();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         $featured = array();
80
-        if ( $random_debate ) {
80
+        if ($random_debate) {
81 81
             $featured = $random_debate;
82 82
             $featured['more_url'] = $MOREURL->generate();
83 83
             $featured['desc'] = 'Northern Ireland Assembly debate';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         $data['featured'] = $featured;
89
-        $data['debates'] = array( 'recent' => $recent);
89
+        $data['debates'] = array('recent' => $recent);
90 90
 
91 91
         $data['regional'] = $this->getMLAList();
92 92
         $data['template'] = 'ni/index';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         $data = array();
44 44
 
45
-        $data['popular_searches'] = NULL;
45
+        $data['popular_searches'] = null;
46 46
 
47 47
 
48 48
         $data['urls'] = $this->getURLs($data);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $MOREURL->insert( array( 'more' => 1 ) );
55 55
 
56 56
         // this makes sure that we don't repeat this debate in the list below
57
-        $random_debate = NULL;
57
+        $random_debate = null;
58 58
         if ( isset($debates['data']) && count($debates['data']) ) {
59 59
             $random_debate = $debates['data'][0];
60 60
         }
Please login to merge, or discard this patch.
classes/GlossaryEditQueue.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
                             WHERE edit_id=" . $approval_id . ";");
69 69
             if (!$q->success()) {
70 70
                 break;
71
-            }
72
-            else {
71
+            } else {
73 72
                 // Scrub that one from the list of pending items
74 73
                 unset ($this->pending[$approval_id]);
75 74
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
             // the new epobject id and approval details.
62 62
             $q = $this->db->query("UPDATE editqueue
63 63
                             SET
64
-                            glossary_id='" .  $this->current_epobject_id. "',
64
+                            glossary_id='" .  $this->current_epobject_id . "',
65 65
                             editor_id='" . addslashes($THEUSER->user_id()) . "',
66 66
                             approved='1',
67 67
                             decided='" . $timestamp . "'
Please login to merge, or discard this patch.