Passed
Pull Request — master (#1474)
by Nick
34:57
created
www/docs/news/editme.php 1 patch
Upper-Lower-Casing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 Read <a href="http://www.mysociety.org/2009/01/21/blimey-it-looks-like-the-internets-won/">our victory mySociety blog post</a>,
22 22
 and do join our mailing list. :-)
23
-EOT
23
+eot
24 24
 , '2009-01-21 15:30:00', 'Matthew'),
25 25
 
26 26
 48 => array('API keys, and improved internal links', <<<EOT
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 crowd-sourcing game to match the reference to the exact speech, much like our
46 46
 <a href="https://www.theyworkforyou.com/video/">video matching</a> (nearly 80%
47 47
 of our archive done!). :)
48
-EOT
48
+eot
49 49
 , '2008-07-18 14:01:00', 'Matthew'),
50 50
 
51 51
 47 => array('Video on TheyWorkForYou', <<<EOT
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 <a href="http://www.mysociety.org/2008/06/01/video-recordings-of-the-house-of-commons-on-theyworkforyoucom/">Etienne's post on the mySociety blog</a>
59 59
 has some background information on the project.
60
-EOT
60
+eot
61 61
 , '2008-06-02 18:56:00', 'Matthew'),
62 62
 
63 63
 46 => array('The Scottish Parliament', <<<EOT
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 launching this now to mark the success in getting endorsements for our <a
90 90
 href="/freeourbills/">Free Our Bills campaign</a>, and we'll be rolling out
91 91
 more goodies as the campaign goes along.
92
-EOT
92
+eot
93 93
 , '2008-05-06 13:35:28', 'Matthew'),
94 94
 
95 95
 45 => array('Shadow ministers and spokespersons', <<<EOT
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 This information is given both on a person's page and within any debates they
99 99
 speak in, which could help explain why your local MP is speaking on transport
100 100
 or foreign affairs a lot. :)
101
-EOT
101
+eot
102 102
 , '2008-04-30 08:25:00', 'Matthew'),
103 103
 
104 104
 44 => array('Please donate to help us expand TheyWorkForYou', <<<EOT
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 Unfortunately, the server that TheyWorkForYou sits on is almost full, so we can&#8217;t launch their hard work. Boo!
108 108
 
109 109
 TheyWorkForYou isn&#8217;t an externally funded project, and we need funding from other sources to keep it growing and improving. So if the season has filled you with generosity of spirit, why not <a href="https://secure.mysociety.org/donate/">drop us a few pennies</a> to pay for some upgrades? Any extra beyond what we need will go into the general pot to keep <a href="http://www.mysociety.org/">mySociety</a> running and the developers from starving.
110
-EOT
110
+eot
111 111
 , '2007-12-21 10:07:35', 'Tom'),
112 112
 
113 113
 43 => array('The Queen in Parliament', <<<EOT
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 or just look at past
122 122
 <a href="https://www.theyworkforyou.com/search/?pid=13935&pop=1">prorogation and Queen's speeches</a>
123 123
 more easily than anywhere else I've found.
124
-EOT
124
+eot
125 125
 , '2007-09-11 15:34:47', 'Matthew'),
126 126
 
127 127
 42 => array('Missing confirmation emails', <<<EOT
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 few days have now been sent out, and I've got in touch
133 133
 with anyone who signed up in the days prior to
134 134
 that to let them know what happened.
135
-EOT
135
+eot
136 136
 , "2007-09-03 17:12:47", 'Matthew'),
137 137
 
138 138
 41 => array('The Northern Ireland Assembly', <<<EOT
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 ATB,<br>
174 174
 <a href="http://www.dracos.co.uk/">Matthew Somerville</a>
175
-EOT
175
+eot
176 176
 , "2006-12-11 00:00:00", 'Matthew'),
177 177
 
178 178
 40 => array('TheyWorkForYou API', <<<EOT
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 Here's my <a href="http://www.mysociety.org/2006/barcamp-london/">BarCamp
192 192
 Presentation</a> launching the API, and a <a href="http://www.dracos.co.uk/work/theyworkforyou/api/fabfarts/">couple</a>
193 193
 of <a href="http://www.mysociety.org/2006/09/02/battle-your-way-to-sedgefield/">applications</a> using it.
194
-EOT
194
+eot
195 195
 , "2006-09-02 17:10:00"),
