@@ -319,7 +319,8 @@ discard block |
||
319 | 319 | |
320 | 320 | if (preg_match("/^(\d\d\d\d)-(\d\d?)-(\d\d?)$/", $date, $matches)) { |
321 | 321 | [$string, $year, $month, $day] = $matches; |
322 | - if ($year < 1902) { # gmdate fns only go back to Dec. 1901 |
|
322 | + if ($year < 1902) { |
|
323 | +# gmdate fns only go back to Dec. 1901 |
|
323 | 324 | if ($format == SHORTDATEFORMAT) { |
324 | 325 | return ($day + 0) . ' ' . $format_date_months_short[$month + 0] . " $year"; |
325 | 326 | } else { |
@@ -1046,7 +1047,8 @@ discard block |
||
1046 | 1047 | 'Lords in Waiting (HM Household)' => 'Government Whip', |
1047 | 1048 | 'Baronesses in Waiting, HM Household' => 'Government Whip', |
1048 | 1049 | ]; |
1049 | - if ($pos) { # Government post, or Chairman of Select Committee |
|
1050 | + if ($pos) { |
|
1051 | +# Government post, or Chairman of Select Committee |
|
1050 | 1052 | $pretty = $pos; |
1051 | 1053 | if ($dept && $dept != 'No Department') { |
1052 | 1054 | $pretty .= ", $dept"; |
@@ -1054,7 +1056,8 @@ discard block |
||
1054 | 1056 | if (array_key_exists($pretty, $lookup)) { |
1055 | 1057 | $pretty = $lookup[$pretty]; |
1056 | 1058 | } |
1057 | - } else { # Member of Select Committee |
|
1059 | + } else { |
|
1060 | +# Member of Select Committee |
|
1058 | 1061 | $pretty = "Member, $dept"; |
1059 | 1062 | } |
1060 | 1063 | return $pretty; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if ($debug_level != '') { |
30 | 30 | |
31 | 31 | // Set which level shows which types of debug info. |
32 | - $levels = [ |
|
32 | + $levels = [ |
|
33 | 33 | 1 => ['THEUSER', 'TIME', 'SQLERROR', 'PAGE', 'TEMPLATE', 'SEARCH', 'ALERTS', 'MP'], |
34 | 34 | 2 => ['SQL', 'EMAIL', 'WIKIPEDIA', 'hansardlist', 'debatelist', 'wranslist', 'whalllist'], |
35 | 35 | 3 => ['SQLRESULT'], |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // consider are E_WARNING, E_NOTICE, E_USER_ERROR, |
79 | 79 | // E_USER_WARNING and E_USER_NOTICE |
80 | 80 | # Commented out are ones that a user function cannot handle. |
81 | - $errortype = [ |
|
81 | + $errortype = [ |
|
82 | 82 | #E_ERROR => "Error", |
83 | 83 | E_WARNING => "Warning", |
84 | 84 | #E_PARSE => "Parsing Error", |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | $in_seconds = strtotime($datetime); |
356 | 356 | $now = time(); |
357 | 357 | |
358 | - $diff = $now - $in_seconds; |
|
359 | - $months = floor($diff / 2419200); |
|
358 | + $diff = $now - $in_seconds; |
|
359 | + $months = floor($diff / 2419200); |
|
360 | 360 | $diff -= $months * 2419200; |
361 | - $weeks = floor($diff / 604800); |
|
361 | + $weeks = floor($diff / 604800); |
|
362 | 362 | $diff -= $weeks * 604800; |
363 | - $days = floor($diff / 86400); |
|
363 | + $days = floor($diff / 86400); |
|
364 | 364 | $diff -= $days * 86400; |
365 | - $hours = floor($diff / 3600); |
|
365 | + $hours = floor($diff / 3600); |
|
366 | 366 | $diff -= $hours * 3600; |
367 | 367 | $minutes = floor($diff / 60); |
368 | 368 | $diff -= $minutes * 60; |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | |
498 | 498 | if ($filter_type == 'strict') { |
499 | 499 | // No tags allowed at all! |
500 | - $filter->allowed = []; |
|
500 | + $filter->allowed = []; |
|
501 | 501 | } else { |
502 | 502 | // Comment. |
503 | 503 | // Only allowing <a href>, <b>, <strong>, <i> and <em> |
504 | - $filter->allowed = [ |
|
504 | + $filter->allowed = [ |
|
505 | 505 | 'a' => ['href'], |
506 | 506 | 'strong' => [], |
507 | 507 | 'em' => [], |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $link_length = 60; |
531 | 531 | $text = preg_replace_callback( |
532 | 532 | "/(?<!\"|\/)((http(s?):\/\/)|(www\.))([a-zA-Z\d_.+,;:?%~\-\/#='*$!()&[\]]+)([a-zA-Z\d_?%~\-\/#='*$!&])/", |
533 | - function ($matches) use ($link_length) { |
|
533 | + function($matches) use ($link_length) { |
|
534 | 534 | if (strlen($matches[0]) > $link_length) { |
535 | 535 | return '<a href="' . $matches[0] . '" rel="nofollow">' . substr($matches[0], 0, $link_length) . "...</a>"; |
536 | 536 | } else { |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | function entities_to_numbers($string) { |
899 | 899 | $string = str_replace( |
900 | 900 | ['Ö', 'â', 'ú', 'á', 'í', 'ô', 'é'], |
901 | - ['Ö', 'â', 'ú', 'á', 'í', 'ô', 'é' ], |
|
901 | + ['Ö', 'â', 'ú', 'á', 'í', 'ô', 'é'], |
|
902 | 902 | $string |
903 | 903 | ); |
904 | 904 | return $string; |
@@ -915,9 +915,9 @@ discard block |
||
915 | 915 | } |
916 | 916 | } |
917 | 917 | |
918 | - $s = [' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó']; |
|
919 | - $s2 = [" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93"]; |
|
920 | - $r = ['_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o']; |
|
918 | + $s = [' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó']; |
|
919 | + $s2 = [" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93"]; |
|
920 | + $r = ['_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o']; |
|
921 | 921 | $name = preg_replace('#^the #', '', strtolower($name)); |
922 | 922 | |
923 | 923 | $out = ''; |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | } |
1097 | 1097 | $out .= '<li>' . $body . '<ul>'; |
1098 | 1098 | } else { |
1099 | - $LISTURL->insert([ 'id' => $gid ]); |
|
1099 | + $LISTURL->insert(['id' => $gid]); |
|
1100 | 1100 | $out .= '<li><a href="' . $LISTURL->generate() . '">'; |
1101 | 1101 | $out .= $body . '</a>'; |
1102 | 1102 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | global $hansardmajors; |
31 | 31 | global $db; |
32 | 32 | |
33 | - $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [ ':gid' => $gid ])->first(); |
|
33 | + $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [':gid' => $gid])->first(); |
|
34 | 34 | $url_gid = fix_gid_from_db($gid); |
35 | 35 | $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']); |
36 | 36 | $url->insert(['id' => $url_gid]); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | print "<h2>Preview Content</h2>"; |
119 | 119 | if ($gid !== null) { |
120 | 120 | $h = new MySociety\TheyWorkForYou\Homepage(); |
121 | - $featured = $h->getFeaturedDebate($gid, $title, $context, [ $related_gid1, $related_gid2, $related_gid3 ]); |
|
121 | + $featured = $h->getFeaturedDebate($gid, $title, $context, [$related_gid1, $related_gid2, $related_gid3]); |
|
122 | 122 | |
123 | 123 | include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php'; |
124 | 124 | } else { |
@@ -128,9 +128,9 @@ |
||
128 | 128 | |
129 | 129 | $rettext .= '<div id="subnav_websites">'; |
130 | 130 | foreach ($subnav as $label => $path) { |
131 | - $rettext .= '<a href="' . $path . '">' . $label . '</a>'; |
|
131 | + $rettext .= '<a href="' . $path . '">' . $label . '</a>'; |
|
132 | 132 | } |
133 | - $rettext .= '</div>'; |
|
133 | + $rettext .= '</div>'; |
|
134 | 134 | |
135 | 135 | return $rettext; |
136 | 136 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | print '<h3>Headline stats</h3> <table>'; |
20 | 20 | $data = [ |
21 | - 'header' => [ 'Alert Type', 'Count' ], |
|
21 | + 'header' => ['Alert Type', 'Count'], |
|
22 | 22 | 'rows' => [ |
23 | - [ 'Confirmed', $q_confirmed ], |
|
24 | - [ 'Not Confirmed', $q_not_confirmed ], |
|
25 | - [ 'Deleted', $q_deleted ], |
|
26 | - [ 'For a Speaker<sup>*</sup>', $q_speaker ], |
|
27 | - [ 'For a Keyword', $q_keyword ], |
|
23 | + ['Confirmed', $q_confirmed], |
|
24 | + ['Not Confirmed', $q_not_confirmed], |
|
25 | + ['Deleted', $q_deleted], |
|
26 | + ['For a Speaker<sup>*</sup>', $q_speaker], |
|
27 | + ['For a Keyword', $q_keyword], |
|
28 | 28 | ], |
29 | 29 | ]; |
30 | 30 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $criteria = $row['criteria']; |
41 | 41 | $rows[] = [$id, $critera]; |
42 | 42 | } |
43 | -$data = [ 'rows' => $rows ]; |
|
43 | +$data = ['rows' => $rows]; |
|
44 | 44 | $PAGE->display_table($data); |
45 | 45 | |
46 | 46 | $q = $db->query('select count(*) as c, criteria from alerts where criteria like "speaker:%" and confirmed and not deleted group by criteria order by c desc'); |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -$people_header = [ 'Name', 'Confirmed', 'Unconfirmed']; |
|
82 | +$people_header = ['Name', 'Confirmed', 'Unconfirmed']; |
|
83 | 83 | print '<h3>Alert signups by MP/Peer</h3>'; |
84 | 84 | $rows = []; |
85 | 85 | foreach ($tots as $person_id => $c) { |
86 | 86 | $u = $unconfirmed[$person_id] ?? 0; |
87 | - $rows[] = [ $name[$person_id], $c, $u ]; |
|
87 | + $rows[] = [$name[$person_id], $c, $u]; |
|
88 | 88 | } |
89 | 89 | $data = [ |
90 | - 'header' => [ 'Name', 'Confirmed', 'Unconfirmed'], |
|
90 | + 'header' => ['Name', 'Confirmed', 'Unconfirmed'], |
|
91 | 91 | 'rows' => $rows, |
92 | 92 | ]; |
93 | 93 | $PAGE->display_table($data); |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | foreach ($total as $criteria => $tot) { |
115 | 115 | $c = $confirmed[$criteria] ?? 0; |
116 | 116 | $u = $unconfirmed[$criteria] ?? 0; |
117 | - $rows[] = [ $criteria, $c, $u ]; |
|
117 | + $rows[] = [$criteria, $c, $u]; |
|
118 | 118 | } |
119 | 119 | $data = [ |
120 | - 'header' => [ 'Criteria', 'Confirmed', 'Unconfirmed'], |
|
120 | + 'header' => ['Criteria', 'Confirmed', 'Unconfirmed'], |
|
121 | 121 | 'rows' => $rows, |
122 | 122 | ]; |
123 | 123 | $PAGE->display_table($data); |
@@ -125,7 +125,7 @@ |
||
125 | 125 | <select name="sets[]" multiple> |
126 | 126 | <option value="">None</option> |
127 | 127 | <?php |
128 | - $policies = new \MySociety\TheyWorkForYou\Policies(); |
|
128 | + $policies = new \MySociety\TheyWorkForYou\Policies(); |
|
129 | 129 | $set_descriptions = $policies->getSetDescriptions(); |
130 | 130 | $related_sets = $topic->getPolicySets(); |
131 | 131 | foreach ($set_descriptions as $set => $description) { ?> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $sysretval = 0; |
107 | 107 | $personid = get_http_var('editperson'); |
108 | 108 | |
109 | - $q = $db->query("DELETE FROM personinfo WHERE data_key = 'mp_website' AND personinfo.person_id = :person_id", [ |
|
109 | + $q = $db->query("DELETE FROM personinfo WHERE data_key = 'mp_website' AND personinfo.person_id = :person_id", [ |
|
110 | 110 | ':person_id' => $personid, |
111 | 111 | ]); |
112 | 112 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | $rettext .= '<div id="subnav_websites">'; |
144 | 144 | foreach ($subnav as $label => $path) { |
145 | - $rettext .= '<a href="' . $path . '">' . $label . '</a>'; |
|
145 | + $rettext .= '<a href="' . $path . '">' . $label . '</a>'; |
|
146 | 146 | } |
147 | - $rettext .= '</div>'; |
|
147 | + $rettext .= '</div>'; |
|
148 | 148 | |
149 | 149 | return $rettext; |
150 | 150 | } |
@@ -11,5 +11,5 @@ |
||
11 | 11 | $gid = fix_gid_from_db($gid); |
12 | 12 | |
13 | 13 | $URL = new \MySociety\TheyWorkForYou\Url('debates'); |
14 | -$URL->insert([ 'id' => $gid ]); |
|
14 | +$URL->insert(['id' => $gid]); |
|
15 | 15 | header('Location: ' . $URL->generate()); |
@@ -89,13 +89,13 @@ |
||
89 | 89 | $member_names = \MySociety\TheyWorkForYou\Utility\House::house_to_members($house); |
90 | 90 | if ($house == HOUSE_TYPE_SCOTLAND) { |
91 | 91 | $urlp = 'msp'; |
92 | - $a = [ $areas['SPC'], $areas['SPE'] ]; |
|
92 | + $a = [$areas['SPC'], $areas['SPE']]; |
|
93 | 93 | } elseif ($house == HOUSE_TYPE_WALES) { |
94 | 94 | $urlp = 'ms'; |
95 | - $a = [ $areas['WAC'], $areas['WAE'] ]; |
|
95 | + $a = [$areas['WAC'], $areas['WAE']]; |
|
96 | 96 | } elseif ($house == HOUSE_TYPE_NI) { |
97 | 97 | $urlp = 'mla'; |
98 | - $a = [ $areas['NIE'] ]; |
|
98 | + $a = [$areas['NIE']]; |
|
99 | 99 | } |
100 | 100 | $urlpl = $urlp . 's'; |
101 | 101 | $urlp = "/$urlp/?p="; |
@@ -221,7 +221,7 @@ |
||
221 | 221 | // Basic name, title and description |
222 | 222 | $member_name = ucfirst($MEMBER->full_name()); |
223 | 223 | $title = $member_name; |
224 | -$desc = "Read $member_name's contributions to Parliament, including speeches and questions"; |
|
224 | +$desc = "read $member_name's contributions to Parliament, including speeches and questions"; |
|
225 | 225 | |
226 | 226 | // Enhance description if this is a current member |
227 | 227 | if ($MEMBER->current_member_anywhere()) { |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER); |
394 | 394 | $policySummaries = $divisions->getMemberDivisionDetails(true); |
395 | 395 | |
396 | - $policyOptions = [ 'summaries' => $policySummaries]; |
|
396 | + $policyOptions = ['summaries' => $policySummaries]; |
|
397 | 397 | |
398 | 398 | // Generate voting segments |
399 | 399 | $set_descriptions = $policiesList->getSetDescriptions(); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | 'health', 'education', 'reform', 'home', 'environment', |
411 | 411 | 'transport', 'housing', 'misc', |
412 | 412 | ]; |
413 | - $sets = array_filter($sets, function ($v) use ($set_descriptions) { |
|
413 | + $sets = array_filter($sets, function($v) use ($set_descriptions) { |
|
414 | 414 | return array_key_exists($v, $set_descriptions); |
415 | 415 | }); |
416 | 416 | shuffle($sets); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | $data['sorted_diffs_only'] = array_filter( |
435 | 435 | $data['sorted_diffs'], |
436 | - function ($k) { return $k['score_difference'] >= 2; } |
|
436 | + function($k) { return $k['score_difference'] >= 2; } |
|
437 | 437 | ); |
438 | 438 | |
439 | 439 | // Send the output for rendering |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | function person_error_page($message) { |
666 | 666 | global $this_page; |
667 | 667 | $SEARCHURL = ''; |
668 | - switch($this_page) { |
|
668 | + switch ($this_page) { |
|
669 | 669 | case 'peer': |
670 | 670 | $people = new MySociety\TheyWorkForYou\People\Peers(); |
671 | 671 | $MPSURL = new \MySociety\TheyWorkForYou\Url('peers'); |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | $SEARCHENGINE = new \SEARCHENGINE($searchstring); |
851 | 851 | |
852 | 852 | $hansard = new MySociety\TheyWorkForYou\Hansard(); |
853 | - $args = [ |
|
853 | + $args = [ |
|
854 | 854 | 's' => $searchstring, |
855 | 855 | 'p' => 1, |
856 | 856 | 'num' => 3, |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | $lang = LANGUAGE; |
1068 | 1068 | |
1069 | - $reg = ['chamber_registers' => [] ]; |
|
1069 | + $reg = ['chamber_registers' => []]; |
|
1070 | 1070 | |
1071 | 1071 | foreach ($valid_chambers as $chamber) { |
1072 | 1072 | $key = 'person_regmem_' . $chamber . '_' . $lang; |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | // sort chamber registers by published_date |
1084 | - uasort($reg['chamber_registers'], function ($a, $b) { |
|
1084 | + uasort($reg['chamber_registers'], function($a, $b) { |
|
1085 | 1085 | return $a->published_date <=> $b->published_date; |
1086 | 1086 | }); |
1087 | 1087 | |
@@ -1175,8 +1175,8 @@ discard block |
||
1175 | 1175 | } |
1176 | 1176 | } |
1177 | 1177 | |
1178 | - foreach($mreg as $reg) { |
|
1179 | - $data['members'][] = [ |
|
1178 | + foreach ($mreg as $reg) { |
|
1179 | + $data['members'][] = [ |
|
1180 | 1180 | 'url' => '/' . $rep_type . '/?p=' . $reg['person_id'], |
1181 | 1181 | 'name' => $reg['given_name'] . ' ' . $reg['family_name'], |
1182 | 1182 | ]; |