Failed Conditions
Pull Request — master (#1326)
by Nick
60:22 queued 50:08
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.
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.
Braces   +11 added lines, -10 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 {
@@ -58,10 +56,12 @@  discard block
 block discarded – undo
58 56
                     $constituency = strtolower(Utility\Postcode::postcodeToConstituency($pc));
59 57
                     if ($constituency == "connection_timed_out") {
60 58
                         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
-                    } elseif ($constituency == "") {
59
+                    }
60
+                    elseif ($constituency == "") {
62 61
                         twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
63 62
                         throw new Exception('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a known postcode');
64
-                    } else {
63
+                    }
64
+                    else {
65 65
                         // Generate the Member object
66 66
                         $member = new Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS));
67 67
                         if ($member->person_id()) {
@@ -69,7 +69,8 @@  discard block
 block discarded – undo
69 69
                             $THEUSER->set_postcode_cookie($pc);
70 70
                         }
71 71
                     }
72
-                } else {
72
+                }
73
+                else {
73 74
                     twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
74 75
                     throw new Exception('Sorry, ' . _htmlentities($pc) . ' isn&rsquo;t a valid postcode');
75 76
                 }
@@ -81,8 +82,7 @@  discard block
 block discarded – undo
81 82
 
82 83
         /////////////////////////////////////////////////////////
83 84
         // DOES THE USER HAVE A POSTCODE ALREADY SET?
84
-        elseif ($THEUSER->postcode_is_set())
85
-        {
85
+        elseif ($THEUSER->postcode_is_set()) {
86 86
             $member = new Member(array('postcode' => $THEUSER->postcode(), 'house' => HOUSE_TYPE_COMMONS));
87 87
         }
88 88
 
@@ -122,7 +122,8 @@  discard block
 block discarded – undo
122 122
     // Send for rendering!
123 123
     Renderer::output('topic/topic', $data);
124 124
 
125
-} else {
125
+}
126
+else {
126 127
 
127 128
     header('HTTP/1.0 404 Not Found');
128 129
     Renderer::output('topic/error', array('error' => 'Sorry, but there isn&rsquo;t a topic page by that name.'));
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 4 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.
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -77,6 +77,9 @@  discard block
 block discarded – undo
77 77
     }
78 78
 }
79 79
 
80
+/**
81
+ * @param MySociety\TheyWorkForYou\Db\Query $q
82
+ */
80 83
 function _api_getPerson_output($q, $flatten=false) {
81 84
     $output = array();
82 85
     $last_mod = 0;
@@ -95,10 +98,16 @@  discard block
 block discarded – undo
95 98
     api_output($output, $last_mod);
96 99
 }
97 100
 
101
+/**
102
+ * @param integer $house
103
+ */
98 104
 function api_getPerson_constituency($constituency, $house) {
99 105
     _api_getPerson_constituency(array($constituency), $house);
100 106
 }
101 107
 