196 196
 
197 197
 39 => array('New features over the last couple of months', <<<EOT
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 and when searching a particular person's speeches, we no longer group the results by debate, which
220 220
 was confusing, as you obviously expected to see all the speeches for that person that matched your
221 221
 search terms.
222
-EOT
222
+eot
223 223
 , "2006-08-18 09:46:36"),
224 224
 
225 225
 38 => array("Got an idea for a useful website?", <<<EOT
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 come up with an idea for a useful site like this one, and it beats all
228 228
 the other ideas, we'll build it for free. <a href="http://www.mysociety.org/proposals2006/submit">Submit an idea</a>
229 229
 or <a href="http://www.mysociety.org/proposals2006/view">read and comment on what other people have submitted</a>.
230
-EOT
230
+eot
231 231
 , "2006-06-06 06:06:06"),
232 232
 
233 233
 37 => array("We've added the Lords, and more", <<<EOT
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 also added a feature to the search to help you identify which MPs or
238 238
 Lords are interested in a certain word or phrases. Just search as
239 239
 usual and then click 'Show use by person'.
240
-EOT
240
+eot
241 241
 , "2006-06-01 12:34:56"),
242 242
 
243 243
 36 => array("Changes to the Register of Members' Interests", <<<EOT
244 244
 One of the many things our site does, probably without you realising, is to track the Register of Members' Interests, in which MPs are "to provide information of any pecuniary interest or other material benefit which a Member receives which might reasonably be thought by others to influence his or her actions, speeches or votes in Parliament, or actions taken in the capacity of a Member of Parliament". The latest entry published on the official site has always been shown on MP pages (<a href="https://www.theyworkforyou.com/mp/tony_blair/sedgefield#register">here's Tony Blair's</a>), however we kept all previous editions of the Register safe and sound. And now, after a bit of coding, you can view a history of the Register, either <a href="https://www.theyworkforyou.com/regmem/?f=2005-12-14">comparing particular editions</a>, or for particular MPs (<a href="https://www.theyworkforyou.com/regmem/?p=10001">Diane Abbott</a>, for example). Entries only have to stay on the Register for a year, so this can make for some interesting reading.
245 245
 
246 246
 Happy New Year! :) <a href="https://www.theyworkforyou.com/regmem/">Changes to the Register of Members' Interests</a>
247
-EOT
247
+eot
248 248
 , "2006-01-01 12:36:00"),
249 249
 
250 250
 35 => array("TheyWorkForYou.com Wins Award", <<<EOT
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
 Thanks to the kind souls who nominated us. We enjoyed ourselves.
254 254
 
255 255
 
256
-EOT
256
+eot
257 257
 , "2005-07-05 23:54:13"),
258 258
 
259 259
 34 => array("NEW! Email this page to a friend", <<<EOT
260 260
 At the top right hand side of every (ex)MP's page, we've added a simple new feature: email the page to a friend.
261 261
 
262 262
 <a href="/mp/">Have a go</a>, and let all your friends know how easy it is to keep tabs on what your former MP did and said in your name during the last Parliament.
263
-EOT
263
+eot
264 264
 , "2005-04-14 23:43:50"),
265 265
 
266 266
 33 => array("Play with Pledgebank, Pound the Streets", <<<EOT
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 </blockquote>
274 274
 
275 275
 If you're up for it, why not <a href="http://www.pledgebank.com/theywork">sign up now?</a>
276
-EOT
276
+eot
277 277
 , "2005-04-13 22:41:23"),
278 278
 
279 279
 32 => array("NEW! How MPs voted on Key Issues", <<<EOT
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 This information is the result sophisticated mining of PublicWhip's detailed vote data covering hundreds of Parliamentary divisions.
287 287
 
288 288
 We hope it'll make it easier for you to keep track of where your MP really stands on key issues - after all, They Work For You.
289
-EOT
289
+eot
290 290
 , "2005-04-05 22:59:57"),
291 291
 
