Passed
Push — master ( 5f2bd1...7c2064 )
by
unknown
13:34
created
www/docs/mp/index.php 2 patches
Upper-Lower-Casing   +6 added lines, -6 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';
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 // Basic name, title and description
214 214
 $member_name = ucfirst($MEMBER->full_name());
215 215
 $title = $member_name;
216
-$desc = "Read $member_name's contributions to Parliament, including speeches and questions";
216
+$desc = "read $member_name's contributions to Parliament, including speeches and questions";
217 217
 
218 218
 // Enhance description if this is a current member
219 219
 if ($MEMBER->current_member_anywhere()) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 }
263 263
 
264 264
 $known_for = '';
265
-$current_offices_ignoring_committees = $MEMBER->offices('current', TRUE);
265
+$current_offices_ignoring_committees = $MEMBER->offices('current', true);
266 266
 if (count($current_offices_ignoring_committees) > 0) {
267 267
     $known_for = $current_offices_ignoring_committees[0];
268 268
 }
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 $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)));
333 333
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
334 334
 
335
-$data['pre_2010_expenses'] = False;
335
+$data['pre_2010_expenses'] = false;
336 336
 $data['post_2010_expenses'] = $data['leave_date'] > '2010-05-05';
337 337
 
338 338
 if ($data['entry_date'] < '2010-05-05') {
339
-    $data['pre_2010_expenses'] = True;
339
+    $data['pre_2010_expenses'] = true;
340 340
     // Set the expenses URL if we know it
341 341
     if (isset($MEMBER->extra_info['expenses_url'])) {
342 342
         $data['expenses_url_2004'] = $MEMBER->extra_info['expenses_url'];
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
  * Redirect to the canonical page for a member.
557 557
  */
558 558
 
559
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
559
+function member_redirect (&$MEMBER, $code = 301, $pagetype = null) {
560 560
     // We come here after creating a MEMBER object by various methods.
561 561
     // Now we redirect to the canonical MP page, with a person_id.
562 562
     if ($MEMBER->person_id()) {
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     }
140 140
     if ($pid) {
141 141
         $URL = new \MySociety\TheyWorkForYou\Url('search');
142
-        $URL->insert( array('pid'=>$pid, 'pop'=>1) );
142
+        $URL->insert(array('pid'=>$pid, 'pop'=>1));
143 143
         header('Location: ' . $URL->generate('none'));
144 144
         exit;
145 145
     }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     } elseif ($THEUSER->postcode_is_set()) {
190 190
         get_mp_by_user_postcode($THEUSER->postcode());
191 191
     } else {
192
-        twfy_debug ('MP', "We don't have any way of telling what MP to display");
192
+        twfy_debug('MP', "We don't have any way of telling what MP to display");
193 193
         throw new MySociety\TheyWorkForYou\MemberException(gettext('Sorry, but we can’t tell which representative to display.'));
194 194
     }
195 195
     if (!isset($MEMBER) || !$MEMBER->valid) {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     if (!$MEMBER->current_member(HOUSE_TYPE_SCOTLAND)) {
262 262
         $title .= ', former';
263 263
     }
264
-    $title .= ' MSP, '.$MEMBER->constituency();
264
+    $title .= ' MSP, ' . $MEMBER->constituency();
265 265
 }
266 266
 
267 267
 // Enhance title if this is a member of Welsh Parliament
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     if (!$MEMBER->current_member(HOUSE_TYPE_WALES)) {
276 276
         $title .= ', former';
277 277
     }
278
-    $title .= ' MS, '.$MEMBER->constituency();
278
+    $title .= ' MS, ' . $MEMBER->constituency();
279 279
 }
280 280
 
281 281
 $known_for = '';
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 $data['eu_stance'] = $MEMBER->getEUStance();
347 347
 
348 348
 # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs
349
-$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) );
349
+$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS));
350 350
 # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs
351 351
 $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)));
352 352
 $data['has_expenses'] = $data['leave_date'] > '2004-01-01';
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
391 391
         $policySummaries = $divisions->getMemberDivisionDetails(true);
392 392
 
393
-        $policyOptions = array( 'summaries' => $policySummaries);
393
+        $policyOptions = array('summaries' => $policySummaries);
394 394
 
395 395
         // Generate voting segments
396 396
         $set_descriptions = $policiesList->getSetDescriptions();