108
+/**
109
+ * @param integer $house
110
+ */
102 111
 function api_getPerson_postcode($pc, $house) {
103 112
     $pc = preg_replace('#[^a-z0-9 ]#i', '', $pc);
104 113
     $types = array();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         # Ministerialships and Select Committees
44 44
         $db = new ParlDB;
45 45
         $q = $db->query('SELECT * FROM moffice WHERE to_date="9999-12-31" and person=' . $row['person_id'] . ' ORDER BY from_date DESC');
46
-        for ($i=0; $i<$q->rows(); $i++) {
46
+        for ($i = 0; $i < $q->rows(); $i++) {
47 47
             $row['office'][] = $q->row($i);
48 48
         }
49 49
     }
@@ -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,10 +77,10 @@  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
-    for ($i=0; $i<$q->rows(); $i++) {
83
+    for ($i = 0; $i < $q->rows(); $i++) {
84 84
         $house = $q->field($i, 'house');
85 85
         $out = _api_getPerson_row($q->row($i), $house == HOUSE_TYPE_ROYAL ? false : true);
86 86
         $output[] = $out;
Please login to merge, or discard this patch.
Braces   +34 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
         $URL = new 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;
@@ -72,7 +75,8 @@  discard block
 block discarded – undo
72 75
         order by left_house desc", $params);
73 76
     if ($q->rows()) {
74 77
         _api_getPerson_output($q);
75
-    } else {
78
+    }
79
+    else {
76 80
         api_error('Unknown person ID');
77 81
     }
78 82
 }
@@ -85,8 +89,9 @@  discard block
 block discarded – undo
85 89
         $out = _api_getPerson_row($q->row($i), $house == HOUSE_TYPE_ROYAL ? false : true);
86 90
         $output[] = $out;
87 91
         $time = strtotime($q->field($i, 'lastupdate'));
88
-        if ($time > $last_mod)
89
-            $last_mod = $time;
92
+        if ($time > $last_mod) {
93
+                    $last_mod = $time;
94
+        }
90 95
     }
91 96
     # Only one MP, not an array
92 97
     if ($flatten && count($output) == 1 && $house == HOUSE_TYPE_COMMONS) {
@@ -104,24 +109,30 @@  discard block
 block discarded – undo
104 109
     $types = array();
105 110
     if ($house == HOUSE_TYPE_NI) {
106 111
         $types = array('NIE');
107
-    } elseif ($house == HOUSE_TYPE_SCOTLAND) {
112
+    }
113
+    elseif ($house == HOUSE_TYPE_SCOTLAND) {
108 114
         $types = array('SPC', 'SPE');
109 115
     }
110 116
     if (validate_postcode($pc)) {
111 117
         $constituencies = MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($pc);
112 118
         if ($constituencies == 'CONNECTION_TIMED_OUT') {
113 119
             api_error('Connection timed out');
114
-        } elseif ($types && isset($constituencies[$types[0]])) {
120
+        }
121
+        elseif ($types && isset($constituencies[$types[0]])) {
115 122
             $constituencies = array_map(function($c) use ($constituencies) { return $constituencies[$c]; }, $types);
116 123
             _api_getPerson_constituency($constituencies, $house);
117
-        } elseif ($types && isset($constituencies['WMC'])) {
124
+        }
125
+        elseif ($types && isset($constituencies['WMC'])) {
118 126
             api_error('Postcode not in correct region');
119
-        } elseif (isset($constituencies['WMC'])) {
127
+        }
128
+        elseif (isset($constituencies['WMC'])) {
120 129
             _api_getPerson_constituency(array($constituencies['WMC']), $house);
121
-        } else {
130
+        }
131
+        else {
122 132
             api_error('Unknown postcode');
123 133
         }
124
-    } else {
134
+    }
135
+    else {
125 136
         api_error('Invalid postcode');
126 137
     }
127 138
 }
@@ -134,13 +145,18 @@  discard block
 block discarded – undo
134 145
 
135 146
     $cons = array();
136 147
     foreach ($constituencies as $constituency) {
137
-        if ($constituency == '') continue;
138
-        if ($constituency == 'Orkney ')
139
-            $constituency = 'Orkney & Shetland';
148
+        if ($constituency == '') {
149
+            continue;
150
+        }
151
+        if ($constituency == 'Orkney ') {
152
+                    $constituency = 'Orkney & Shetland';
153
+        }
140 154
 
141 155
         if ($house == HOUSE_TYPE_COMMONS) {
142 156
             $normalised = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($constituency);
143
-            if ($normalised) $constituency = $normalised;
157
+            if ($normalised) {
158
+                $constituency = $normalised;
159
+            }
144 160
         }
145 161
 
146 162
         $cons[] = $constituency;
@@ -167,7 +183,8 @@  discard block
 block discarded – undo
167 183
 
168 184
     if ($q->rows > 0) {
169 185
         _api_getPerson_output($q, true);
170
-    } else {
186
+    }
187
+    else {
171 188
         api_error('Unknown constituency, or no results for that constituency');
172 189
     }
173 190
 }
Please login to merge, or discard this patch.
www/docs/admin/featured.php 3 patches
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
     $related2 = get_http_var('related2');
108 108
     $related3 = get_http_var('related3');
109 109
 
110
-    $gid = $url ? get_gid_from_url($url) : NULL;
111
-    $related_gid1 = $related1 ? get_gid_from_url($related1) : NULL;
112
-    $related_gid2 = $related2 ? get_gid_from_url($related2) : NULL;
113
-    $related_gid3 = $related3 ? get_gid_from_url($related3) : NULL;
110
+    $gid = $url ? get_gid_from_url($url) : null;
111
+    $related_gid1 = $related1 ? get_gid_from_url($related1) : null;
112
+    $related_gid2 = $related2 ? get_gid_from_url($related2) : null;
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 118
         $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 ));
119 119
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 }
154 154
 
155 155
 function get_gid_from_url($url) {
156
-    $gid = NULL;
156
+    $gid = null;
157 157
     $parts = parse_url($url);
158 158
     parse_str($parts['query'], $query);
159 159
 
Please login to merge, or discard this 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 ));
32
+    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid));
33 33
     $url_gid = fix_gid_from_db($gid);
34 34
     $url = new \URL($hansardmajors[$q->field(0, 'major')]['page']);
35 35
     $url->insert(array('id' => $url_gid));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     $related = $featured->get_related();
44 44
     $context = $featured->get_context();
45 45
 
46
-    if ( get_http_var('url') ) {
46
+    if (get_http_var('url')) {
47 47
         $url = get_http_var('url');
48 48
         $title = get_http_var('title');
49 49
         $context = get_http_var('context');
@@ -113,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.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  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
+}
16
+else if ( get_http_var('confirm') ) {
16 17
     $out = update_featured();
17 18
 }
18 19
 
@@ -50,7 +51,8 @@  discard block
 block discarded – undo
50 51
         $related1 = get_http_var('related1');
51 52
         $related2 = get_http_var('related2');
52 53
         $related3 = get_http_var('related3');
53
-    } else {
54
+    }
55
+    else {
54 56
         $url = gid_to_url($gid);
55 57
         $related1 = gid_to_url($related[0]);
56 58
         $related2 = gid_to_url($related[1]);
@@ -118,7 +120,8 @@  discard block
 block discarded – undo
118 120
         $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 ));
119 121
 
120 122
         include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php';
121
-    } else {
123
+    }
124
+    else {
122 125
         print "<p>A random debate from the last 7 days will be displayed</p>";
123 126
     }
124 127
 
@@ -160,9 +163,11 @@  discard block
 block discarded – undo
160 163
     if ( $query['id'] ) {
161 164
         if (strpos($parts['path'], 'lords') !== false) {
162 165
             $gid = 'uk.org.publicwhip/lords/';
163
-        } elseif (strpos($parts['path'], 'whall') !== false) {
166
+        }
167
+        elseif (strpos($parts['path'], 'whall') !== false) {
164 168
             $gid = 'uk.org.publicwhip/westminhall/';
165
-        } else {
169
+        }
170
+        else {
166 171
             $gid = 'uk.org.publicwhip/debate/';
167 172
         }
168 173
         $gid .= $query['id'];
Please login to merge, or discard this patch.