292 292
 31 => array("Channel 4 linking to TheyWorkForYou.com", <<<EOT
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 We've done a special paint job for users coming from the Channel 4 site, just to make them feel welcome. You can see an example <a href="https://www.theyworkforyou.com/mp/c4/paul_keetch/hereford">here</a>.
296 296
 
297 297
 We'd love to know what you think of this paint job, as we're planning a redesign. As ever, <a href="/contact/">get in touch</a>.
298
-EOT
298
+eot
299 299
 , "2005-04-05 22:53:32"),
300 300
 
301 301
 30 => array("NEW! Email Alerts & Other Features", <<<EOT
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     - Tom, on behalf of the TheyWorkForYou.com volunteers
358 358
 
359 359
      <a href="https://www.theyworkforyou.com/about/">https://www.theyworkforyou.com/about/</a>  - New volunteers welcome!
360
-EOT
360
+eot
361 361
 , "2005-02-24 22:02:44"),
362 362
 
363 363
 26 => array("New Release of TheyWorkForYou.com Source Code", <<<EOT
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 Feel free to download it and have a play.
375 375
 
376 376
 Whilst you're at it, don't forget we also publish a full <a href="https://www.theyworkforyou.com/raw/">XML version of the Hansard data</a>.
377
-EOT
377
+eot
378 378
 , "2005-01-25 00:15:19"),
379 379
 
380 380
 25 => array("Search by Date", <<<EOT
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 Next step on search is probably an RSS version of keyword searches. We're still very keen to improve overall relevancy of results - anyone out there fancy lending us a Google Appliance to play with?
387 387
 
388 388
 As ever, <a href="/contact/">contact us</a> if you've got any suggestions how we might improve the site, or if you fancy volunteering.
389
-EOT
389
+eot
390 390
 , "2005-01-25 00:16:09"),
391 391
 
392 392
 20 => array("New! Ministerial Statements now included", <<<EOT
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 Next up: Select Committees, which promise to be an order of magnitude more challenging. We'll keep you posted.
405 405
 
406 406
 PS We're always on the lookout for new volunteers - <a href="/contact/">contact us</a> if you are keen to help in almost any capacity.
407
-EOT
407
+eot
408 408
 , "2005-01-17 17:44:47"),
409 409
 
410 410
 19 => array("NEW! Westminster Hall debates now available.", <<<EOT
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
 
424 424
 
425
-EOT
425
+eot
426 426
 , "2004-12-22 23:47:19"),
427 427
 
428 428
 18 => array("RSS feed of your MP's recent appearances", <<<EOT
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 RSS is a simple way to publish & distribute content which is frequently updated  (<a href="http://news.bbc.co.uk/1/hi/help/3223484.stm">learn more here</a>.)
437 437
 
438 438
 Some enlightened MPs are now incorporating this useful feed of their Parliamentary activity into their websites. See <a href="http://www.richardallan.org.uk/">Richard Allen's</a> website for a good example.
439
-EOT
439
+eot
440 440
 , "2004-11-27 16:38:41"),
441 441
 
442 442
 16 => array("NEW! MPs' Expenses", <<<EOT
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 For example, it is good to note that <a href="https://www.theyworkforyou.com/mp/?pid=10508#expenses">Barbara Roche</a>, a North London MP, does not claim excessive travel expenses.
446 446
 
447 447
 Bear in mind that proper democracy does cost money, so please think twice before using these data as a stick with which to beat your MP. An "expensive" MP might be providing excellent value for money. And vice versa.
448
-EOT
448
+eot
449 449
 , "2004-11-08 10:11:14"),
450 450
 