397
-        if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) {
397
+        if ($policy_set && array_key_exists($policy_set, $set_descriptions)) {
398 398
             $sets = array($policy_set);
399 399
             $data['og_image'] = $MEMBER->url(true) . "/policy_set_png?policy_set=" . $policy_set;
400 400
             $data['page_title'] = $set_descriptions[$policy_set] . ' ' . $title . ' - TheyWorkForYou';
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 
442 442
     case 'divisions':
443 443
         $policyID = get_http_var('policy');
444
-        if ( $policyID ) {
445
-            $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID );
444
+        if ($policyID) {
445
+            $policiesList = new MySociety\TheyWorkForYou\Policies($policyID);
446 446
         } else {
447 447
             $policiesList = new MySociety\TheyWorkForYou\Policies;
448 448
         }
449
-        $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
449
+        $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER);
450 450
         $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions);
451 451
 
452
-        if ( $policyID ) {
452
+        if ($policyID) {
453 453
             $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID);
454 454
             $rel_agreements = $MEMBER->member_agreements($policyID, HOUSE_TYPE_COMMONS, $policiesList);
455 455
             $data['policyagreements'] = array($policyID => $rel_agreements);
@@ -520,15 +520,15 @@  discard block
 block discarded – undo
520 520
     global $THEUSER;
521 521
     $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
522 522
     if (!validate_postcode($pc)) {
523
-        twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
523
+        twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
524 524
         throw new MySociety\TheyWorkForYou\MemberException(sprintf(gettext('Sorry, %s isn’t a valid postcode'), _htmlentities($pc)));
525 525
     }
526
-    twfy_debug ('MP', "MP lookup by postcode");
526
+    twfy_debug('MP', "MP lookup by postcode");
527 527
     $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc));
528 528
     if ($constituency == "connection_timed_out") {
529 529
         throw new MySociety\TheyWorkForYou\MemberException(gettext('Sorry, we couldn’t check your postcode right now, as our postcode lookup server is under quite a lot of load.'));
530 530
     } elseif ($constituency == "") {
531
-        twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
531
+        twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
532 532
         throw new MySociety\TheyWorkForYou\MemberException(sprintf(gettext('Sorry, %s isn’t a known postcode'), _htmlentities($pc)));
533 533
     } else {
534 534
         // Redirect to the canonical MP page, with a person id.
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
     }
542 542
 }
543 543
 
544
-function get_person_by_name($name, $const='') {
544
+function get_person_by_name($name, $const = '') {
545 545
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const));
546 546
     // Edge case, only attempt further detection if this isn't the Queen.
547 547
     if (($name !== 'elizabeth the second' && $name !== 'prince charles') || $const) {
548
-        twfy_debug ('MP', 'Redirecting for MP found by name/constituency');
548
+        twfy_debug('MP', 'Redirecting for MP found by name/constituency');
549 549
         member_redirect($MEMBER);
550 550
     }
551 551
     return $MEMBER;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
  * Redirect to the canonical page for a member.
583 583
  */
584 584
 
585
-function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) {
585
+function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) {
586 586
     // We come here after creating a MEMBER object by various methods.
587 587
     // Now we redirect to the canonical MP page, with a person_id.
588 588
     if ($MEMBER->person_id()) {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         } else {
602 602
             $pagetype = '';
603 603
         }
604
-        header('Location: ' . $url . $pagetype, true, $code );
604
+        header('Location: ' . $url . $pagetype, true, $code);
605 605
         exit;
606 606
     }
