@@ -77,6 +77,9 @@ discard block |
||
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 |
||
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(); |
@@ -28,8 +28,9 @@ discard block |
||
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 |
||
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 |
||
85 | 88 | $out = _api_getPerson_row($q->row($i), $house == HOUSE_TYPE_ROYAL ? false : true); |
86 | 89 | $output[] = $out; |
87 | 90 | $time = strtotime($q->field($i, '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 |
||
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; |
@@ -92,7 +92,7 @@ |
||
92 | 92 | include_once (INCLUDESPATH."easyparliament/user.php"); |
93 | 93 | |
94 | 94 | // Test to see if this is a new-style template using the renderer class. |
95 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
95 | +if (! isset($new_style_template) or $new_style_template !== true) { |
|
96 | 96 | |
97 | 97 | // This is an old-style page. Use the old page classes. |
98 | 98 | include_once (INCLUDESPATH."easyparliament/page.php"); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | First some things to help make our PHP nicer and betterer |
5 | 5 | ********************************************************************************/ |
6 | 6 | |
7 | -error_reporting (E_ALL); |
|
7 | +error_reporting(E_ALL); |
|
8 | 8 | |
9 | 9 | /******************************************************************************** |
10 | 10 | Now some constants that are the same for live and dev versions |
@@ -12,22 +12,22 @@ discard block |
||
12 | 12 | ********************************************************************************/ |
13 | 13 | |
14 | 14 | // In case we need to switch these off globally at some point... |
15 | -define ("ALLOWCOMMENTS", true); |
|
16 | -define ("ALLOWTRACKBACKS", true); |
|
15 | +define("ALLOWCOMMENTS", true); |
|
16 | +define("ALLOWTRACKBACKS", true); |
|
17 | 17 | |
18 | 18 | // These variables are so we can keep date/time formats consistent across the site |
19 | 19 | // and change them easily. |
20 | 20 | // Formats here: http://www.php.net/manual/en/function.date.php |
21 | -define ("LONGERDATEFORMAT", "l, j F Y");// Monday, 31 December 2003 |
|
22 | -define ("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
23 | -define ("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
24 | -define ("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
21 | +define("LONGERDATEFORMAT", "l, j F Y"); // Monday, 31 December 2003 |
|
22 | +define("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
23 | +define("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
24 | +define("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
25 | 25 | |
26 | -define ("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
27 | -define ("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
26 | +define("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
27 | +define("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
28 | 28 | |
29 | 29 | // Where we store the postcode of users if they search for an MP by postcode. |
30 | -define ('POSTCODE_COOKIE', 'eppc'); |
|
30 | +define('POSTCODE_COOKIE', 'eppc'); |
|
31 | 31 | |
32 | 32 | /******************************************************************************** |
33 | 33 | And now all the files we'll include on every page. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | twfy_debug_timestamp("after including utility.php"); |
42 | 42 | |
43 | 43 | // Set the default timezone |
44 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
44 | +if (function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
45 | 45 | |
46 | 46 | // Only do clever things with errors if we're not testing, otherwise show as default |
47 | 47 | |
@@ -70,40 +70,40 @@ discard block |
||
70 | 70 | |
71 | 71 | // The time the page starts, so we can display the total at the end. |
72 | 72 | // getmicrotime() is in utiltity.php. |
73 | -define ("STARTTIME", getmicrotime()); |
|
73 | +define("STARTTIME", getmicrotime()); |
|
74 | 74 | if (!isset($_SERVER['WINDIR'])) { |
75 | 75 | $rusage = getrusage(); |
76 | - define ('STARTTIMES', $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec']); |
|
77 | - define ('STARTTIMEU', $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec']); |
|
76 | + define('STARTTIMES', $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec']); |
|
77 | + define('STARTTIMEU', $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec']); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $DATA = new \MySociety\TheyWorkForYou\Data; |
81 | 81 | |
82 | 82 | class ParlDB extends \MySociety\TheyWorkForYou\Db\Connection { |
83 | 83 | public function __construct() { |
84 | - $this->init (OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
84 | + $this->init(OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | 88 | $filter = new \MySociety\TheyWorkForYou\Utility\LibFilter; |
89 | 89 | |
90 | -include_once (INCLUDESPATH."easyparliament/user.php"); |
|
90 | +include_once (INCLUDESPATH . "easyparliament/user.php"); |
|
91 | 91 | |
92 | 92 | // Test to see if this is a new-style template using the renderer class. |
93 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
93 | +if (!isset($new_style_template) OR $new_style_template !== TRUE) { |
|
94 | 94 | |
95 | 95 | // This is an old-style page. Use the old page classes. |
96 | - include_once (INCLUDESPATH."easyparliament/page.php"); |
|
96 | + include_once (INCLUDESPATH . "easyparliament/page.php"); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | -include_once (INCLUDESPATH."easyparliament/hansardlist.php"); |
|
101 | -include_once (INCLUDESPATH."dbtypes.php"); |
|
102 | -include_once (INCLUDESPATH."easyparliament/commentlist.php"); |
|
103 | -include_once (INCLUDESPATH."easyparliament/comment.php"); |
|
104 | -include_once (INCLUDESPATH."easyparliament/trackback.php"); |
|
100 | +include_once (INCLUDESPATH . "easyparliament/hansardlist.php"); |
|
101 | +include_once (INCLUDESPATH . "dbtypes.php"); |
|
102 | +include_once (INCLUDESPATH . "easyparliament/commentlist.php"); |
|
103 | +include_once (INCLUDESPATH . "easyparliament/comment.php"); |
|
104 | +include_once (INCLUDESPATH . "easyparliament/trackback.php"); |
|
105 | 105 | |
106 | 106 | // Added in as new module by Richard Allan MP |
107 | -include_once (INCLUDESPATH."easyparliament/alert.php"); |
|
107 | +include_once (INCLUDESPATH . "easyparliament/alert.php"); |
|
108 | 108 | |
109 | 109 | twfy_debug_timestamp("at end of init.php"); |
@@ -114,7 +114,10 @@ discard block |
||
114 | 114 | // 'foot' - For the bottom stripe on hansard debates/wrans listings. |
115 | 115 | // $id is the value of an id for this div (if blank, not used). |
116 | 116 | ?> |
117 | - <div class="stripe-<?php echo $type; ?><?php if ($extra_class != '') echo ' ' . $extra_class; ?>"<?php |
|
117 | + <div class="stripe-<?php echo $type; ?><?php if ($extra_class != '') { |
|
118 | + echo ' ' . $extra_class; |
|
119 | +} |
|
120 | +?>"<?php |
|
118 | 121 | if ($id != '') { |
119 | 122 | print ' id="' . $id . '"'; |
120 | 123 | } |
@@ -479,7 +482,9 @@ discard block |
||
479 | 482 | |
480 | 483 | global $DATA, $this_page; |
481 | 484 | |
482 | - if ($this->page_started()) return; |
|
485 | + if ($this->page_started()) { |
|
486 | + return; |
|
487 | + } |
|
483 | 488 | // The page's HTML hasn't been started yet, so we'd better do it. |
484 | 489 | |
485 | 490 | // Set the page title (in the <title></title>). |
@@ -629,7 +634,9 @@ discard block |
||
629 | 634 | $URL->insert(array('adv' => 1)); |
630 | 635 | echo ' <a href="' . $URL->generate() . '">More options</a>'; |
631 | 636 | echo '<br>'; |
632 | - if ($wtt) print '<input type="hidden" name="wtt" value="1">'; |
|
637 | + if ($wtt) { |
|
638 | + print '<input type="hidden" name="wtt" value="1">'; |
|
639 | + } |
|
633 | 640 | } else { ?> |
634 | 641 | <form action="http://www.writetothem.com/lords" method="get"> |
635 | 642 | <input type="hidden" name="pid" value="<?=_htmlentities(get_http_var('pid')) ?>"> |
@@ -743,8 +750,7 @@ discard block |
||
743 | 750 | // The return url for after the user has logged in. |
744 | 751 | if (get_http_var("ret") != "") { |
745 | 752 | $returl = get_http_var("ret"); |
746 | - } |
|
747 | - else { |
|
753 | + } else { |
|
748 | 754 | $returl = $glossary_returl; |
749 | 755 | } |
750 | 756 | ?> |
@@ -808,15 +814,13 @@ discard block |
||
808 | 814 | else { |
809 | 815 | $letters[] = "<li class=\"on\">" . $letter . "</li>"; |
810 | 816 | } |
811 | - } |
|
812 | - elseif (!empty($GLOSSARY->alphabet[$letter])) { |
|
817 | + } elseif (!empty($GLOSSARY->alphabet[$letter])) { |
|
813 | 818 | $URL = new \MySociety\TheyWorkForYou\Url('glossary'); |
814 | 819 | $URL->insert(array('az' => $letter)); |
815 | 820 | $letter_link = $URL->generate('url'); |
816 | 821 | |
817 | 822 | $letters[] = "<li><a href=\"" . $letter_link . "\">" . $letter . "</a></li>"; |
818 | - } |
|
819 | - else { |
|
823 | + } else { |
|
820 | 824 | $letters[] = '<li>' . $letter . '</li>'; |
821 | 825 | } |
822 | 826 | } |
@@ -856,8 +860,7 @@ discard block |
||
856 | 860 | $URL->insert(array("delete_confirm" => $term['glossary_id'])); |
857 | 861 | $delete_url = $URL->generate(); |
858 | 862 | $admin_links = "<br><small><a href=\"".$delete_url."\">delete</a></small>"; |
859 | - } |
|
860 | - else { |
|
863 | + } else { |
|
861 | 864 | $admin_links = ""; |
862 | 865 | } |
863 | 866 | |
@@ -867,8 +870,7 @@ discard block |
||
867 | 870 | $user_link = $URL->generate('url'); |
868 | 871 | |
869 | 872 | $user_details = "\t\t\t\t<p><small>contributed by user <a href=\"" . $user_link . "\">" . $term['firstname'] . " " . $term['lastname'] . "</a></small>" . $admin_links . "</p>\n"; |
870 | - } |
|
871 | - else { |
|
873 | + } else { |
|
872 | 874 | $user_details = ""; |
873 | 875 | } |
874 | 876 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public $within_stripe_sidebar = false; |
20 | 20 | |
21 | 21 | public function page_start() { |
22 | - if ( !$this->page_started() ) { |
|
22 | + if (!$this->page_started()) { |
|
23 | 23 | $this->checkForAdmin(); |
24 | 24 | $this->displayHeader(); |
25 | 25 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $data = $h->data; |
34 | 34 | $data = array_merge($u->data, $data); |
35 | - if ( isset($page_errors) ) { |
|
35 | + if (isset($page_errors)) { |
|
36 | 36 | $data['page_errors'] = $page_errors; |
37 | 37 | } |
38 | 38 | $data['banner_text'] = ''; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $THISPAGE = new \MySociety\TheyWorkForYou\Url($this_page); |
53 | 53 | |
54 | 54 | $LOGINURL = new \MySociety\TheyWorkForYou\Url('userlogin'); |
55 | - $LOGINURL->insert(array('ret' => $THISPAGE->generate('none') )); |
|
55 | + $LOGINURL->insert(array('ret' => $THISPAGE->generate('none'))); |
|
56 | 56 | |
57 | 57 | $text = "<a href=\"" . $LOGINURL->generate() . "\">You'd better sign in!</a>"; |
58 | 58 | } else { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | public function page_end() { |
70 | - if ( !$this->page_started() ) { |
|
70 | + if (!$this->page_started()) { |
|
71 | 71 | $this->page_start(); |
72 | 72 | } |
73 | 73 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - public function stripe_start($type='side', $id='', $extra_class = '') { |
|
104 | + public function stripe_start($type = 'side', $id = '', $extra_class = '') { |
|
105 | 105 | // $type is one of: |
106 | 106 | // 'full' - a full width div |
107 | 107 | // 'side' - a white stripe with a coloured sidebar. |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | - public function stripe_end ($contents = array(), $extra = '') { |
|
134 | + public function stripe_end($contents = array(), $extra = '') { |
|
135 | 135 | // $contents is an array containing 0 or more hashes. |
136 | 136 | // Each hash has two values, 'type' and 'content'. |
137 | 137 | // 'Type' could be one of these: |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | public function include_sidebar_template($sidebarname) { |
235 | 235 | global $this_page, $DATA; |
236 | 236 | |
237 | - $sidebarpath = INCLUDESPATH.'easyparliament/sidebars/'.$sidebarname.'.php'; |
|
237 | + $sidebarpath = INCLUDESPATH . 'easyparliament/sidebars/' . $sidebarname . '.php'; |
|
238 | 238 | |
239 | 239 | if (file_exists($sidebarpath)) { |
240 | 240 | include $sidebarpath; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | |
245 | - public function block_start($data=array()) { |
|
245 | + public function block_start($data = array()) { |
|
246 | 246 | // Starts a 'block' div, used mostly on the home page, |
247 | 247 | // on the MP page, and in the sidebars. |
248 | 248 | // $data is a hash like this: |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | if (is_string($message)) { |
390 | 390 | // Sometimes we're just sending a single line to this function |
391 | 391 | // rather like the bigger array... |
392 | - $message = array ( |
|
392 | + $message = array( |
|
393 | 393 | 'text' => $message |
394 | 394 | ); |
395 | 395 | } |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | // if the page has started then we're most likely in an old school page |
398 | 398 | // so we should just print out the error, otherwise stick it in the error |
399 | 399 | // global which will then be displayed by the header template |
400 | - if ( $this->page_started() ) { |
|
400 | + if ($this->page_started()) { |
|
401 | 401 | $this->message($message, 'error'); |
402 | 402 | } else { |
403 | - if ( !isset($page_errors) ) { |
|
403 | + if (!isset($page_errors)) { |
|
404 | 404 | $page_errors = array(); |
405 | 405 | } |
406 | - $page_errors[] = $message; |
|
406 | + $page_errors[] = $message; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if ($fatal) { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | |
423 | - public function message($message, $class='') { |
|
423 | + public function message($message, $class = '') { |
|
424 | 424 | // Generates a very simple but common page content. |
425 | 425 | // Used for when a user logs out, or votes, or any simple thing |
426 | 426 | // where there's a little message and probably a link elsewhere. |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | if ($page_title != '') { |
499 | 499 | $page_title .= ': '; |
500 | 500 | } |
501 | - $page_title .= format_date ($info['date'], SHORTDATEFORMAT); |
|
501 | + $page_title .= format_date($info['date'], SHORTDATEFORMAT); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | if ($page_title != '') { |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | if (isset($nextprev['up'])) { |
555 | 555 | |
556 | - $uplink = '<span class="up"><a href="' . $nextprev['up']['url'] . '" title="' . $nextprev['up']['title'] . '">' . $nextprev['up']['body'] . '</a>'; |
|
556 | + $uplink = '<span class="up"><a href="' . $nextprev['up']['url'] . '" title="' . $nextprev['up']['title'] . '">' . $nextprev['up']['body'] . '</a>'; |
|
557 | 557 | if (get_http_var('s')) { |
558 | 558 | $URL = new \MySociety\TheyWorkForYou\Url($this_page); |
559 | 559 | $uplink .= '<br><a href="' . $URL->generate() . '">Remove highlighting</a>'; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | $next = $nextprev['next']; |
569 | 569 | |
570 | 570 | if (isset($next['url'])) { |
571 | - $nextlink = '<a href="' . $next['url'] . '" title="' . $next['title'] . '" class="linkbutton">' . $next['body'] . ' »</a>'; |
|
571 | + $nextlink = '<a href="' . $next['url'] . '" title="' . $next['title'] . '" class="linkbutton">' . $next['body'] . ' »</a>'; |
|
572 | 572 | } else { |
573 | 573 | $nextlink = $next['body'] . ' »'; |
574 | 574 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | } |
586 | 586 | |
587 | 587 | |
588 | - public function search_form($value='') { |
|
588 | + public function search_form($value = '') { |
|
589 | 589 | global $SEARCHENGINE; |
590 | 590 | // Search box on the search page. |
591 | 591 | // If $value is set then it will be displayed in the form. |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | echo '<div class="mainsearchbox">'; |
618 | - if ($wtt<2) { |
|
618 | + if ($wtt < 2) { |
|
619 | 619 | echo '<form action="', $URL->generate(), '" method="get">'; |
620 | 620 | if (get_http_var('o')) { |
621 | 621 | echo '<input type="hidden" name="o" value="', _htmlentities(get_http_var('o')), '">'; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | echo '<input type="hidden" name="house" value="', _htmlentities(get_http_var('house')), '">'; |
625 | 625 | } |
626 | 626 | echo '<input type="text" name="q" value="', _htmlentities($value), '" size="50"> '; |
627 | - echo '<input type="submit" value=" ', ($wtt?'Modify search':'Search'), ' ">'; |
|
627 | + echo '<input type="submit" value=" ', ($wtt ? 'Modify search' : 'Search'), ' ">'; |
|
628 | 628 | $URL = new \MySociety\TheyWorkForYou\Url('search'); |
629 | 629 | $URL->insert(array('adv' => 1)); |
630 | 630 | echo ' <a href="' . $URL->generate() . '">More options</a>'; |
@@ -646,16 +646,16 @@ discard block |
||
646 | 646 | $ordering = 'd'; |
647 | 647 | } |
648 | 648 | |
649 | - if ($ordering=='r') { |
|
649 | + if ($ordering == 'r') { |
|
650 | 650 | print '<strong>Sorted by relevance</strong>'; |
651 | 651 | } else { |
652 | 652 | printf("<a href='%s'>Sort by relevance</a>", $orderUrl->generate('html', array('o'=>'r'))); |
653 | 653 | } |
654 | 654 | |
655 | 655 | print " | "; |
656 | - if ($ordering=='d') { |
|
656 | + if ($ordering == 'd') { |
|
657 | 657 | print '<strong>Sorted by date: newest</strong> / <a href="' . $orderUrl->generate('html', array('o'=>'o')) . '">oldest</a>'; |
658 | - } elseif ($ordering=='o') { |
|
658 | + } elseif ($ordering == 'o') { |
|
659 | 659 | print '<strong>Sorted by date:</strong> <a href="' . $orderUrl->generate('html', array('o'=>'d')) . '">newest</a> / <strong>oldest</strong>'; |
660 | 660 | } else { |
661 | 661 | printf("Sort by date: <a href='%s'>newest</a> / <a href='%s'>oldest</a>", |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | } |
664 | 664 | |
665 | 665 | print " | "; |
666 | - if ($ordering=='p') { |
|
666 | + if ($ordering == 'p') { |
|
667 | 667 | print '<strong>Use by person</strong>'; |
668 | 668 | } else { |
669 | 669 | printf('<a href="%s">Show use by person</a>', $orderUrl->generate('html', array('o'=>'p'))); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | include_once INCLUDESPATH . 'easyparliament/templates/html/search_advanced.php'; |
688 | 688 | } |
689 | 689 | |
690 | - public function login_form ($errors = array()) { |
|
690 | + public function login_form($errors = array()) { |
|
691 | 691 | // Used for /user/login/ and /user/prompt/ |
692 | 692 | // $errors is a hash of potential errors from a previous log in attempt. |
693 | 693 | ?> |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | public function glossary_atoz(&$GLOSSARY) { |
792 | 792 | // Print out a nice list of lettered links to glossary pages |
793 | 793 | |
794 | - $letters = array (); |
|
794 | + $letters = array(); |
|
795 | 795 | |
796 | 796 | foreach ($GLOSSARY->alphabet as $letter => $eps) { |
797 | 797 | // if we're writing out the current letter (list or item) |
@@ -824,14 +824,14 @@ discard block |
||
824 | 824 | <div class="letters"> |
825 | 825 | <ul> |
826 | 826 | <?php |
827 | - for ($n=0; $n<13; $n++) { |
|
827 | + for ($n = 0; $n < 13; $n++) { |
|
828 | 828 | print $letters[$n]; |
829 | 829 | } |
830 | 830 | ?> |
831 | 831 | </ul> |
832 | 832 | <ul> |
833 | 833 | <?php |
834 | - for ($n=13; $n<26; $n++) { |
|
834 | + for ($n = 13; $n < 26; $n++) { |
|
835 | 835 | print $letters[$n]; |
836 | 836 | } |
837 | 837 | ?> |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | |
851 | 851 | // add some extra controls for the administrators |
852 | 852 | if ($this_page == "admin_glossary") { |
853 | - print "<a id=\"gl".$term['glossary_id']."\"></a>"; |
|
853 | + print "<a id=\"gl" . $term['glossary_id'] . "\"></a>"; |
|
854 | 854 | print "<h3>" . $term['title'] . "</h3>"; |
855 | 855 | $URL = new \MySociety\TheyWorkForYou\Url('admin_glossary'); |
856 | 856 | $URL->insert(array("delete_confirm" => $term['glossary_id'])); |
857 | 857 | $delete_url = $URL->generate(); |
858 | - $admin_links = "<br><small><a href=\"".$delete_url."\">delete</a></small>"; |
|
858 | + $admin_links = "<br><small><a href=\"" . $delete_url . "\">delete</a></small>"; |
|
859 | 859 | } |
860 | 860 | else { |
861 | 861 | $admin_links = ""; |
@@ -878,9 +878,9 @@ discard block |
||
878 | 878 | // Add a direct search link for current glossary item |
879 | 879 | $URL = new \MySociety\TheyWorkForYou\Url('search'); |
880 | 880 | // remember to quote the term for phrase matching in search |
881 | - $URL->insert(array('s' => '"'.$term['title'].'"')); |
|
881 | + $URL->insert(array('s' => '"' . $term['title'] . '"')); |
|
882 | 882 | $search_url = $URL->generate(); |
883 | - printf ("\t\t\t\t<p>Search hansard for \"<a href=\"%s\" title=\"View search results for this glossary item\">%s</a>\"</p>", $search_url, $term['title']); |
|
883 | + printf("\t\t\t\t<p>Search hansard for \"<a href=\"%s\" title=\"View search results for this glossary item\">%s</a>\"</p>", $search_url, $term['title']); |
|
884 | 884 | } |
885 | 885 | } |
886 | 886 | |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | |
956 | 956 | // Generate all the page links. |
957 | 957 | $URL = new \MySociety\TheyWorkForYou\Url($this_page); |
958 | - $URL->insert( array('wtt' => get_http_var('wtt')) ); |
|
958 | + $URL->insert(array('wtt' => get_http_var('wtt'))); |
|
959 | 959 | if (isset($pagedata['s'])) { |
960 | 960 | # XXX: Should be taken out in *one* place, not here + search_form etc. |
961 | 961 | $value = $pagedata['s']; |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | |
1094 | 1094 | $body = trim_characters($report['body'], 0, 40); |
1095 | 1095 | |
1096 | - $tabledata['rows'][] = array ( |
|
1096 | + $tabledata['rows'][] = array( |
|
1097 | 1097 | _htmlentities($report['firstname'] . ' ' . $report['lastname']), |
1098 | 1098 | _htmlentities($body), |
1099 | 1099 | $report['reported'], |
@@ -1124,13 +1124,13 @@ discard block |
||
1124 | 1124 | // $page is the name of the page the dates should link to. |
1125 | 1125 | |
1126 | 1126 | // Create array containing abbreviations of days of week. |
1127 | - $daysOfWeek = array('Mon','Tue','Wed','Thu','Fri','Sat','Sun'); |
|
1127 | + $daysOfWeek = array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'); |
|
1128 | 1128 | |
1129 | 1129 | // What is the first day of the month in question? |
1130 | - $firstDayOfMonth = mktime(0,0,0,$month,1,$year); |
|
1130 | + $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year); |
|
1131 | 1131 | |
1132 | 1132 | // How many days does this month contain? |
1133 | - $numberDays = date('t',$firstDayOfMonth); |
|
1133 | + $numberDays = date('t', $firstDayOfMonth); |
|
1134 | 1134 | |
1135 | 1135 | // Retrieve some information about the first day of the |
1136 | 1136 | // month in question. |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // Is the $currentDay a member of $dateArray? If so, |
1213 | 1213 | // the day should be linked. |
1214 | - if (in_array($currentDay,$dateArray)) { |
|
1214 | + if (in_array($currentDay, $dateArray)) { |
|
1215 | 1215 | |
1216 | 1216 | $date = sprintf("%04d-%02d-%02d", $year, $month, $currentDay); |
1217 | 1217 | |
@@ -1312,8 +1312,8 @@ discard block |
||
1312 | 1312 | // Returns HTML suitable for putting in the sidebar on Admin pages. |
1313 | 1313 | global $this_page, $DATA; |
1314 | 1314 | |
1315 | - $pages = array ('admin_home', |
|
1316 | - 'admin_comments','admin_trackbacks', 'admin_searchlogs', 'admin_popularsearches', 'admin_failedsearches', |
|
1315 | + $pages = array('admin_home', |
|
1316 | + 'admin_comments', 'admin_trackbacks', 'admin_searchlogs', 'admin_popularsearches', 'admin_failedsearches', |
|
1317 | 1317 | 'alert_stats', 'admin_statistics', 'admin_reportstats', |
1318 | 1318 | 'admin_commentreports', 'admin_glossary', 'admin_glossary_pending', 'admin_badusers', |
1319 | 1319 | 'admin_photos', 'admin_mpurls', 'admin_policies', 'admin_banner', 'admin_featured', 'admin_topics' |
@@ -18,10 +18,13 @@ |
||
18 | 18 | # Content goes here |
19 | 19 | foreach ($data['dates'] as $date => $day_events) { |
20 | 20 | foreach ($order as $i => $chamber) { |
21 | - if (!array_key_exists($chamber, $day_events)) |
|
22 | - continue; |
|
21 | + if (!array_key_exists($chamber, $day_events)) { |
|
22 | + continue; |
|
23 | + } |
|
23 | 24 | $events = $day_events[$chamber]; |
24 | - if ($plural[$i]) $chamber .= 's'; |
|
25 | + if ($plural[$i]) { |
|
26 | + $chamber .= 's'; |
|
27 | + } |
|
25 | 28 | print "<h2 class='calendar'>$chamber"; |
26 | 29 | if (in_array($major[$i], $data['majors'])) { |
27 | 30 | $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | print "<h2 class='calendar'>$chamber"; |
26 | 26 | if (in_array($major[$i], $data['majors'])) { |
27 | 27 | $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']); |
28 | - $URL->insert( array( 'd' => $date ) ); |
|
28 | + $URL->insert(array('d' => $date)); |
|
29 | 29 | print ' <a href="' . $URL->generate() . '">See this day →</a>'; |
30 | 30 | } |
31 | 31 | print "</h2>\n"; |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | } |
19 | 19 | $PAGE->block_start(array('id'=>'recentcomments', 'title'=>$title)); |
20 | 20 | |
21 | - if ($this_page != 'home') $PAGE->page_links($data); |
|
21 | + if ($this_page != 'home') { |
|
22 | + $PAGE->page_links($data); |
|
23 | + } |
|
22 | 24 | $USERURL = new \MySociety\TheyWorkForYou\Url('userview'); |
23 | 25 | ?> |
24 | 26 | <ul> |
@@ -50,7 +52,9 @@ discard block |
||
50 | 52 | <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p> |
51 | 53 | <?php |
52 | 54 | } |
53 | - if ($this_page != 'home') $PAGE->page_links($data); |
|
55 | + if ($this_page != 'home') { |
|
56 | + $PAGE->page_links($data); |
|
57 | + } |
|
54 | 58 | $PAGE->block_end(); |
55 | 59 | } |
56 | 60 | ?> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $date = format_date($date, SHORTDATEFORMAT); |
34 | 34 | $time = format_time($time, TIMEFORMAT); |
35 | 35 | |
36 | - $count = $n+1; |
|
36 | + $count = $n + 1; |
|
37 | 37 | |
38 | 38 | $USERURL->insert(array('u'=>$comment['user_id'])); |
39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($this_page == 'home') { |
48 | 48 | $MOREURL = new \MySociety\TheyWorkForYou\Url('comments_recent'); |
49 | 49 | ?> |
50 | - <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p> |
|
50 | + <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments']) + 1; ?>">See more annotations posted recently</a></p> |
|
51 | 51 | <?php |
52 | 52 | } |
53 | 53 | if ($this_page != 'home') $PAGE->page_links($data); |
@@ -20,49 +20,49 @@ discard block |
||
20 | 20 | |
21 | 21 | $starttime = time(); |
22 | 22 | for ($personrow=0; $personrow<$q->rows(); $personrow++) { |
23 | - $person_id = $q->field($personrow, 'person_id'); |
|
23 | + $person_id = $q->field($personrow, 'person_id'); |
|
24 | 24 | |
25 | - $args = array ( 'person_id' => $person_id ); |
|
26 | - $speeches = $HANSARDLIST->display('person', $args, 'none'); |
|
25 | + $args = array ( 'person_id' => $person_id ); |
|
26 | + $speeches = $HANSARDLIST->display('person', $args, 'none'); |
|
27 | 27 | |
28 | - // Some data about this person that we'll need for the feed. |
|
29 | - $MEMBER = new MEMBER(array('person_id' => $person_id)); |
|
30 | - $MPURL = new \MySociety\TheyWorkForYou\Url('mp'); |
|
31 | - $MPURL->insert(array('pid'=>$person_id)); |
|
32 | - $mpurl = $MPURL->generate(); |
|
28 | + // Some data about this person that we'll need for the feed. |
|
29 | + $MEMBER = new MEMBER(array('person_id' => $person_id)); |
|
30 | + $MPURL = new \MySociety\TheyWorkForYou\Url('mp'); |
|
31 | + $MPURL->insert(array('pid'=>$person_id)); |
|
32 | + $mpurl = $MPURL->generate(); |
|
33 | 33 | |
34 | - $date = gmdate('Y-m-d'); |
|
35 | - $time = gmdate('H:i:s'); |
|
36 | - $datenow = $date . 'T' . $time . '+00:00'; |
|
34 | + $date = gmdate('Y-m-d'); |
|
35 | + $time = gmdate('H:i:s'); |
|
36 | + $datenow = $date . 'T' . $time . '+00:00'; |
|
37 | 37 | |
38 | - // Prepare the meat of the RSS file. |
|
39 | - $items = ''; |
|
40 | - $entries = ''; |
|
41 | - if (isset ($speeches['rows']) && count($speeches['rows']) > 0) { |
|
38 | + // Prepare the meat of the RSS file. |
|
39 | + $items = ''; |
|
40 | + $entries = ''; |
|
41 | + if (isset ($speeches['rows']) && count($speeches['rows']) > 0) { |
|
42 | 42 | |
43 | - foreach ($speeches['rows'] as $n => $row) { |
|
43 | + foreach ($speeches['rows'] as $n => $row) { |
|
44 | 44 | |
45 | - // While we're linking to individual speeches, |
|
46 | - // the text is the body of the parent, ie (sub)section. |
|
47 | - $title = _htmlentities(str_replace('—', '-', $row['parent']['body'])); |
|
45 | + // While we're linking to individual speeches, |
|
46 | + // the text is the body of the parent, ie (sub)section. |
|
47 | + $title = _htmlentities(str_replace('—', '-', $row['parent']['body'])); |
|
48 | 48 | |
49 | - $link = isset($row['listurl']) ? $row['listurl'] : ''; |
|
50 | - $link = 'https://' . DOMAIN . $link; |
|
49 | + $link = isset($row['listurl']) ? $row['listurl'] : ''; |
|
50 | + $link = 'https://' . DOMAIN . $link; |
|
51 | 51 | |
52 | - $description = _htmlentities(trim_characters($row['body'], 0, 200)); |
|
53 | - $contentencoded = $row['body']; |
|
52 | + $description = _htmlentities(trim_characters($row['body'], 0, 200)); |
|
53 | + $contentencoded = $row['body']; |
|
54 | 54 | |
55 | - $hdate = format_date($row['hdate'], 'Y-m-d'); |
|
56 | - if ($row['htime'] != NULL) { |
|
57 | - $htime = format_time($row['htime'], 'H:i:s'); |
|
58 | - } else { |
|
59 | - $htime = '00:00:00'; |
|
60 | - } |
|
55 | + $hdate = format_date($row['hdate'], 'Y-m-d'); |
|
56 | + if ($row['htime'] != NULL) { |
|
57 | + $htime = format_time($row['htime'], 'H:i:s'); |
|
58 | + } else { |
|
59 | + $htime = '00:00:00'; |
|
60 | + } |
|
61 | 61 | |
62 | - $date = $hdate . 'T' . $htime . '+00:00'; |
|
62 | + $date = $hdate . 'T' . $htime . '+00:00'; |
|
63 | 63 | |
64 | - $items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n"; |
|
65 | - $entries .= "<item rdf:about=\"$link\"> |
|
64 | + $items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n"; |
|
65 | + $entries .= "<item rdf:about=\"$link\"> |
|
66 | 66 | <title>$title</title> |
67 | 67 | <link>$link</link> |
68 | 68 | <description>$description</description> |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | </item> |
72 | 72 | "; |
73 | 73 | |
74 | - } |
|
75 | - } |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | - // Prepare the whole text of the RSS file. |
|
78 | - $rsstext = '<?xml version="1.0" encoding="utf-8"?> |
|
77 | + // Prepare the whole text of the RSS file. |
|
78 | + $rsstext = '<?xml version="1.0" encoding="utf-8"?> |
|
79 | 79 | <rdf:RDF |
80 | 80 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
81 | 81 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | |
102 | 102 | </rdf:RDF>'; |
103 | 103 | |
104 | - // Write the text to the file... |
|
105 | - $filename = $rsspath . $person_id . '.rdf'; |
|
106 | - $fh = @fopen($filename, "w"); |
|
107 | - if (!$fh) { # Problem writing, just carry on |
|
108 | - echo "Could not write to file ($filename)\n"; |
|
109 | - continue; |
|
110 | - } |
|
111 | - fwrite($fh, $rsstext); |
|
112 | - fclose ($fh); |
|
104 | + // Write the text to the file... |
|
105 | + $filename = $rsspath . $person_id . '.rdf'; |
|
106 | + $fh = @fopen($filename, "w"); |
|
107 | + if (!$fh) { # Problem writing, just carry on |
|
108 | + echo "Could not write to file ($filename)\n"; |
|
109 | + continue; |
|
110 | + } |
|
111 | + fwrite($fh, $rsstext); |
|
112 | + fclose ($fh); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | #print "Took " . (time()-$starttime) . " seconds\n"; |
@@ -188,6 +188,9 @@ |
||
188 | 188 | return $items; |
189 | 189 | } |
190 | 190 | |
191 | + /** |
|
192 | + * @param \MySociety\TheyWorkForYou\Url $url |
|
193 | + */ |
|
191 | 194 | private function generate_pagination_links($data, $url, $first, $last) { |
192 | 195 | $links = array(); |
193 | 196 |
@@ -731,26 +731,26 @@ |
||
731 | 731 | function person_error_page($message) { |
732 | 732 | global $this_page; |
733 | 733 | switch($this_page) { |
734 | - case 'mla': |
|
735 | - $rep = 'MLA'; |
|
736 | - $SEARCHURL = '/postcode/'; |
|
737 | - $MPSURL = new \MySociety\TheyWorkForYou\Url('mlas'); |
|
738 | - break; |
|
739 | - case 'msp': |
|
740 | - $rep = 'MSP'; |
|
741 | - $SEARCHURL = '/postcode/'; |
|
742 | - $MPSURL = new \MySociety\TheyWorkForYou\Url('msps'); |
|
743 | - break; |
|
744 | - case 'peer': |
|
745 | - $rep = 'Lord'; |
|
746 | - $SEARCHURL = ''; |
|
747 | - $MPSURL = new \MySociety\TheyWorkForYou\Url('peers'); |
|
748 | - break; |
|
749 | - default: |
|
750 | - $rep = 'MP'; |
|
751 | - $SEARCHURL = new \MySociety\TheyWorkForYou\Url('mp'); |
|
752 | - $SEARCHURL = $SEARCHURL->generate(); |
|
753 | - $MPSURL = new \MySociety\TheyWorkForYou\Url('mps'); |
|
734 | + case 'mla': |
|
735 | + $rep = 'MLA'; |
|
736 | + $SEARCHURL = '/postcode/'; |
|
737 | + $MPSURL = new \MySociety\TheyWorkForYou\Url('mlas'); |
|
738 | + break; |
|
739 | + case 'msp': |
|
740 | + $rep = 'MSP'; |
|
741 | + $SEARCHURL = '/postcode/'; |
|
742 | + $MPSURL = new \MySociety\TheyWorkForYou\Url('msps'); |
|
743 | + break; |
|
744 | + case 'peer': |
|
745 | + $rep = 'Lord'; |
|
746 | + $SEARCHURL = ''; |
|
747 | + $MPSURL = new \MySociety\TheyWorkForYou\Url('peers'); |
|
748 | + break; |
|
749 | + default: |
|
750 | + $rep = 'MP'; |
|
751 | + $SEARCHURL = new \MySociety\TheyWorkForYou\Url('mp'); |
|
752 | + $SEARCHURL = $SEARCHURL->generate(); |
|
753 | + $MPSURL = new \MySociety\TheyWorkForYou\Url('mps'); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | $data = array( |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | if ($pid) { |
120 | 120 | $URL = new \MySociety\TheyWorkForYou\Url('search'); |
121 | - $URL->insert( array('pid'=>$pid, 'pop'=>1) ); |
|
121 | + $URL->insert(array('pid'=>$pid, 'pop'=>1)); |
|
122 | 122 | header('Location: ' . $URL->generate('none')); |
123 | 123 | exit; |
124 | 124 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } elseif ($THEUSER->postcode_is_set()) { |
150 | 150 | get_mp_by_user_postcode($THEUSER->postcode()); |
151 | 151 | } else { |
152 | - twfy_debug ('MP', "We don't have any way of telling what MP to display"); |
|
152 | + twfy_debug('MP', "We don't have any way of telling what MP to display"); |
|
153 | 153 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, but we can’t tell which representative to display.'); |
154 | 154 | } |
155 | 155 | if (!isset($MEMBER) || !$MEMBER->valid) { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if (!$MEMBER->current_member(HOUSE_TYPE_SCOTLAND)) { |
217 | 217 | $title .= ', former'; |
218 | 218 | } |
219 | - $title .= ' MSP, '.$MEMBER->constituency(); |
|
219 | + $title .= ' MSP, ' . $MEMBER->constituency(); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $positions = array(); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $data['eu_stance'] = $MEMBER->getEUStance(); |
311 | 311 | |
312 | 312 | # People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs |
313 | -$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS) ); |
|
313 | +$data['has_voting_record'] = (($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'Sinn Féin') || $MEMBER->house(HOUSE_TYPE_LORDS)); |
|
314 | 314 | # Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs |
315 | 315 | $data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'Sinn Féin' && !$MEMBER->current_member(HOUSE_TYPE_NI))); |
316 | 316 | $data['has_expenses'] = $data['leave_date'] > '2004-01-01'; |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | |
337 | 337 | $data['this_page'] = $this_page; |
338 | 338 | $data['current_assembly'] = 'westminster'; |
339 | -if ( $this_page == 'msp' || $this_page == 'yourmsp' ) { |
|
339 | +if ($this_page == 'msp' || $this_page == 'yourmsp') { |
|
340 | 340 | $data['current_assembly'] = 'scotland'; |
341 | -} else if ( $this_page == 'mla' || $this_page == 'yourmla' ) { |
|
341 | +} else if ($this_page == 'mla' || $this_page == 'yourmla') { |
|
342 | 342 | $data['current_assembly'] = 'ni'; |
343 | 343 | } |
344 | 344 | |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER); |
355 | 355 | $policySummaries = $divisions->getMemberDivisionDetails(); |
356 | 356 | |
357 | - $policyOptions = array( 'summaries' => $policySummaries); |
|
357 | + $policyOptions = array('summaries' => $policySummaries); |
|
358 | 358 | |
359 | 359 | // Generate voting segments |
360 | 360 | $set_descriptions = $policiesList->getSetDescriptions(); |
361 | - if ( $policy_set && array_key_exists($policy_set, $set_descriptions) ) { |
|
361 | + if ($policy_set && array_key_exists($policy_set, $set_descriptions)) { |
|
362 | 362 | $data['key_votes_segments'] = array( |
363 | 363 | array( |
364 | 364 | 'key' => $policy_set, |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | |
477 | 477 | case 'recent': |
478 | 478 | $policiesList = new MySociety\TheyWorkForYou\Policies; |
479 | - $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER ); |
|
479 | + $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER); |
|
480 | 480 | $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList); |
481 | 481 | |
482 | 482 | $data['divisions'] = $divisions->getRecentMemberDivisions(); |
@@ -487,15 +487,15 @@ discard block |
||
487 | 487 | |
488 | 488 | case 'divisions': |
489 | 489 | $policyID = get_http_var('policy'); |
490 | - if ( $policyID ) { |
|
491 | - $policiesList = new MySociety\TheyWorkForYou\Policies( $policyID ); |
|
490 | + if ($policyID) { |
|
491 | + $policiesList = new MySociety\TheyWorkForYou\Policies($policyID); |
|
492 | 492 | } else { |
493 | 493 | $policiesList = new MySociety\TheyWorkForYou\Policies; |
494 | 494 | } |
495 | - $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER ); |
|
495 | + $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER); |
|
496 | 496 | $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER, $positions, $policiesList); |
497 | 497 | |
498 | - if ( $policyID ) { |
|
498 | + if ($policyID) { |
|
499 | 499 | $data['policydivisions'] = $divisions->getMemberDivisionsForPolicy($policyID); |
500 | 500 | } else { |
501 | 501 | $data['policydivisions'] = $divisions->getAllMemberDivisionsByPolicy(); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | // generate party policy diffs |
574 | 574 | $party = new MySociety\TheyWorkForYou\Party($MEMBER->party()); |
575 | - $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER ); |
|
575 | + $positions = new MySociety\TheyWorkForYou\PolicyPositions($policiesList, $MEMBER); |
|
576 | 576 | $party_positions = $party->getAllPolicyPositions($policiesList); |
577 | 577 | $policy_diffs = $MEMBER->getPartyPolicyDiffs($party, $policiesList, $positions, true); |
578 | 578 | |
@@ -626,16 +626,16 @@ discard block |
||
626 | 626 | global $THEUSER; |
627 | 627 | $pc = preg_replace('#[^a-z0-9]#i', '', $pc); |
628 | 628 | if (!validate_postcode($pc)) { |
629 | - twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
630 | - throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn’t a valid postcode'); |
|
629 | + twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
630 | + throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn’t a valid postcode'); |
|
631 | 631 | } |
632 | - twfy_debug ('MP', "MP lookup by postcode"); |
|
632 | + twfy_debug('MP', "MP lookup by postcode"); |
|
633 | 633 | $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc)); |
634 | 634 | if ($constituency == "connection_timed_out") { |
635 | 635 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, we couldn’t check your postcode right now, as our postcode lookup server is under quite a lot of load.'); |
636 | 636 | } elseif ($constituency == "") { |
637 | - twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency"); |
|
638 | - throw new MySociety\TheyWorkForYou\MemberException('Sorry, '._htmlentities($pc) .' isn’t a known postcode'); |
|
637 | + twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency"); |
|
638 | + throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . _htmlentities($pc) . ' isn’t a known postcode'); |
|
639 | 639 | } else { |
640 | 640 | // Redirect to the canonical MP page, with a person id. |
641 | 641 | $MEMBER = new MySociety\TheyWorkForYou\Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS)); |
@@ -647,11 +647,11 @@ discard block |
||
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
650 | -function get_person_by_name($name, $const='') { |
|
650 | +function get_person_by_name($name, $const = '') { |
|
651 | 651 | $MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const)); |
652 | 652 | // Edge case, only attempt further detection if this isn't the Queen. |
653 | 653 | if ($name !== 'elizabeth the second' || $const) { |
654 | - twfy_debug ('MP', 'Redirecting for MP found by name/constituency'); |
|
654 | + twfy_debug('MP', 'Redirecting for MP found by name/constituency'); |
|
655 | 655 | member_redirect($MEMBER); |
656 | 656 | } |
657 | 657 | return $MEMBER; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * Redirect to the canonical page for a member. |
686 | 686 | */ |
687 | 687 | |
688 | -function member_redirect (&$MEMBER, $code = 301, $pagetype = NULL) { |
|
688 | +function member_redirect(&$MEMBER, $code = 301, $pagetype = NULL) { |
|
689 | 689 | // We come here after creating a MEMBER object by various methods. |
690 | 690 | // Now we redirect to the canonical MP page, with a person_id. |
691 | 691 | if ($MEMBER->person_id()) { |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | } else { |
703 | 703 | $pagetype = ''; |
704 | 704 | } |
705 | - header('Location: ' . $url . $pagetype, true, $code ); |
|
705 | + header('Location: ' . $url . $pagetype, true, $code); |
|
706 | 706 | exit; |
707 | 707 | } |
708 | 708 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | function person_error_page($message) { |
732 | 732 | global $this_page; |
733 | - switch($this_page) { |
|
733 | + switch ($this_page) { |
|
734 | 734 | case 'mla': |
735 | 735 | $rep = 'MLA'; |
736 | 736 | $SEARCHURL = '/postcode/'; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * Generate the summary of this person's held positions. |
769 | 769 | */ |
770 | 770 | |
771 | -function person_summary_description ($MEMBER) { |
|
771 | +function person_summary_description($MEMBER) { |
|
772 | 772 | $entered_house = $MEMBER->entered_house(); |
773 | 773 | $current_member = $MEMBER->current_member(); |
774 | 774 | $left_house = $MEMBER->left_house(); |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | } |
780 | 780 | $desc = ''; |
781 | 781 | foreach ($MEMBER->houses() as $house) { |
782 | - if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) |
|
782 | + if ($house == HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) |
|
783 | 783 | continue; # Same info is printed further down |
784 | 784 | |
785 | 785 | if (!$current_member[$house]) $desc .= 'Former '; |
@@ -800,17 +800,17 @@ discard block |
||
800 | 800 | $desc .= $last['from'] . ' '; |
801 | 801 | } |
802 | 802 | } |
803 | - if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) { |
|
803 | + if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) { |
|
804 | 804 | $desc .= ' '; |
805 | - if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
|
806 | - if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
|
807 | - if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
|
805 | + if ($house == HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
|
806 | + if ($house == HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
|
807 | + if ($house == HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
|
808 | 808 | if ($party_br) { |
809 | 809 | $desc .= " ($party_br)"; |
810 | 810 | } |
811 | 811 | $desc .= ' for ' . $left_house[$house]['constituency']; |
812 | 812 | } |
813 | - if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer'; |
|
813 | + if ($house == HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer'; |
|
814 | 814 | $desc .= ', '; |
815 | 815 | } |
816 | 816 | $desc = preg_replace('#, $#', '', $desc); |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * @return string A HTML summary of this person's rebellion rate. |
828 | 828 | */ |
829 | 829 | |
830 | -function person_rebellion_rate ($member) { |
|
830 | +function person_rebellion_rate($member) { |
|
831 | 831 | |
832 | 832 | // Rebellion string may be empty. |
833 | 833 | $rebellion_string = ''; |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | // benefit unfortunately. |
867 | 867 | twfy_debug_timestamp(); |
868 | 868 | |
869 | - $person_id= $member->person_id(); |
|
869 | + $person_id = $member->person_id(); |
|
870 | 870 | |
871 | 871 | $memcache = new MySociety\TheyWorkForYou\Memcache; |
872 | 872 | $recent = $memcache->get('recent_appear:' . $person_id); |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | $SEARCHENGINE = new \SEARCHENGINE($searchstring); |
878 | 878 | |
879 | 879 | $hansard = new MySociety\TheyWorkForYou\Hansard(); |
880 | - $args = array ( |
|
880 | + $args = array( |
|
881 | 881 | 's' => $searchstring, |
882 | 882 | 'p' => 1, |
883 | 883 | 'num' => 3, |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | twfy_debug_timestamp(); |
893 | 893 | |
894 | 894 | $MOREURL = new \MySociety\TheyWorkForYou\Url('search'); |
895 | - $MOREURL->insert( array('pid'=>$person_id, 'pop'=>1) ); |
|
895 | + $MOREURL->insert(array('pid'=>$person_id, 'pop'=>1)); |
|
896 | 896 | |
897 | 897 | $out['more_href'] = $MOREURL->generate() . '#n4'; |
898 | 898 | $out['more_text'] = 'More of ' . ucfirst($member->full_name()) . '’s recent appearances'; |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | |
1104 | - foreach ( $wtt_stats_years as $year ) { |
|
1104 | + foreach ($wtt_stats_years as $year) { |
|
1105 | 1105 | $wtt_displayed = display_writetothem_numbers($year, $extra_info); |
1106 | 1106 | if ($wtt_displayed) { |
1107 | 1107 | $out[] = $wtt_displayed; |
@@ -1131,23 +1131,23 @@ discard block |
||
1131 | 1131 | } |
1132 | 1132 | */ |
1133 | 1133 | |
1134 | - if (display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid='.$member->person_id().'">', 'annotation', "</a> on this MP’s speeches", '', $extra_info)) { |
|
1135 | - $out[] = display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid='.$member->person_id().'">', 'annotation', "</a> on this MP’s speeches", '', $extra_info); |
|
1134 | + if (display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid=' . $member->person_id() . '">', 'annotation', "</a> on this MP’s speeches", '', $extra_info)) { |
|
1135 | + $out[] = display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid=' . $member->person_id() . '">', 'annotation', "</a> on this MP’s speeches", '', $extra_info); |
|
1136 | 1136 | } |
1137 | 1137 | if (display_stats_line('reading_age', 'This MP’s speeches, in Hansard, are readable by an average ', '', ' year old, going by the <a href="https://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info)) { |
1138 | 1138 | $out[] = display_stats_line('reading_age', 'This MP’s speeches, in Hansard, are readable by an average ', '', ' year old, going by the <a href="https://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info); |
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | |
1142 | - if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) { |
|
1143 | - $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking '; |
|
1142 | + if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts'] > 0 || $has_email_alerts)) { |
|
1143 | + $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are') . ' tracking '; |
|
1144 | 1144 | if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP'; |
1145 | 1145 | elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer'; |
1146 | 1146 | elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA'; |
1147 | 1147 | elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP'; |
1148 | 1148 | elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name(); |
1149 | 1149 | if ($has_email_alerts) { |
1150 | - $line .= ' — <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '’s activity</a>'; |
|
1150 | + $line .= ' — <a href="' . WEBPATH . 'alert/?pid=' . $member->person_id() . '">email me updates on ' . $member->full_name() . '’s activity</a>'; |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | $out[] = $line; |
@@ -1177,25 +1177,25 @@ discard block |
||
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | function display_stats_line_house($house, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff) { |
1180 | - if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category =='comments_on_speeches' || |
|
1181 | - $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category =='Lcomments_on_speeches') { |
|
1182 | - if ($extra_info[$category]==0) { |
|
1180 | + if ($category == 'wrans_asked_inlastyear' || $category == 'debate_sectionsspoken_inlastyear' || $category == 'comments_on_speeches' || |
|
1181 | + $category == 'Lwrans_asked_inlastyear' || $category == 'Ldebate_sectionsspoken_inlastyear' || $category == 'Lcomments_on_speeches') { |
|
1182 | + if ($extra_info[$category] == 0) { |
|
1183 | 1183 | $blurb = preg_replace('#<a.*?>#', '', $blurb); |
1184 | 1184 | $inwhat = preg_replace('#<\/a>#', '', $inwhat); |
1185 | 1185 | } |
1186 | 1186 | } |
1187 | - if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat); |
|
1187 | + if ($house == HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat); |
|
1188 | 1188 | $line = $blurb; |
1189 | 1189 | $line .= '<strong>' . $extra_info[$category]; |
1190 | 1190 | if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]); |
1191 | 1191 | $line .= '</strong>'; |
1192 | 1192 | $line .= $inwhat; |
1193 | - if ($minister===2) { |
|
1193 | + if ($minister === 2) { |
|
1194 | 1194 | $line .= ' — Speakers/ deputy speakers do not ask written questions'; |
1195 | 1195 | } elseif ($minister) |
1196 | 1196 | $line .= ' — Ministers do not ask written questions'; |
1197 | 1197 | else { |
1198 | - $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA')); |
|
1198 | + $type = ($house == HOUSE_TYPE_COMMONS ? 'MP' : ($house == HOUSE_TYPE_LORDS ? 'Lord' : 'MLA')); |
|
1199 | 1199 | if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) { |
1200 | 1200 | $line .= ' — '; |
1201 | 1201 | $q = $extra_info[$category . '_quintile']; |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | if ($a == 'very high') $a = 'a very high'; |
1241 | 1241 | $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a; |
1242 | 1242 | |
1243 | - return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info); |
|
1243 | + return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/' . $year . '/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during " . $year . ", according to constituents", "", $extra_info); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | function get_all_writetothem_strings($member, $wtt_stats_years) { |
1249 | 1249 | $extra_info = $member->extra_info(); |
1250 | 1250 | $strings = array(); |
1251 | - foreach ( $wtt_stats_years as $year ) { |
|
1251 | + foreach ($wtt_stats_years as $year) { |
|
1252 | 1252 | |
1253 | 1253 | if (isset($extra_info["writetothem_responsiveness_mean_$year"])) { |
1254 | 1254 | $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"]; |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | return; |
1265 | 1265 | } |
1266 | 1266 | |
1267 | - $reg = array( 'date' => '', 'data' => '<p>Nil</p>' ); |
|
1267 | + $reg = array('date' => '', 'data' => '<p>Nil</p>'); |
|
1268 | 1268 | if (isset($extra_info['register_member_interests_date'])) { |
1269 | 1269 | $reg['date'] = format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT); |
1270 | 1270 | } |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | $dissolution['params']); |
1300 | 1300 | } |
1301 | 1301 | $mcon = array(); $mreg = array(); |
1302 | - for ($i=0; $i<$q->rows(); $i++) { |
|
1302 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
1303 | 1303 | $house = $q->field($i, 'house'); |
1304 | 1304 | $pid = $q->field($i, 'person_id'); |
1305 | 1305 | $cons = $q->field($i, 'constituency'); |
@@ -1337,8 +1337,8 @@ discard block |
||
1337 | 1337 | } |
1338 | 1338 | } |
1339 | 1339 | |
1340 | - foreach($mreg as $reg) { |
|
1341 | - $data['members'][] = array ( |
|
1340 | + foreach ($mreg as $reg) { |
|
1341 | + $data['members'][] = array( |
|
1342 | 1342 | 'url' => '/' . $rep_type . '/?p=' . $reg['person_id'], |
1343 | 1343 | 'name' => $reg['given_name'] . ' ' . $reg['family_name'] |
1344 | 1344 | ); |
@@ -62,16 +62,36 @@ discard block |
||
62 | 62 | $constituency = strtolower(str_replace('_', ' ', get_http_var('c'))); |
63 | 63 | |
64 | 64 | // Fix for names with non-ASCII characters |
65 | -if ($name == 'sion simon') $name = 'si\xf4n simon'; |
|
66 | -if ($name == 'sian james') $name = 'si\xe2n james'; |
|
67 | -if ($name == 'lembit opik') $name = 'lembit \xf6pik'; |
|
68 | -if ($name == 'bairbre de brun') $name = 'bairbre de br\xfan'; |
|
69 | -if ($name == 'daithi mckay') $name = 'daith\xed mckay'; |
|
70 | -if ($name == 'caral ni chuilin') $name = 'car\xe1l n\xed chuil\xedn'; |
|
71 | -if ($name == 'caledon du pre') $name = 'caledon du pr\xe9'; |
|
72 | -if ($name == 'sean etchingham') $name = 'se\xe1n etchingham'; |
|
73 | -if ($name == 'john tinne') $name = 'john tinn\xe9'; |
|
74 | -if ($name == 'renee short') $name = 'ren\xe9e short'; |
|
65 | +if ($name == 'sion simon') { |
|
66 | + $name = 'si\xf4n simon'; |
|
67 | +} |
|
68 | +if ($name == 'sian james') { |
|
69 | + $name = 'si\xe2n james'; |
|
70 | +} |
|
71 | +if ($name == 'lembit opik') { |
|
72 | + $name = 'lembit \xf6pik'; |
|
73 | +} |
|
74 | +if ($name == 'bairbre de brun') { |
|
75 | + $name = 'bairbre de br\xfan'; |
|
76 | +} |
|
77 | +if ($name == 'daithi mckay') { |
|
78 | + $name = 'daith\xed mckay'; |
|
79 | +} |
|
80 | +if ($name == 'caral ni chuilin') { |
|
81 | + $name = 'car\xe1l n\xed chuil\xedn'; |
|
82 | +} |
|
83 | +if ($name == 'caledon du pre') { |
|
84 | + $name = 'caledon du pr\xe9'; |
|
85 | +} |
|
86 | +if ($name == 'sean etchingham') { |
|
87 | + $name = 'se\xe1n etchingham'; |
|
88 | +} |
|
89 | +if ($name == 'john tinne') { |
|
90 | + $name = 'john tinn\xe9'; |
|
91 | +} |
|
92 | +if ($name == 'renee short') { |
|
93 | + $name = 'ren\xe9e short'; |
|
94 | +} |
|
75 | 95 | |
76 | 96 | // Fix for common misspellings, name changes etc |
77 | 97 | $name_fix = array( |
@@ -103,7 +123,9 @@ discard block |
||
103 | 123 | } |
104 | 124 | |
105 | 125 | // Fixes for Ynys Mon, and a Unicode URL |
106 | -if ($constituency == 'ynys mon') $constituency = "ynys m\xf4n"; |
|
126 | +if ($constituency == 'ynys mon') { |
|
127 | + $constituency = "ynys m\xf4n"; |
|
128 | +} |
|
107 | 129 | if (preg_match("#^ynys m\xc3\xb4n#i", $constituency)) { |
108 | 130 | $constituency = "ynys m\xf4n"; |
109 | 131 | } |
@@ -126,11 +148,17 @@ discard block |
||
126 | 148 | |
127 | 149 | ///////////////////////////////////////////////////////// |
128 | 150 | // DETERMINE TYPE OF REPRESENTITIVE |
129 | -if (get_http_var('peer')) $this_page = 'peer'; |
|
130 | -elseif (get_http_var('royal')) $this_page = 'royal'; |
|
131 | -elseif (get_http_var('mla')) $this_page = 'mla'; |
|
132 | -elseif (get_http_var('msp')) $this_page = 'msp'; |
|
133 | -else $this_page = 'mp'; |
|
151 | +if (get_http_var('peer')) { |
|
152 | + $this_page = 'peer'; |
|
153 | +} elseif (get_http_var('royal')) { |
|
154 | + $this_page = 'royal'; |
|
155 | +} elseif (get_http_var('mla')) { |
|
156 | + $this_page = 'mla'; |
|
157 | +} elseif (get_http_var('msp')) { |
|
158 | + $this_page = 'msp'; |
|
159 | +} else { |
|
160 | + $this_page = 'mp'; |
|
161 | +} |
|
134 | 162 | |
135 | 163 | try { |
136 | 164 | if (is_numeric($pid)) { |
@@ -179,8 +207,9 @@ discard block |
||
179 | 207 | $desc = "Read $member_name's contributions to Parliament, including speeches and questions"; |
180 | 208 | |
181 | 209 | // Enhance description if this is a current member |
182 | -if ($MEMBER->current_member_anywhere()) |
|
210 | +if ($MEMBER->current_member_anywhere()) { |
|
183 | 211 | $desc .= ', investigate their voting record, and get email alerts on their activity'; |
212 | +} |
|
184 | 213 | |
185 | 214 | // Enhance title if this is a member of the Commons |
186 | 215 | if ($MEMBER->house(HOUSE_TYPE_COMMONS)) { |
@@ -188,8 +217,10 @@ discard block |
||
188 | 217 | $title .= ', former'; |
189 | 218 | } |
190 | 219 | $title .= ' MP'; |
191 | - if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency(); |
|
192 | -} |
|
220 | + if ($MEMBER->constituency()) { |
|
221 | + $title .= ', ' . $MEMBER->constituency(); |
|
222 | + } |
|
223 | + } |
|
193 | 224 | |
194 | 225 | // Enhance title if this is a member of NIA |
195 | 226 | if ($MEMBER->house(HOUSE_TYPE_NI)) { |
@@ -202,8 +233,10 @@ discard block |
||
202 | 233 | $title .= ', former'; |
203 | 234 | } |
204 | 235 | $title .= ' MLA'; |
205 | - if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency(); |
|
206 | -} |
|
236 | + if ($MEMBER->constituency()) { |
|
237 | + $title .= ', ' . $MEMBER->constituency(); |
|
238 | + } |
|
239 | + } |
|
207 | 240 | |
208 | 241 | // Enhance title if this is a member of Scottish Parliament |
209 | 242 | if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) { |
@@ -224,14 +257,18 @@ discard block |
||
224 | 257 | // Position if this is a member of the Commons |
225 | 258 | if ($MEMBER->house(HOUSE_TYPE_COMMONS)) { |
226 | 259 | $position = $MEMBER->current_member(HOUSE_TYPE_COMMONS) ? 'MP' : 'Former MP'; |
227 | - if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency(); |
|
260 | + if ($MEMBER->constituency()) { |
|
261 | + $position .= ', ' . $MEMBER->constituency(); |
|
262 | + } |
|
228 | 263 | $positions[] = $position; |
229 | 264 | } |
230 | 265 | |
231 | 266 | // Position if this is a member of NIA |
232 | 267 | if ($MEMBER->house(HOUSE_TYPE_NI)) { |
233 | 268 | $position = $MEMBER->current_member(HOUSE_TYPE_NI) ? 'MLA' : 'Former MLA'; |
234 | - if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency(); |
|
269 | + if ($MEMBER->constituency()) { |
|
270 | + $position .= ', ' . $MEMBER->constituency(); |
|
271 | + } |
|
235 | 272 | $positions[] = $position; |
236 | 273 | } |
237 | 274 | |
@@ -265,8 +302,9 @@ discard block |
||
265 | 302 | |
266 | 303 | // Build the RSS link and add it to page data. |
267 | 304 | $feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf'; |
268 | -if (file_exists(BASEDIR . '/' . $feedurl)) |
|
305 | +if (file_exists(BASEDIR . '/' . $feedurl)) { |
|
269 | 306 | $DATA->set_page_metadata($this_page, 'rss', $feedurl); |
307 | +} |
|
270 | 308 | |
271 | 309 | // Prepare data for the template |
272 | 310 | $data['full_name'] = $MEMBER->full_name(); |
@@ -692,11 +730,13 @@ discard block |
||
692 | 730 | $url = $MEMBER->url(); |
693 | 731 | $params = array(); |
694 | 732 | foreach ($_GET as $key => $value) { |
695 | - if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') |
|
696 | - $params[] = "$key=$value"; |
|
733 | + if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') { |
|
734 | + $params[] = "$key=$value"; |
|
735 | + } |
|
736 | + } |
|
737 | + if (count($params)) { |
|
738 | + $url .= '?' . join('&', $params); |
|
697 | 739 | } |
698 | - if (count($params)) |
|
699 | - $url .= '?' . join('&', $params); |
|
700 | 740 | if ($pagetype) { |
701 | 741 | $pagetype = '/' . $pagetype; |
702 | 742 | } else { |
@@ -773,16 +813,21 @@ discard block |
||
773 | 813 | $current_member = $MEMBER->current_member(); |
774 | 814 | $left_house = $MEMBER->left_house(); |
775 | 815 | |
776 | - if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) { # Royal short-circuit |
|
816 | + if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) { |
|
817 | +# Royal short-circuit |
|
777 | 818 | return '<strong>Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty'] |
778 | 819 | . '<br>Coronated on 2 June 1953</strong></li>'; |
779 | 820 | } |
780 | 821 | $desc = ''; |
781 | 822 | foreach ($MEMBER->houses() as $house) { |
782 | - if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) |
|
783 | - continue; # Same info is printed further down |
|
823 | + if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) { |
|
824 | + continue; |
|
825 | + } |
|
826 | + # Same info is printed further down |
|
784 | 827 | |
785 | - if (!$current_member[$house]) $desc .= 'Former '; |
|
828 | + if (!$current_member[$house]) { |
|
829 | + $desc .= 'Former '; |
|
830 | + } |
|
786 | 831 | |
787 | 832 | $party = $left_house[$house]['party']; |
788 | 833 | $party_br = ''; |
@@ -790,8 +835,9 @@ discard block |
||
790 | 835 | $party_br = $m[2]; |
791 | 836 | $party = $m[1]; |
792 | 837 | } |
793 | - if ($party != 'unknown') |
|
794 | - $desc .= _htmlentities($party); |
|
838 | + if ($party != 'unknown') { |
|
839 | + $desc .= _htmlentities($party); |
|
840 | + } |
|
795 | 841 | if ($party == 'Speaker' || $party == 'Deputy Speaker') { |
796 | 842 | $desc .= ', and '; |
797 | 843 | # XXX: Might go horribly wrong if something odd happens |
@@ -802,15 +848,23 @@ discard block |
||
802 | 848 | } |
803 | 849 | if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) { |
804 | 850 | $desc .= ' '; |
805 | - if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
|
806 | - if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
|
807 | - if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
|
851 | + if ($house==HOUSE_TYPE_COMMONS) { |
|
852 | + $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
|
853 | + } |
|
854 | + if ($house==HOUSE_TYPE_NI) { |
|
855 | + $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
|
856 | + } |
|
857 | + if ($house==HOUSE_TYPE_SCOTLAND) { |
|
858 | + $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
|
859 | + } |
|
808 | 860 | if ($party_br) { |
809 | 861 | $desc .= " ($party_br)"; |
810 | 862 | } |
811 | 863 | $desc .= ' for ' . $left_house[$house]['constituency']; |
812 | 864 | } |
813 | - if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer'; |
|
865 | + if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') { |
|
866 | + $desc .= ' Peer'; |
|
867 | + } |
|
814 | 868 | $desc .= ', '; |
815 | 869 | } |
816 | 870 | $desc = preg_replace('#, $#', '', $desc); |
@@ -1073,10 +1127,13 @@ discard block |
||
1073 | 1127 | # Find latest entered house |
1074 | 1128 | $entered_house = null; |
1075 | 1129 | foreach ($member->entered_house() as $h => $eh) { |
1076 | - if (!$entered_house || $eh['date'] > $entered_house) $entered_house = $eh['date']; |
|
1130 | + if (!$entered_house || $eh['date'] > $entered_house) { |
|
1131 | + $entered_house = $eh['date']; |
|
1132 | + } |
|
1133 | + } |
|
1134 | + if ($entered_house > $year_ago) { |
|
1135 | + $since_text = 'since joining Parliament'; |
|
1077 | 1136 | } |
1078 | - if ($entered_house > $year_ago) |
|
1079 | - $since_text = 'since joining Parliament'; |
|
1080 | 1137 | |
1081 | 1138 | $MOREURL = new \MySociety\TheyWorkForYou\Url('search'); |
1082 | 1139 | $section = 'section:debates section:whall section:lords section:ni'; |
@@ -1089,10 +1146,12 @@ discard block |
||
1089 | 1146 | $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1)); |
1090 | 1147 | // We assume that if they've answered a question, they're a minister |
1091 | 1148 | $minister = 0; $Lminister = false; |
1092 | - if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) |
|
1093 | - $minister = 1; |
|
1094 | - if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) |
|
1095 | - $Lminister = true; |
|
1149 | + if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) { |
|
1150 | + $minister = 1; |
|
1151 | + } |
|
1152 | + if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) { |
|
1153 | + $Lminister = true; |
|
1154 | + } |
|
1096 | 1155 | if ($member->party() == 'SPK' || $member->party() == 'CWM' || $member->party() == 'DCWM') { |
1097 | 1156 | $minister = 2; |
1098 | 1157 | } |
@@ -1141,11 +1200,17 @@ discard block |
||
1141 | 1200 | |
1142 | 1201 | if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) { |
1143 | 1202 | $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking '; |
1144 | - if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP'; |
|
1145 | - elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer'; |
|
1146 | - elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA'; |
|
1147 | - elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP'; |
|
1148 | - elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name(); |
|
1203 | + if ($member->house_disp == HOUSE_TYPE_COMMONS) { |
|
1204 | + $line .= 'this MP'; |
|
1205 | + } elseif ($member->house_disp == HOUSE_TYPE_LORDS) { |
|
1206 | + $line .= 'this peer'; |
|
1207 | + } elseif ($member->house_disp == HOUSE_TYPE_NI) { |
|
1208 | + $line .= 'this MLA'; |
|
1209 | + } elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) { |
|
1210 | + $line .= 'this MSP'; |
|
1211 | + } elseif ($member->house_disp == HOUSE_TYPE_ROYAL) { |
|
1212 | + $line .= $member->full_name(); |
|
1213 | + } |
|
1149 | 1214 | if ($has_email_alerts) { |
1150 | 1215 | $line .= ' — <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '’s activity</a>'; |
1151 | 1216 | } |
@@ -1169,10 +1234,12 @@ discard block |
||
1169 | 1234 | |
1170 | 1235 | function display_stats_line($category, $blurb, $type, $inwhat, $afterstuff, $extra_info, $minister = false, $Lminister = false) { |
1171 | 1236 | $return = false; |
1172 | - if (isset($extra_info[$category])) |
|
1173 | - $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff); |
|
1174 | - if (isset($extra_info["L$category"])) |
|
1175 | - $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff); |
|
1237 | + if (isset($extra_info[$category])) { |
|
1238 | + $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff); |
|
1239 | + } |
|
1240 | + if (isset($extra_info["L$category"])) { |
|
1241 | + $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff); |
|
1242 | + } |
|
1176 | 1243 | return $return; |
1177 | 1244 | } |
1178 | 1245 | |
@@ -1184,17 +1251,21 @@ discard block |
||
1184 | 1251 | $inwhat = preg_replace('#<\/a>#', '', $inwhat); |
1185 | 1252 | } |
1186 | 1253 | } |
1187 | - if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat); |
|
1254 | + if ($house==HOUSE_TYPE_LORDS) { |
|
1255 | + $inwhat = str_replace('MP', 'Lord', $inwhat); |
|
1256 | + } |
|
1188 | 1257 | $line = $blurb; |
1189 | 1258 | $line .= '<strong>' . $extra_info[$category]; |
1190 | - if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]); |
|
1259 | + if ($type) { |
|
1260 | + $line .= ' ' . make_plural($type, $extra_info[$category]); |
|
1261 | + } |
|
1191 | 1262 | $line .= '</strong>'; |
1192 | 1263 | $line .= $inwhat; |
1193 | 1264 | if ($minister===2) { |
1194 | 1265 | $line .= ' — Speakers/ deputy speakers do not ask written questions'; |
1195 | - } elseif ($minister) |
|
1196 | - $line .= ' — Ministers do not ask written questions'; |
|
1197 | - else { |
|
1266 | + } elseif ($minister) { |
|
1267 | + $line .= ' — Ministers do not ask written questions'; |
|
1268 | + } else { |
|
1198 | 1269 | $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA')); |
1199 | 1270 | if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) { |
1200 | 1271 | $line .= ' — '; |
@@ -1233,11 +1304,21 @@ discard block |
||
1233 | 1304 | $mean = $extra_info["writetothem_responsiveness_mean_$year"]; |
1234 | 1305 | |
1235 | 1306 | $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"]; |
1236 | - if ($a == 'very low') $a = 'a very low'; |
|
1237 | - if ($a == 'low') $a = 'a low'; |
|
1238 | - if ($a == 'medium') $a = 'a medium'; |
|
1239 | - if ($a == 'high') $a = 'a high'; |
|
1240 | - if ($a == 'very high') $a = 'a very high'; |
|
1307 | + if ($a == 'very low') { |
|
1308 | + $a = 'a very low'; |
|
1309 | + } |
|
1310 | + if ($a == 'low') { |
|
1311 | + $a = 'a low'; |
|
1312 | + } |
|
1313 | + if ($a == 'medium') { |
|
1314 | + $a = 'a medium'; |
|
1315 | + } |
|
1316 | + if ($a == 'high') { |
|
1317 | + $a = 'a high'; |
|
1318 | + } |
|
1319 | + if ($a == 'very high') { |
|
1320 | + $a = 'a very high'; |
|
1321 | + } |
|
1241 | 1322 | $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a; |
1242 | 1323 | |
1243 | 1324 | return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info); |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | $gid = $featured->get_gid(); |
58 | 58 | $gidCheck = new Gid($gid); |
59 | 59 | $gid = $gidCheck->checkForRedirect(); |
60 | - if ( $gid ) { |
|
60 | + if ($gid) { |
|
61 | 61 | $title = $featured->get_title(); |
62 | 62 | $context = $featured->get_context(); |
63 | 63 | $related = $featured->get_related(); |
64 | 64 | $item = $this->getFeaturedDebate($gid, $title, $context, $related); |
65 | 65 | } else { |
66 | 66 | $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none'); |
67 | - if ( isset($item['data']) && count($item['data']) ) { |
|
67 | + if (isset($item['data']) && count($item['data'])) { |
|
68 | 68 | $item = $item['data'][0]; |
69 | 69 | $more_url = new Url('debates'); |
70 | 70 | $item['more_url'] = $more_url->generate(); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | $item['featured'] = true; |
96 | 96 | |
97 | 97 | $related_debates = array(); |
98 | - foreach ( $related as $related_gid ) { |
|
99 | - if ( $related_gid ) { |
|
98 | + foreach ($related as $related_gid) { |
|
99 | + if ($related_gid) { |
|
100 | 100 | $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none'); |
101 | 101 | $related_debates[] = $related_item['data']; |
102 | 102 | } |
@@ -121,21 +121,21 @@ discard block |
||
121 | 121 | |
122 | 122 | $recent_content = array(); |
123 | 123 | |
124 | - foreach ( $this->recent_types as $class => $recent ) { |
|
124 | + foreach ($this->recent_types as $class => $recent) { |
|
125 | 125 | $class = "\\$class"; |
126 | 126 | $instance = new $class(); |
127 | 127 | $more_url = new Url($recent[1]); |
128 | - if ( $recent[0] == 'recent_pbc_debates' ) { |
|
129 | - $content = array( 'data' => $instance->display($recent[0], array('num' => 5), 'none') ); |
|
128 | + if ($recent[0] == 'recent_pbc_debates') { |
|
129 | + $content = array('data' => $instance->display($recent[0], array('num' => 5), 'none')); |
|
130 | 130 | } else { |
131 | 131 | $content = $instance->display($recent[0], array('days' => 7, 'num' => 1), 'none'); |
132 | - if ( isset($content['data']) && count($content['data']) ) { |
|
132 | + if (isset($content['data']) && count($content['data'])) { |
|
133 | 133 | $content = $content['data'][0]; |
134 | 134 | } else { |
135 | 135 | $content = array(); |
136 | 136 | } |
137 | 137 | } |
138 | - if ( $content ) { |
|
138 | + if ($content) { |
|
139 | 139 | $content['more_url'] = $more_url->generate(); |
140 | 140 | $content['desc'] = $recent[2]; |
141 | 141 | $recent_content[] = $content; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | WHERE event_date >= :date |
155 | 155 | AND deleted = 0 |
156 | 156 | ORDER BY event_date, chamber, pos", |
157 | - array( ':date' => $date ) |
|
157 | + array(':date' => $date) |
|
158 | 158 | ); |
159 | 159 | |
160 | 160 | if (!$q->rows()) { |