451 451
 11 => array("TheyWorkForYou.com Development Wiki now public", <<<EOT
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 (dissemination is fine, but please don't post the link with the login details embedded in the url)
462 462
 
463 463
 In case you're wondering what we're up to, well, we're just rousing ourselves for another tilt at completing our vision before the next election is called, so if anyone python or php skills and fancies lending a hand, do <a href="/contact/">contact us</a>.
464
-EOT
464
+eot
465 465
 , "2004-10-01 23:14:13"),
466 466
 
467 467
 8 => array("New! Full Source Code Published", <<<EOT
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 
482 482
 <a href="https://www.theyworkforyou.com/rss/mp/10508.rdf">https://www.theyworkforyou.com/rss/mp/10508.rdf</a>
483 483
     - Typical MP 'recent appearances' RSS feed, uses person id.
484
-EOT
484
+eot
485 485
 , "2004-07-18 22:58:23"),
486 486
 
487 487
 7 => array("Public Beta Now Live", <<<EOT
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 More than the usuals,
503 503
 
504 504
 - <i><a href="https://www.theyworkforyou.com/about/" title="link to About Us page">The TheyWorkForYou.com Volunteers</a></i>
505
-EOT
505
+eot
506 506
 , "2004-06-06 03:02:53"),
507 507
 
508 508
 6 => array("Want to help make us complete?", <<<EOT
@@ -514,14 +514,14 @@  discard block
 block discarded – undo
514 514
 
515 515
 Just <a href="/contact/">contact us</a>.
516 516
 
517
-EOT
517
+eot
518 518
 , "2004-05-21 22:15:22"),
519 519
 
520 520
 5 => array("Know someone who'd like this website?", <<<EOT
521 521
 If you know someone who would appreciate being a beta tester, please <a href="/contact/">contact us</a> with their details.
522 522
 
523 523
 Many thanks.
524
-EOT
524
+eot
525 525
 , "2004-05-21 22:55:24"),
526 526
 
527 527
 4 => array("Welcome to our private beta test", <<<EOT
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 In the meantime, please enjoy being the first people to scribble in the margins of Hansard. May you be first of many.
539 539
 
540 540
 - <em>The TheyWorkForYou.com volunteers</em>
541
-EOT
541
+eot
542 542
 , "2004-05-21 22:55:24")
543 543
 );
544 544
 
Please login to merge, or discard this patch.
www/docs/search/index.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$new_style_template = TRUE;
3
+$new_style_template = true;
4 4
 
5 5
 include_once '../../includes/easyparliament/init.php';
6 6
 include_once INCLUDESPATH . "easyparliament/glossary.php";
Please login to merge, or discard this patch.
www/docs/alert/index.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$new_style_template = TRUE;
3
+$new_style_template = true;
4 4
 
5 5
 include_once '../../includes/easyparliament/init.php';
6 6
 include_once INCLUDESPATH . 'easyparliament/member.php';
Please login to merge, or discard this patch.
www/docs/alert/by-postcode/index.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$new_style_template = TRUE;
3
+$new_style_template = true;
4 4
 
5 5
 include_once '../../../includes/easyparliament/init.php';
6 6
 include_once INCLUDESPATH . 'easyparliament/member.php';
Please login to merge, or discard this patch.
www/docs/topic/topic.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 namespace MySociety\TheyWorkForYou;
12 12
 
13 13
 // Disable the old PAGE class.
14
-$new_style_template = TRUE;
14
+$new_style_template = true;
15 15
 
16 16
 // Include all the things this page needs.
17 17
 include_once '../../includes/easyparliament/init.php';
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
 $this_page = 'topic';
28 28
 
29 29
 // Make sure the requested topic actually exists, otherwise throw a 404.