607 607
 }
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 function person_error_page($message) {
631 631
     global $this_page;
632 632
     $SEARCHURL = '';
633
-    switch($this_page) {
633
+    switch ($this_page) {
634 634
         case 'peer':
635 635
             $people = new MySociety\TheyWorkForYou\People\Peers();
636 636
             $MPSURL = new \MySociety\TheyWorkForYou\Url('peers');
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
  * Generate the summary of this person's held positions.
678 678
  */
679 679
 
680
-function person_summary_description ($MEMBER) {
680
+function person_summary_description($MEMBER) {
681 681
     $entered_house = $MEMBER->entered_house();
682 682
     $current_member = $MEMBER->current_member();
683 683
     $left_house = $MEMBER->left_house();
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
     }
694 694
     $desc = '';
695 695
     foreach ($MEMBER->houses() as $house) {
696
-        if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) {
696
+        if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) {
697 697
             # Same info is printed further down
698 698
             continue;
699 699
         }
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
  * @return string A HTML summary of this person's rebellion rate.
767 767
  */
768 768
 
769
-function person_rebellion_rate ($member) {
769
+function person_rebellion_rate($member) {
770 770
 
771 771
     // Rebellion string may be empty.
772 772
     $rebellion_string = '';
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         $SEARCHENGINE = new \SEARCHENGINE($searchstring);
816 816
 
817 817
         $hansard = new MySociety\TheyWorkForYou\Hansard();
818
-        $args = array (
818
+        $args = array(
819 819
             's' => $searchstring,
820 820
             'p' => 1,
821 821
             'num' => 3,
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
     twfy_debug_timestamp();
831 831
 
832 832
     $MOREURL = new \MySociety\TheyWorkForYou\Url('search');
833
-    $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) );
833
+    $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1));
834 834
 
835 835
     $out['more_href'] = $MOREURL->generate() . '#n4';
836 836
     $out['more_text'] = sprintf(gettext('More of %s’s recent appearances'), ucfirst($member->full_name()));
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
         return;
991 991
     }
992 992
 
993
-    $reg = array( 'date' => '', 'data' => '<p>Nil</p>' );
993
+    $reg = array('date' => '', 'data' => '<p>Nil</p>');
994 994
     if (isset($extra_info['register_member_interests_date'])) {
995 995
         $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
996 996
     }
@@ -1084,8 +1084,8 @@  discard block
 block discarded – undo
1084 1084
         }
1085 1085
     }
1086 1086
 
1087
-    foreach($mreg as $reg) {
1088
-        $data['members'][] = array (
1087
+    foreach ($mreg as $reg) {
1088
+        $data['members'][] = array(
1089 1089
             'url' => '/' . $rep_type . '/?p=' . $reg['person_id'],
1090 1090
             'name' => $reg['given_name'] . ' ' . $reg['family_name']
1091 1091
         );
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
     # comparison which is Commons only
1155 1155
     $data['party_member_count'] = $party->getCurrentMemberCount(HOUSE_TYPE_COMMONS);
1156 1156
 
1157
-    $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER, [
1157
+    $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER, [
1158 1158
         'summaries' => $policySummaries,
1159 1159
     ]);
1160 1160
     $policy_diffs = $MEMBER->getPartyPolicyDiffs($partyCohort, $policiesList, $positions);
Please login to merge, or discard this patch.
www/docs/api/api_functions.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 # Key-related functions
139 139
 
140 140
 function api_log_call($key) {
141
-    if ($key=='DOCS') {
141
+    if ($key == 'DOCS') {
142 142
         return;
143 143
     }
144 144
     $ip = $_SERVER['REMOTE_ADDR'];
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 # Output functions
217 217
 
218
-function api_output($arr, $last_mod=null) {
218
+function api_output($arr, $last_mod = null) {
219 219
     $output = get_http_var('output');
220 220
     if (!get_http_var('docs')) {
221 221
         $cond = api_header($output, $last_mod);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         }
225 225
     }
226 226
     if ($output == 'xml') {
227
-        $out = '<?xml version="1.0" encoding="utf-8"?>'."\n";
227
+        $out = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
228 228
         $out .= '<twfy>' . api_output_xml($arr) . '</twfy>';
229 229
     } elseif ($output == 'php') {
230 230
         $out = api_output_php($arr);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     print $out;
244 244
 }
245 245
 
246
-function api_header($o, $last_mod=null) {
246
+function api_header($o, $last_mod = null) {
247 247
     if ($last_mod && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
248 248
         $t = cond_parse_http_date($_SERVER['HTTP_IF_MODIFIED_SINCE']);
249 249
         if (isset($t) && $t >= $last_mod) {
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     }
270 270
     #$type = 'text/plain';
271 271
     header("Content-Type: $type; charset=$charset");
272
-    if ($last_mod>0) {
272
+    if ($last_mod > 0) {
273 273
         header('Last-Modified: ' . date('r', $last_mod));
274 274
     }
275 275
     return false;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     global $api_xml_arr;
302 302
     $verbose = get_http_var('verbose') ? "\n" : '';
303 303
     if (is_array($v)) {
304
-        if (count($v) && array_keys($v) === range(0, count($v)-1)) {
304
+        if (count($v) && array_keys($v) === range(0, count($v) - 1)) {
305 305
             $elt = 'match';
306 306
             $api_xml_arr++;
307 307
             $out = "<$elt>";
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
     }
323 323
 }
324 324
 
325
-function api_output_js($v, $level=0) {
325
+function api_output_js($v, $level = 0) {
326 326
     $verbose = get_http_var('verbose') ? "\n" : '';
327 327
     $out = '';
328 328
     if (is_array($v)) {
329 329
         # PHP arrays are both JS arrays and objects
330
-        if (count($v) && array_keys($v) === range(0, count($v)-1)) {
331
-            $out = '[' . join(",$verbose" , array_map('api_output_js', $v)) . ']';
330
+        if (count($v) && array_keys($v) === range(0, count($v) - 1)) {
331
+            $out = '[' . join(",$verbose", array_map('api_output_js', $v)) . ']';
332 332
         } else {
333 333
             $out = '{' . $verbose;
334 334
             $b = false;
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
                     $out .= ",$verbose";
338 338
                 }
339 339
                 if ($verbose) {
340
-                    $out .= str_repeat(' ', ($level+1)*2);
340
+                    $out .= str_repeat(' ', ($level + 1) * 2);
341 341
                     $out .= '"' . $k . '" : ';
342 342
                 } else {
343 343
                     $out .= '"' . $k . '":';
344 344
                 }
345
-                $out .= api_output_js($vv, $level+1);
345
+                $out .= api_output_js($vv, $level + 1);
346 346
                 $b = true;
347 347
             }
348 348
             if ($verbose) {
349
-                $out .= "\n" . str_repeat(' ', $level*2);
349
+                $out .= "\n" . str_repeat(' ', $level * 2);
350 350
             }
351 351
             $out .= '}';
352 352
         }
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
         $out = "null";
355 355
     } elseif (is_string($v)) {
356 356
         $out = '"' . str_replace(
357
-            array("\\",'"',"\n","\t","\r", "‶", "″", "“", "”"),
358
-            array("\\\\",'\"','\n','\t','\r', '\"', '\"', '\"', '\"'), $v) . '"';
357
+            array("\\", '"', "\n", "\t", "\r", "‶", "″", "“", "”"),
358
+            array("\\\\", '\"', '\n', '\t', '\r', '\"', '\"', '\"', '\"'), $v) . '"';
359 359
     } elseif (is_bool($v)) {
360 360
         $out = $v ? 'true' : 'false';
361 361
     } elseif (is_int($v) || is_float($v)) {
Please login to merge, or discard this patch.
www/docs/api/api_getGeometry.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     return null;
71 71
 }
72 72
 
73
-function _api_cacheCheck($fn, $arg='') {
73
+function _api_cacheCheck($fn, $arg = '') {
74 74
     $cache = INCLUDESPATH . '../docs/api/cache/' . $fn;
75 75
     if (is_file($cache)) {
76 76
         return unserialize(file_get_contents($cache));
@@ -88,58 +88,58 @@  discard block
 block discarded – undo
88 88
 function _api_ni_centroids() {
89 89
     return array(
90 90
         # East Londonderry
91
-        66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ),
92
-        14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ),
91
+        66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907),
92
+        14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907),
93 93
         # Foyle
94
-        66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ),
95
-        14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ),
94
+        66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456),
95
+        14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456),
96 96
         # West Tyrone
97
-        66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ),
98
-        14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ),
97
+        66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278),
98
+        14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278),
99 99
         # Fermanagh &amp; South Tyrone
100
-        14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ),
101
-        66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ),
100
+        14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237),
101
+        66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237),
102 102
         # Newry &amp; Armagh
103
-        14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ),
104
-        66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ),
103
+        14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770),
104
+        66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770),
105 105
         # Upper Bann
106
-        14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ),
107
-        66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ),
106
+        14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098),
107
+        66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098),
108 108
         # South Down
109
-        14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ),
110
-        66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ),
109
+        14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344),
110
+        66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344),
111 111
         # Lagan Valley
112
-        14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ),
113
-        66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ),
112
+        14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398),
113
+        66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398),
114 114
         # Strangford
115
-        14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ),
116
-        66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ),
115
+        14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343),
116
+        66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343),
117 117
         # North Down
118
-        14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ),
119
-        66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ),
118
+        14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384),
119
+        66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384),
120 120
         # South Antrim
121
-        14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ),
122
-        66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ),
121
+        14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905),
122
+        66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905),
123 123
         # East Antrim
124
-        66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ),
125
-        14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ),
124
+        66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179),
125
+        14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179),
126 126
         # North Antrim
127
-        66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ),
128
-        14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ),
127
+        66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125),
128
+        14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125),
129 129
         # Mid Ulster
130
-        66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ),
131
-        14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ),
130
+        66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044),
131
+        14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044),
132 132
         # Belfast North
133
-        14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ),
134
-        66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ),
133
+        14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511),
134
+        66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511),
135 135
         # Belfast East
136
-        14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ),
137
-        66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ),
136
+        14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792),
137
+        66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792),
138 138
         # Belfast South
139
-        14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ),
140
-        66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ),
139
+        14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064),
140
+        66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064),
141 141
         # Belfast West