30
-if ($topic = $topics->getTopic($topicname))
31
-{
30
+if ($topic = $topics->getTopic($topicname)) {
32 31
 
33 32
     $data = array();
34 33
     $data['topic'] = $topic;
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
         include_once INCLUDESPATH . 'easyparliament/member.php';
46 45
 
47 46
         // Check to see if there's a submitted postcode to try determine policy positions.
48
-        if (get_http_var('pc') != '')
49
-        {
47
+        if (get_http_var('pc') != '') {
50 48
 
51 49
             // Try all this, as it might go wrong.
52 50
             try {
@@ -81,8 +79,7 @@  discard block
 block discarded – undo
81 79
 
82 80
         /////////////////////////////////////////////////////////
83 81
         // DOES THE USER HAVE A POSTCODE ALREADY SET?
84
-        elseif ($THEUSER->postcode_is_set())
85
-        {
82
+        elseif ($THEUSER->postcode_is_set()) {
86 83
             $member = new Member(array('postcode' => $THEUSER->postcode(), 'house' => HOUSE_TYPE_COMMONS));
87 84
         }
88 85
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
                 $pc = get_http_var('pc');
55 55
                 $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
56 56
                 if (validate_postcode($pc)) {
57
-                    twfy_debug ('MP', "MP lookup by postcode");
57
+                    twfy_debug('MP', "MP lookup by postcode");
58 58
                     $constituency = strtolower(Utility\Postcode::postcodeToConstituency($pc));
59 59
                     if ($constituency == "connection_timed_out") {
60 60
                         throw new \Exception('Sorry, we couldn&rsquo;t check your postcode right now, as our postcode lookup server is under quite a lot of load.');
61 61
                     } elseif ($constituency == "") {
62
-                        twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
62
+                        twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
63 63
                         throw new \Exception('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a known postcode');
64 64
                     } else {
65 65
                         // Generate the Member object
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         }
71 71
                     }
72 72
                 } else {
73
-                    twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
73
+                    twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
74 74
                     throw new \Exception('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a valid postcode');
75 75
                 }
76 76
             } catch (\Exception $e) {
Please login to merge, or discard this patch.
www/docs/topic/index.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 namespace MySociety\TheyWorkForYou;
8 8
 
9 9
 // Disable the old PAGE class.
10
-$new_style_template = TRUE;
10
+$new_style_template = true;
11 11
 global $this_page;
12 12
 $this_page = 'topics';
13 13
 
Please login to merge, or discard this patch.
www/docs/topic/image.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     $topic = $topics->getTopic($slug);
9 9
 }
10 10
 
11
-if (!$slug || !isset($topic) || $topic === NULL) {
11
+if (!$slug || !isset($topic) || $topic === null) {
12 12
     header('HTTP/1.0 404 Not Found');
13 13
     exit();
14 14
 }
Please login to merge, or discard this patch.
www/docs/api/api_getPerson.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 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']);
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
         $URL = new \MySociety\TheyWorkForYou\Url('mp');
29 29
         $row['url'] = $URL->generate('none') . make_member_url($row['full_name'], $row['constituency'], $row['house'], $row['person_id']);
30 30
     }
31
-    if ($has_party && isset($parties[$row['party']]))
32
-        $row['party'] = $parties[$row['party']];
31
+    if ($has_party && isset($parties[$row['party']])) {
32
+            $row['party'] = $parties[$row['party']];
33
+    }
33 34
     list($image,$sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']);
34 35
     if ($image) {
35 36
         list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . '/images/', $image));
@@ -49,7 +50,9 @@  discard block
 block discarded – undo
49 50
     }
50 51
 
51 52
     foreach ($row as $k => $r) {
52
-        if (is_string($r)) $row[$k] = html_entity_decode($r);
53
+        if (is_string($r)) {
54
+            $row[$k] = html_entity_decode($r);
55
+        }
53 56
     }
54 57
 
55 58
     return $row;
@@ -85,8 +88,9 @@  discard block
 block discarded – undo
85 88
         $out = _api_getPerson_row($row, $house == HOUSE_TYPE_ROYAL ? false : true);
86 89
         $output[] = $out;
87 90
         $time = strtotime($row['lastupdate']);
88
-        if ($time > $last_mod)
89
-            $last_mod = $time;
91
+        if ($time > $last_mod) {
92
+                    $last_mod = $time;
93
+        }
90 94
     }
91 95
     # Only one MP, not an array
92 96
     if ($flatten && count($output) == 1 && $house == HOUSE_TYPE_COMMONS) {
@@ -134,13 +138,18 @@  discard block
 block discarded – undo
134 138
 
135 139
     $cons = array();
136 140
     foreach ($constituencies as $constituency) {
137
-        if ($constituency == '') continue;
138
-        if ($constituency == 'Orkney ')
139
-            $constituency = 'Orkney & Shetland';
141
+        if ($constituency == '') {
142
+            continue;
143
+        }
144
+        if ($constituency == 'Orkney ') {
145
+                    $constituency = 'Orkney & Shetland';
146
+        }
140 147
 
141 148
         if ($house == HOUSE_TYPE_COMMONS) {
142 149
             $normalised = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($constituency);
143
-            if ($normalised) $constituency = $normalised;
150
+            if ($normalised) {
151
+                $constituency = $normalised;
152
+            }
144 153
         }
145 154
 
146 155
         $cons[] = $constituency;
Please login to merge, or discard this 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']);
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     }
31 31
     if ($has_party && isset($parties[$row['party']]))
32 32
         $row['party'] = $parties[$row['party']];
33
-    list($image,$sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']);
33
+    list($image, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']);
34 34
     if ($image) {
35 35
         list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . '/images/', $image));
36 36
         $row['image'] = $image;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     return $row;
56 56
 }
57 57
 
58
-function api_getPerson_id($id, $house='') {
58
+function api_getPerson_id($id, $house = '') {
59 59
     $db = new ParlDB;
60 60
     $params = array(
61 61
         ':person_id' => $id
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     }
78 78
 }
79 79
 
80
-function _api_getPerson_output($q, $flatten=false) {
80
+function _api_getPerson_output($q, $flatten = false) {
81 81
     $output = array();
82 82
     $last_mod = 0;
83 83
     $house = null;
Please login to merge, or discard this patch.
www/docs/api/api_functions.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -338,7 +338,7 @@
 block discarded – undo
338 338
       // and then catch any errors in the conversion and just ignore
339 339
       // them and return the unconverted results
340 340
       $converted_out = @iconv('utf-8', 'iso-8859-1//TRANSLIT', $out);
341
-      if ($converted_out !== FALSE) {
341
+      if ($converted_out !== false) {
342 342
         $out = $converted_out;
343 343
       }
344 344
     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 # Key-related functions
133 133
 
134 134
 function api_log_call($key) {
135
-    if ($key=='DOCS') return;
135
+    if ($key == 'DOCS') return;
136 136
     $ip = $_SERVER['REMOTE_ADDR'];
137 137
     $query = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
138 138
     $query = preg_replace('#key=[A-Za-z0-9]+&?#', '', $query);
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 
198 198
 # Output functions
199 199
 
200
-function api_output($arr, $last_mod=null) {
200
+function api_output($arr, $last_mod = null) {
201 201
     $output = get_http_var('output');
202 202
     if (!get_http_var('docs')) {
203 203
         $cond = api_header($output, $last_mod);
204 204
         if ($cond) return;
205 205
     }
206 206
     if ($output == 'xml') {
207
-        $out = '<?xml version="1.0" encoding="utf-8"?>'."\n";
207
+        $out = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
208 208
         $out .= '<twfy>' . api_output_xml($arr) . '</twfy>';
209 209
     } elseif ($output == 'php') {
210 210
         $out = api_output_php($arr);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     print $out;
223 223
 }
224 224
 
225
-function api_header($o, $last_mod=null) {
225
+function api_header($o, $last_mod = null) {
226 226
     if ($last_mod && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
227 227
         $t = cond_parse_http_date($_SERVER['HTTP_IF_MODIFIED_SINCE']);
228 228
         if (isset($t) && $t >= $last_mod) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     }
249 249
     #$type = 'text/plain';
250 250
     header("Content-Type: $type; charset=$charset");
251
-    if ($last_mod>0)
251
+    if ($last_mod > 0)
252 252
         header('Last-Modified: ' . date('r', $last_mod));
253 253
     return false;
254 254
 }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     global $api_xml_arr;
276 276
     $verbose = get_http_var('verbose') ? "\n" : '';
277 277
     if (is_array($v)) {
278
-        if (count($v) && array_keys($v) === range(0, count($v)-1)) {
278
+        if (count($v) && array_keys($v) === range(0, count($v) - 1)) {
279 279
             $elt = 'match';
280 280
             $api_xml_arr++;
281 281
             $out = "<$elt>";
@@ -296,36 +296,36 @@  discard block
 block discarded – undo
296 296
     }
297 297
 }
298 298
 
299
-function api_output_js($v, $level=0) {
299
+function api_output_js($v, $level = 0) {
300 300
     $verbose = get_http_var('verbose') ? "\n" : '';
301 301
     $out = '';
302 302
     if (is_array($v)) {
303 303
         # PHP arrays are both JS arrays and objects
304
-        if (count($v) && array_keys($v) === range(0, count($v)-1)) {
305
-            $out = '[' . join(",$verbose" , array_map('api_output_js', $v)) . ']';
304
+        if (count($v) && array_keys($v) === range(0, count($v) - 1)) {
305
+            $out = '[' . join(",$verbose", array_map('api_output_js', $v)) . ']';
306 306
         } else {
307 307
             $out = '{' . $verbose;
308 308
             $b = false;
309 309
             foreach ($v as $k => $vv) {
310 310
                 if ($b) $out .= ",$verbose";
311 311
                 if ($verbose) {
312
-                    $out .= str_repeat(' ', ($level+1)*2);
312
+                    $out .= str_repeat(' ', ($level + 1) * 2);
313 313
                     $out .= '"' . $k . '" : ';
314 314
                 } else {
315 315
                     $out .= '"' . $k . '":';
316 316
                 }
317
-                $out .= api_output_js($vv, $level+1);
317
+                $out .= api_output_js($vv, $level + 1);
318 318
                 $b = true;
319 319
             }
320
-            if ($verbose) $out .= "\n" . str_repeat(' ', $level*2);
320
+            if ($verbose) $out .= "\n" . str_repeat(' ', $level * 2);
321 321
             $out .= '}';
322 322
         }
323 323
     } elseif (is_null($v)) {
324 324
         $out = "null";
325 325
     } elseif (is_string($v)) {
326 326
         $out = '"' . str_replace(
327
-            array("\\",'"',"\n","\t","\r", "‶", "″", "“", "”"),
328
-            array("\\\\",'\"','\n','\t','\r', '\"', '\"', '\"', '\"'), $v) . '"';
327
+            array("\\", '"', "\n", "\t", "\r", "‶", "″", "“", "”"),
328
+            array("\\\\", '\"', '\n', '\t', '\r', '\"', '\"', '\"', '\"'), $v) . '"';
329 329
     } elseif (is_bool($v)) {
330 330
         $out = $v ? 'true' : 'false';
331 331
     } elseif (is_int($v) || is_float($v)) {
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 }
147 147
 
148 148
 function api_is_superuser_key($key) {
149
-  $db = new ParlDB;
150
-  $q = $db->query('SELECT api_key.user_id, users.status
149
+    $db = new ParlDB;
150
+    $q = $db->query('SELECT api_key.user_id, users.status
151 151
                FROM   api_key, users
152 152
                WHERE  users.user_id = api_key.user_id
153 153
                AND    api_key.api_key = :key', array(
154 154
                 ':key' => $key
155 155
                 ))->first();
156
-  if (!$q) {
156
+    if (!$q) {
157 157
     return false;
158
-  }
159
-  if ($q['status'] == 'Superuser') {
158
+    }
159
+    if ($q['status'] == 'Superuser') {
160 160
     return true;
161
-  } 
162
-  return false;
161
+    } 
162
+    return false;
163 163
 }
164 164
 
165 165
 function api_check_key($key) {
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
     // we only want to convert to iso if it's an actual API call
339 339
     // so skip this if it's a documentation page
340 340
     if (!get_http_var('docs')) {
341
-      // and then catch any errors in the conversion and just ignore
342
-      // them and return the unconverted results
343
-      $converted_out = @iconv('utf-8', 'iso-8859-1//TRANSLIT', $out);
344
-      if ($converted_out !== FALSE) {
341
+        // and then catch any errors in the conversion and just ignore
342
+        // them and return the unconverted results
343
+        $converted_out = @iconv('utf-8', 'iso-8859-1//TRANSLIT', $out);
344
+        if ($converted_out !== FALSE) {
345 345
         $out = $converted_out;
346
-      }
346
+        }
347 347
     }
348 348
 
349 349
     return $out;
Please login to merge, or discard this patch.
Braces   +31 added lines, -16 removed lines patch added patch discarded remove patch
@@ -132,7 +132,9 @@  discard block
 block discarded – undo
132 132
 # Key-related functions
133 133
 
134 134
 function api_log_call($key) {
135
-    if ($key=='DOCS') return;
135
+    if ($key=='DOCS') {
136
+        return;
137
+    }
136 138
     $ip = $_SERVER['REMOTE_ADDR'];
137 139
     $query = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
138 140
     $query = preg_replace('#key=[A-Za-z0-9]+&?#', '', $query);
@@ -204,7 +206,9 @@  discard block
 block discarded – undo
204 206
     $output = get_http_var('output');
205 207
     if (!get_http_var('docs')) {
206 208
         $cond = api_header($output, $last_mod);
207
-        if ($cond) return;
209
+        if ($cond) {
210
+            return;
211
+        }
208 212
     }
209 213
     if ($output == 'xml') {
210 214
         $out = '<?xml version="1.0" encoding="utf-8"?>'."\n";
@@ -215,7 +219,8 @@  discard block
 block discarded – undo
215 219
         $out = api_output_rabx($arr);
216 220
     } elseif ($output == 'json') {
217 221
         $out = json_encode($arr, JSON_PRETTY_PRINT);
218
-    } else { # JS
222
+    } else {
223
+# JS
219 224
         $out = api_output_js($arr);
220 225
         $callback = get_http_var('callback');
221 226
         if (preg_match('#^[A-Za-z0-9._[\]]+$#', $callback)) {
@@ -251,8 +256,9 @@  discard block
 block discarded – undo
251 256
     }
252 257
     #$type = 'text/plain';
253 258
     header("Content-Type: $type; charset=$charset");
254
-    if ($last_mod>0)
255
-        header('Last-Modified: ' . date('r', $last_mod));
259
+    if ($last_mod>0) {
260
+            header('Last-Modified: ' . date('r', $last_mod));
261
+    }
256 262
     return false;
257 263
 }
258 264
 
@@ -262,14 +268,18 @@  discard block
 block discarded – undo
262 268
 
263 269
 function api_output_php($arr) {
264 270
     $out = serialize($arr);
265
-    if (get_http_var('verbose')) $out = str_replace(';', ";\n", $out);
271
+    if (get_http_var('verbose')) {
272
+        $out = str_replace(';', ";\n", $out);
273
+    }
266 274
     return $out;
267 275
 }
268 276
 
269 277
 function api_output_rabx($arr) {
270 278
     $out = '';
271 279
     rabx_wire_wr($arr, $out);
272
-    if (get_http_var('verbose')) $out = str_replace(',', ",\n", $out);
280
+    if (get_http_var('verbose')) {
281
+        $out = str_replace(',', ",\n", $out);
282
+    }
273 283
     return $out;
274 284
 }
275 285
 
@@ -310,7 +320,9 @@  discard block
 block discarded – undo
310 320
             $out = '{' . $verbose;
311 321
             $b = false;
312 322
             foreach ($v as $k => $vv) {
313
-                if ($b) $out .= ",$verbose";
323
+                if ($b) {
324
+                    $out .= ",$verbose";
325
+                }
314 326
                 if ($verbose) {
315 327
                     $out .= str_repeat(' ', ($level+1)*2);
316 328
                     $out .= '"' . $k . '" : ';
@@ -320,7 +332,9 @@  discard block
 block discarded – undo
320 332
                 $out .= api_output_js($vv, $level+1);
321 333
                 $b = true;
322 334
             }
323
-            if ($verbose) $out .= "\n" . str_repeat(' ', $level*2);
335
+            if ($verbose) {
336
+                $out .= "\n" . str_repeat(' ', $level*2);
337
+            }
324 338
             $out .= '}';
325 339
         }
326 340
     } elseif (is_null($v)) {
@@ -352,13 +366,14 @@  discard block
 block discarded – undo
352 366
 # Call an API function
353 367
 
354 368
 function api_call_user_func_or_error($function, $params, $error, $type) {
355
-    if (function_exists($function))
356
-        call_user_func_array($function, $params);
357
-    elseif ($type == 'api')
358
-        api_error($error);
359
-    else
360
-        print "<p style='color:#cc0000'>$error</p>";
361
-}
369
+    if (function_exists($function)) {
370
+            call_user_func_array($function, $params);
371
+    } elseif ($type == 'api') {
372
+            api_error($error);
373
+    } else {
374
+            print "<p style='color:#cc0000'>$error</p>";
375
+    }
376
+    }
362 377
 
363 378
 # Used for testing for conditional responses
364 379
 
Please login to merge, or discard this patch.