142
-        14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ),
143
-        66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ),
142
+        14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650),
143
+        66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650),
144 144
     );
145 145
 }
Please login to merge, or discard this patch.
www/docs/api/api_getPerson.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 <?php
18 18
 }
19 19
 
20
-function _api_getPerson_row($row, $has_party=false) {
20
+function _api_getPerson_row($row, $has_party = false) {
21 21
     global $parties;
22 22
     $row['full_name'] = member_full_name($row['house'], $row['title'], $row['given_name'],
23 23
         $row['family_name'], $row['lordofname']);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     if ($has_party && isset($parties[$row['party']])) {
32 32
         $row['party'] = $parties[$row['party']];
33 33
     }
34
-    list($image,$sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']);
34
+    list($image, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']);
35 35
     if ($image) {
36 36
         list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . IMAGEPATH, $image));
37 37
         $row['image'] = $image;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     return $row;
59 59
 }
60 60
 
61
-function api_getPerson_id($id, $house='') {
61
+function api_getPerson_id($id, $house = '') {
62 62
     $db = new ParlDB;
63 63
     $params = array(
64 64
         ':person_id' => $id
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 }
82 82
 
83
-function _api_getPerson_output($q, $flatten=false) {
83
+function _api_getPerson_output($q, $flatten = false) {
84 84
     $output = array();
85 85
     $last_mod = 0;
86 86
     $house = null;
Please login to merge, or discard this patch.
www/docs/api/api_getConstituencies.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         and c_main.main_name and constituency.name like :constituency_name and constituency.from_date <= date(now())
42 42
         and date(now()) <= constituency.to_date
43 43
         order by name', array(
44
-        ':constituency_name' => '%' . $s .'%'
44
+        ':constituency_name' => '%' . $s . '%'
45 45
         ));
46 46
     $output = array();
47 47
     $done = array();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 function api_getConstituencies($date = 'now()') {
71 71
     $db = new ParlDB;
72 72
     $q = $db->query('select cons_id, name from constituency
73
-        where main_name and from_date <= date('.$date.') and date('.$date.') <= to_date
73
+        where main_name and from_date <= date('.$date . ') and date(' . $date . ') <= to_date
74 74
         order by name');
75 75
     $output = array();
76 76
     foreach ($q as $row) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function _api_angle_between($a1, $a2) {
154 154
     if (abs($a1 - $a2) > M_PI) {
155
-        return 2*M_PI - abs($a1 - $a2);
155
+        return 2 * M_PI - abs($a1 - $a2);
156 156
     }
157 157
     return abs($a1 - $a2);
158 158
 }
Please login to merge, or discard this patch.
www/docs/api/api_getAlerts.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function api_getAlerts_start_date($start_date) {
4
-    $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
4
+    $args = array('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5 5
     $alert = new ALERT();
6
-    $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
6
+    $data = $alert->fetch_between($confirmed = 1, $deleted = 0, $args['start_date'], $args['end_date']);
7 7
     api_output($data);
8 8
 }
9 9
 
Please login to merge, or discard this patch.
www/docs/bills/2005-06/legislative-and-regulatory-reform/index.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 $this_page = 'bill_index';
4 4
 include_once '../../../../includes/easyparliament/init.php';
5
-$DATA->set_page_metadata($this_page, 'heading','Legislative and Regulatory Reform Bill');
5
+$DATA->set_page_metadata($this_page, 'heading', 'Legislative and Regulatory Reform Bill');
6 6
 $PAGE->page_start();
7 7
 $PAGE->stripe_start();
8
-$PAGE->block_start(array ('title'=>'House of Commons - Normal Run'));
8
+$PAGE->block_start(array('title'=>'House of Commons - Normal Run'));
9 9
 ?>
10 10
 <ul>
11 11
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     parse_bill('2006141.txt');
46 46
     $amendments = read_amendments('amendments.txt'); # The amendments, by number
47 47
     parse_amendments();
48
-    $out = $title."\n\n";
48
+    $out = $title . "\n\n";
49 49
     $out .= "Page,Line\n";
50 50
     foreach ($bill as $page_num => $page) {
51 51
         foreach ($page as $line_num => $line) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 print '</ul>';
60 60
 $PAGE->block_end();
61 61
 $includes = array(
62
-    array (
62
+    array(
63 63
         'type' => 'include',
64 64
         'content' => 'bills_intro'
65 65
     ),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     $intitle = true;
78 78
     $title = '';
79 79
     foreach ($f as $r) {
80
-        if ($line<1) {
80
+        if ($line < 1) {
81 81
             $line++;
82 82
             continue;
83 83
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             }
97 97
             continue;
98 98
         }
99
-        if (substr($r, 0, 8)=='Bill 141') {
99
+        if (substr($r, 0, 8) == 'Bill 141') {
100 100
             continue;
101 101
         }
102 102
         if (preg_match('#\s+([1-4]?[05])$#', $r, $m)) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         if ($r == "\n") {
144 144
             continue;
145 145
         }
146
-        if ($line<1) {
146
+        if ($line < 1) {
147 147
             $line++;
148 148
             continue;
149 149
         }
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
             $number = $m[1];
158 158
             $amendments[$number] = '';
159 159
         } elseif (preg_match('#To move the following Clause#', $r)) {
160
-            preg_match('#\n(.*?)$#', $amendments[$number-1], $m);
161
-            $amendments[$number-1] = preg_replace('#\n(.*?)$#', '', $amendments[$number-1]);
160
+            preg_match('#\n(.*?)$#', $amendments[$number - 1], $m);
161
+            $amendments[$number - 1] = preg_replace('#\n(.*?)$#', '', $amendments[$number - 1]);
162 162
             $amendments[$number] .= '*' . trim($m[1]) . "*\n$r";
163 163
         } else {
164 164
             $amendments[$number] .= $r;
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
             $page = $m[1]; $line = $m[2]; $clause = $m[3];
183 183
             $from_text = $m[4]; $end_line = $m[5]; $insert = $m[6];
184 184
             unset($amendments[$num]);
185
-            $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="'.$num.'">' . $insert . '</ins>';
186
-            for ($i=$line+1; $i<=$end_line; $i++) {
187
-                $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
185
+            $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="' . $num . '">' . $insert . '</ins>';
186
+            for ($i = $line + 1; $i <= $end_line; $i++) {
187
+                $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
188 188
             }
189 189
         }
190 190
         # Page  4, line 9 [Clause 6], leave out from `under' to `creating' and insert `this Part making provision'
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
             $insert = $m[7];
202 202
             unset($amendments[$num]);
203 203
             $bill[$page][$from_line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$from_line]) . '</del>';
204
-            for ($i=$from_line+1; $i<$to_line; $i++) {
205
-                $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
204
+            for ($i = $from_line + 1; $i < $to_line; $i++) {
205
+                $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
206 206
             }
207
-            $bill[$page][$to_line] = '<del title="'.$num.'">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]);
207
+            $bill[$page][$to_line] = '<del title="' . $num . '">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]);
208 208
         }
209 209
         # Page  3, line 13 [Clause 4], leave out from beginning to `confer' and insert `An order under this Part may not make provision to'
210 210
         if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], leave out from beginning to `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) {
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
             $page = $m[1]; $line = $m[3]; $clause = $m[2];
226 226
             $insert = isset($m[4]) ? $m[4] : null;
227 227
             unset($amendments[$num]);
228
-            $bill[$page][$line] = '<del title="'.$num.'">'.$bill[$page][$line].'</del>';
228
+            $bill[$page][$line] = '<del title="' . $num . '">' . $bill[$page][$line] . '</del>';
229 229
             if ($insert) {
230
-                $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>';
230
+                $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>';
231 231
             }
232 232
         }
233 233
         # Page 8, line 24 [Clause 14], at end insert-- `...'
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             $page = $m[1]; $line = $m[2]; $clause = $m[3];
236 236
             $insert = $m[4];
237 237
             unset($amendments[$num]);
238
-            $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>';
238
+            $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>';
239 239
         }
240 240
         # Title, line    1, leave out `reforming legislation' and insert `...'
241 241
         if (preg_match('#Title, line.*?, leave out `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) {
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
252 252
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
253 253
                     $startP = $subsubclause['startP'];
254
-                    if ($startP==$page && $subsubclause['startL']==$line) {
254
+                    if ($startP == $page && $subsubclause['startL'] == $line) {
255 255
                         if ($startP == $subsubclause['endP']) {
256 256
                             unset($amendments[$num]);
257
-                            for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) {
258
-                                $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
257
+                            for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) {
258
+                                $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
259 259
                             }
260 260
                             if ($insert) {
261
-                                $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>";
261
+                                $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>";
262 262
                             }
263 263
                         }
264 264
                     }
@@ -274,21 +274,21 @@  discard block
 block discarded – undo
274 274
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
275 275
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
276 276
                     $startP = $subsubclause['startP'];
277
-                    if ($startP==$page && $subsubclause['startL']==$line) {
277
+                    if ($startP == $page && $subsubclause['startL'] == $line) {
278 278
                         if ($startP == $subsubclause['endP']) {
279 279
                             unset($amendments[$num]);
280 280
                             $finished = true;
281 281
                         }
282 282
                     }
283 283
                     if ($finished) {
284
-                        for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) {
285
-                            $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
284
+                        for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) {
285
+                            $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
286 286
                         }
287 287
                     }
288 288
                 }
289 289
                 if ($finished) {
290 290
                     if ($insert) {
291
-                        $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>";
291
+                        $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>";
292 292
                     }
293 293
                     break;
294 294
                 }
@@ -300,19 +300,19 @@  discard block
 block discarded – undo
300 300
             $finished = false;
301 301
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
302 302
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
303
-                    if ($subsubclause['startP']==$page && $subsubclause['startL']==$line) {
303
+                    if ($subsubclause['startP'] == $page && $subsubclause['startL'] == $line) {
304 304
                         unset($amendments[$num]);
305 305
                         $finished = true;
306 306
                     }
307 307
                     if ($finished) {
308
-                        for ($p = $subsubclause['startP']; $p<=$subsubclause['endP']; $p++) {
309
-                            if ($p>$subsubclause['startP']) {
308
+                        for ($p = $subsubclause['startP']; $p <= $subsubclause['endP']; $p++) {
309
+                            if ($p > $subsubclause['startP']) {
310 310
                                 $starti = 1;
311 311
                             } else {
312 312
                                 $starti = $subsubclause['startL'];
313 313
                             }
314
-                            for ($i = $starti; $i<=$subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages
315
-                                $bill[$p][$i] = '<del title="'.$num.'">' . $bill[$p][$i] . '</del>';
314
+                            for ($i = $starti; $i <= $subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages
315
+                                $bill[$p][$i] = '<del title="' . $num . '">' . $bill[$p][$i] . '</del>';
316 316
                             }
317 317
                         }
318 318
                     }
Please login to merge, or discard this patch.
www/docs/boundaries/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,9 +135,9 @@
 block discarded – undo
135 135
 <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php
136 136
         foreach ($mreg as $k => $n) {
137 137
             print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>";
138
-            if ($k < count($mreg)-2) {
138
+            if ($k < count($mreg) - 2) {
139 139
                 print ', ';
140
-            } elseif ($k == count($mreg)-2) {
140
+            } elseif ($k == count($mreg) - 2) {
141 141
                 print ' and ';
142 142
             }
143 143
         }
Please login to merge, or discard this patch.
www/docs/admin/featured.php 1 patch
Spacing   +7 added lines, -7 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 ))->first();
32
+    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid))->first();
33 33
     $url_gid = fix_gid_from_db($gid);
34 34
     $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['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,9 +113,9 @@  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 120
         include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php';
121 121
     } else {
@@ -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) {
Please login to merge, or discard this patch.